Giter Site home page Giter Site logo

yashjain28 / indoor-asset-tracking Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ms1752/indoor-asset-tracking

0.0 2.0 0.0 177 KB

A Generic Indoor Asset Tracking system for viewing asset locations on a map using x and y positions.

JavaScript 100.00%

indoor-asset-tracking's Introduction

ipm package: indoor-asset-tracking

Overview

A Generic Indoor Asset Tracking system for viewing asset locations on a map using x and y positions. Also includes basic section management, and alerts.

This is an ipm package, which contains one or more reusable assets within the ipm Community. The 'package.json' in this repo is a ipm spec's package.json, here, which is a superset of npm's package.json spec, here.

Browse ipm Packages

Setup

There is minimal setup required for this IPM package. Out of the box it includes an example map, asset types, and assets that will update their location on the map every 30 seconds.

To integrate this package with your x/y coordinate based location system, you simply need to follow the API structure below for the expected location MQTT messages. The system itself will handle creating the needed devices within the ClearBlade Platform for each asset.

Once new devices are added, you will need to visit the Asset Administration portal to create map configurations and asset types as necessary, as well as to assign these values to new devices.

API

Location

Asset Location MQTT Message structure:

{
	"asset_name": "my-asset",  
	"x_pos": 123.1,
	"y_pos": 812.5,
	"timestamp": "2018-02-20T17:04:34Z"
}

These messages should be published to invididual topics per asset, the asset name being the last path in the topic: asset/location/<asset name>

Alerts

If you have defined sections via the Asset Management portal, the system will provide alerts any time an asset enters and/or leaves a section. These alerts are provided via MQTT, and the topic structure is:

alerts/<map_name>/<asset_name>

Functions

getSystemConfiguration(configOptionsToGet, callback)

Fetch system wide configuration options from the system_configuration collection. Supports fetching all configuration options, as well as only a set of specific options

createDemoData()

Creates demo location data for each device within the system. Called via a timer in the ClearBlade platform.

getAssets(asset_type)

Fetch all assets (devices) that have both an asset_type and map_name set. Also checks inactivity time for asset, and sets an is_active flag accordingly.

getNewAssets()

Fetch all new assets (devices) that have either asset_type or map_name values as null. Also checks inactivity time for asset, and sets an is_active flag accordingly.

updateDeviceLocation(location_message)

Update an assets location and last_location_update value when a new location message is received for the device

Typedefs

getSystemConfigurationCallback : function

Callback type for fetching system configuration

getSystemConfiguration(configOptionsToGet, callback)

Fetch system wide configuration options from the system_configuration collection. Supports fetching all configuration options, as well as only a set of specific options

Kind: global function

Param Type Description
configOptionsToGet Array.<string> An array of configuration options to fetch from the system_configuration collection. Optional value, omitted all configuration options are returned
callback getSystemConfigurationCallback The callback that handles the response containing the requested system configuration values

createDemoData()

Creates demo location data for each device within the system. Called via a timer in the ClearBlade platform.

Kind: global function

getAssets(asset_type)

Fetch all assets (devices) that have both an asset_type and map_name set. Also checks inactivity time for asset, and sets an is_active flag accordingly.

Kind: global function

Param Type Description
asset_type string An optional asset_type to fetch specifically. If not provided, any device that has a non-null asset_type will be returned

getNewAssets()

Fetch all new assets (devices) that have either asset_type or map_name values as null. Also checks inactivity time for asset, and sets an is_active flag accordingly.

Kind: global function

updateDeviceLocation(location_message)

Update an assets location and last_location_update value when a new location message is received for the device

Kind: global function

Param Type Description
location_message Object A new location object via MQTT

getSystemConfigurationCallback : function

Callback type for fetching system configuration

Kind: global typedef

Param Type Description
systemConfiguration Object An object containing keys and values of system configuration objects. Will be undefined if there was an error fetching the system configuration.

Usage

Code Services

Name Description
createDemoData Creates demo data for any devices that already exist within the system. This allows you to get an idea of this systems functionality before integration with y our own x/y location system. It will send new data for all devices every 30 seconds.
getAssets Fetches all assets (devices) that have been initialized within the system (meaning a map_name and asset_type has been set for the asset). Also will add an is_active field based off the last activity time of this asset.
getNewAssets Fetches all uninitialized assets (devices) within the system (meaning either a map_name or asset_type has not been set for this asset). Also adds an is_active field.
updateDeviceLocation Updates an asset with the latest cordinates.

Code Libraries

Name Description
getSystemConfiguration Helper function to fetch system configuration data stored in the system_configuration collection.

Portals

Name Description
Asset Administration A portal for managing assets, map configurations, asset types, and sections. Allows you to set the map and asset type for new assets. As well as update existing assets configuration. Also able to create, update, and delete map configurations and asset types as needed. Section creation and deleting is also done through this portal, and allows you to draw any polygon based section over top the map, and the system will create alerts when any assets enter or leave any section.
Asset Tracking This portal is for viewing assets on the map, as well as seeing any active assets details. Also contains a list of inactive devices that have not been seen recently. Any sections created for this map will also displayed over top the map.

Collections

Name Description
asset_types Stores all needed data for each asset type, including it's name, display name, and a base64 string of the icon to use for this asset
map_display_config Stores all map display data for each map, including the name, display name, a base64 string of the map itself, and the width and height of the original map.
system_configuration Stores and system level configuration options needed by this package. An example is the time in minutes for a device to be considered inactive.
sections Stores section configuration data, including coordinates for defining the section polygon, fill color to use, and the section name.

Thank you

Powered by ClearBlade Enterprise IoT Platform: https://platform.clearblade.com

indoor-asset-tracking's People

Contributors

ms1752 avatar rreinold avatar

Watchers

James Cloos avatar Yash Jain avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.