Difference between revisions of "M2M Bridge"

From AMTech WikiDocs
Jump to: navigation, search
(How to implement a new plugin)
 
(456 intermediate revisions by 4 users not shown)
Line 1: Line 1:
== Functionality ==
+
[[File:AmtechM2mBridge.svg|40px]] M2MBridge is a software stack that implements M2M edge functionality leveraging AMTech IoT Protocol
* Configurable edge intelligence
+
# [[M2MBridge Functionality|Functionality]]
* Bridges standard and proprietary protocols to AMTech IoT DAP.
+
# [[Configuration example]]
* Device-to-device or device-to-server communications.
+
# [[M2MBridge network]]
** MQTT, LLRP, CoAP, STOMP, SmartM2M, LWM2M, PLC, Zigbee and others
+
#: [[Aggregation]]
* Allow remote and centralized control of IoT devices and gateways.
+
#: [[Edge reasoners]]
** SNMP/MIB/TRAP, Reader Management and other
+
#: [[Mesh network]]
* Configurable autodiscover
+
# [[Intelligence at the Edge]]
* Implements common functionality and host the execution of the protocols
+
#: [[WhatIsAPlugin|What is a plugin?]]
* Network failure detection and recovery
+
#: [[EPC (Electronic product code)]]
* Get centralized configuration information at startup and real time modifications
+
#: [[Smoothing observations]]
* Access control policies to manage observation production and consumption
+
# [[Observations production and consumption]]
[[File:Example.jpg]]
+
# [[Cloud Configuration]]
 
+
#: [[Observation production config]]
== Edge Configuration ==
+
#: [[Validation]]
*Edge/Device(s) site configuration bridgeConfig.json #1
+
#: [[Sample configuration for beacons]]
**located at M2MBridge root directory.
+
# [[Automatic updates on bridge instance delete]]
    {
+
# [[Implementation notes]]
    <span style="color:red">//text to label bridge instance</span>
+
# [[How to implement a new plugin]]
    "description": "AMTech M2M Bridge",
+
# [[Set up a new Raspberry PI]]
        "dap":{
+
# [[Edge Configuration|M2MBridge Edge Configuration]]
            <span style="color:red">//amtech IoT DAP ur</span>
+
# [[M2MBridge updates]]
            "dapUrl": "https://dap.amtech.mx",   
+
# [[How to install & execute]]
            <span style="color:red">//userid for the m2mBridge instance</span>
+
# [[HelloWorld plugin]]
            "userId": "xxxxxxx@amtech.mx",
+
# Supported plugins
            <span style="color:red">// tenant where bridge been configured</span>     
+
## [[File:wi-fi.svg|35px]] [[File:tcp-ip.svg|35px]] [https://en.wikipedia.org/wiki/Ethernet Wifi or RJ45 Ethernet]
            "tenant" : "xxxxxxx", 
+
##: [[File:SNMPDevice.svg|35px]] [[SNMPDevice]]
            <span style="color:red">//m2mBridge userId password</span> 
+
##: [[File:LLRPReader.svg|35px]] [[LLRPReader]]
            "password" :"xxxxxxxx",
+
##:: [[File:LLRPAntenna.svg|35px]] [[LLRPAntenna]]
            <span style="color:red">//topic to get crud and command observations</span>
+
##: [[File:thing-magic.svg|35px]] [[ThingMagicEPCReader]]
            "crudCommandUrl" :"/xx/xx/"
+
##:: [[File:LLRPAntenna.svg|35px]] [[LLRPAntenna]]
        },
+
##: [[File:plc-icon.svg|35px]] [[OPCUADevice]]
        <span style="color:red">//access control information add to send observations</span>
+
##: [[File:modbus.svg|45px]] [[ModbusDevice]]
        "guestSecurity":{
+
##: [[File:wioGeneric.png|45px]] [[Wio Devices]] (troubleshooting inside)
            <span style="color:red">//add guest tenants to observations send from bridge</span>
+
##:: [[File:wioNode.svg.svg|35px]] [[wioNode]]
            "guesttenants":["progressnext2016"],   
+
##:: [[File:wioLink.svg|35px]] [[wioLink]]
            <span style="color:red">//add guest users to observations send from bridge</span>
+
## [[File:bt.svg|35px]] [https://en.wikipedia.org/wiki/Bluetooth_Low_Energy BLE 4.0]
            "guestusers":[]      
+
##: [[File:BLEbeaconsScanner.svg|35px]] [[BLEbeaconsScanner]]
        },
+
##: [[File:bleOBDScanner.svg|35px]] [[BLEODB2Scanner]]
        <span style="color:red">//network failed configuration</span>
+
##: [[File:BLEPeripheralsScanner.svg|35px]] [[BLEPeripheralsScanner]]
        "networkFailed" :{
+
##: [[File:BluvisioniBEEK.jpg|65px]] [[BLEBluvisionBeeksScanner]]
            <span style="color:red">//re-connection delay after an instance of plug in failed </span>
+
##: [[File:BLEGattCentral.svg|35px]] [[BLEGattCentral]]
            "reconnectWait" : 60000      
+
## [[File:i2c.svg|35px]] [https://en.wikipedia.org/wiki/I%C2%B2C I2C]
        },
+
##: [[File:watersensor.svg|35px]] [[PCA9536I2CWaterDetectionWithBuzzer]]
        <span style="color:red">//network failed configuration</span>
+
##: [[File:TSL2561Light.svg|65px]] [[TSL2561I2CLight]]
        "pluginLoad" :{         //bridge startup configuration
+
##: [[File:soundvibration.svg|35px]] [[ADC121C021I2CSoundVibrationShock]]
            <span style="color:red">//network failed configuration</span>
+
##: [[File:ncd-i2c.png|65px]] [https://store.ncd.io/shop/?fwp_interface=i2c-interface NCD I2C devices]
            "sendM2mBridgeError" : true //send observations error when errors occurred at bridge layer
+
##: [[File:grove-log.png|65px]] [https://www.seeedstudio.com/category/Grove-c-1003%7C%7C24.html?p=0 Grove devices via I2C]
        },
+
## [[File:usb-logo.svg|35px]] [https://en.wikipedia.org/wiki/USB USB 2.0]
        <span style="color:red">//network failed configuration</span>
+
##: [[File:thing-magic.svg|35px]] [[ThingMagicEPCReader]]
        "logger" :{
+
##:: [[File:LLRPAntenna.svg|35px]] [[LLRPAntenna]]
            <span style="color:red">//network failed configuration</span>
+
##: [[File:Phidgets-Logo.png|65px]] [https://www.phidgets.com/?tier=0&catid=3&pcid=12 Phidgets USB sensors]
            "colorize" : true, //colorize log console messages
+
<!--##:[[File:modbus.svg|45px]] [[ModbusDevice]]-->
            <span style="color:red">//network failed configuration</span>
+
## [[File:xbee-pro-900hp.svg|35px]] [https://www.digikey.com/catalog/en/partgroup/xbee-pro-900hp/33082?utm_adgroup=RF%20&%20RFID XBee-Pro 900HP]
            "level": "debug" //log level
+
##: [[File:relay-home-automation.svg|35px]] [[NCDXbee900Relay]]
        },
+
##: [[File:energy-monitor.svg|35px]] [[NCDXbee900EnergyMonitor]]
        <span style="color:red">//Address use to geo locate m2mBridge instance</span>
+
##: [[File:ncd-i2c.png|65px]] [https://store.ncd.io/shop/?fwp_interface=900hp-s3b NCD devices supporting XBee-Pro 900HP communication]
        "address" :{
+
<!-- ## [[File:libelium.svg|45px]] [[waspmoteBLECentral]]-->
            "country" : "usa",
+
##: [[File:libelium.svg|65px]] [http://www.libelium.com/libeliumworld/waspmote/ Libelium waspmote]
            "city": "Las Vegas",
+
##:: [[File:SmartEnvironment.jpg|65px]] [[Smart environment PRO]]
            "road": "Las Vegas Boulevard South",
+
##:: [[File:SmartAgriculture.png|65px]] [[Smart Agriculture]]
            "number":"3960"
+
##:: [[File:SmartWater.jpg|65px]] [[Smart Water]]
        },
+
##:: [[File:SmartWaterIons.png|65px]] [[Smart Water Ions]]
        <span style="color:red">//Id to uniquely identify a M2MBridge instance, in absence of this property a unique identifier gets created</span>
+
##:: [[File:SmartCities.jpg|65px]] [[Smart Cities]]
        "bridgeId":"m2mBridgeProgressNext",     
+
##:: [[File:SmartParking.jpg|65px]] [[Smart Parking]]
        <span style="color:red">//auto discover configuration</span>
+
##:: [[File:SmartSecurity.jpg|65px]] [[Smart Security]]
        "autoDiscover":{
+
##:: [[File:Radiation.png|65px]] [[Radiation]]
            <span style="color:red">//create things type instances at startup time</span>
+
##:: [[File:AmbientControl.png|65px]] [[Ambient Control]]
            "execute" : false,                       
+
            <span style="color:red">//Jsonld instances of the thing to be created </span>
+
            "instances":{"SNMPDevice":[{...}], ...}
+
        }
+
    }
+
 
+
== Cloud Configuration ==
+
* Create an "m2mBridge" actor
+
** Add the things type polices the bridge needs access to
+
** Police must have user check; enabling instance access control by m2mBridge instance 
+
** Add the thing types the bridge creates plug in instances
+
*Create a follower:
+
** Give actor "m2mBridge" access
+
** Uniquely identify each m2mBridge
+
*Activity observation configuration:
+
** Configure the observations types the bridge will produce
+
** Configure the topic the m2mBridge will get crud and command observations to be matched with bridgeConfig.json property
+
<span style="color:red">//topic to get crud and command observations</span>                           
+
"dap":{
+
        "crudCommandUrl" :"/xx/xx/"
+
    }
+
*Things instance creation:
+
*Using amtech creator experience
+
*Configuring autoDiscover entry at bridgeConfig.json
+
  <span style="color:red">//auto discover configuration</span>
+
        "autoDiscover":{
+
            <span style="color:red">//create things type instances at startup time</span>
+
            "execute" : false,                       
+
            <span style="color:red">//Jsonld instances of the thing to be created </span>
+
          "SNMPDevice":[
+
                {
+
                    "setOIDs": "[{\"oid\":\".1.3.6.1.2.1.1.6.0\", \"type\":\"OctetString\", \"value\":\"Irvine California\"}]",
+
                    "_lastmodified": 1450988442414,
+
                    "guestusers": [],
+
                    "@type": "/amtech/linkeddata/types/composite/entity/SNMPDevice",
+
                    "_resourcestatus": "valid",
+
                    "_name": "snmpClientM2mBridge",
+
                    "getOIDs": "[{\"name\":\"memoryTotal\", \"oid\":\".1.3.6.1.4.1.2021.4.5.0\"},  {\"name\":\"memoryAvailable\", \"oid\":\".1.3.6.1.4.1.2021.4.6.0\"}]",
+
                    "ipaddress": "localhost",
+
                    "communityString": "private",
+
                    "emaillist": "",
+
                    "instanceobservationconfig": "{}",
+
                    "creationDate": "2015-12-24T20:20:42.407Z",
+
                    "readFrequency": "PT10M",
+
                    "guesttenants": [
+
                        "follower_m2mcreator@@amtech.mx"
+
                    ],
+
                    "description": "An SNMPDevice instance acting as SNMP manager/client proxying snmp commands (get/set/trups) to manager a ubuntu box hosting m2mbridge",
+
                    "phonelist": "",
+
                    "@id": "/amtech/things/entities/snmpClientM2mBridge",
+
                    "snmpVersion": "2c",
+
                    "_user": "m2mcreator@amtech.mx"
+
                }
+
            ], …}
+
 
+
== Plugins architecture ==
+
 
+
== How to implement a new plugin ==
+
*Clone git repository (https://github.com/AMTechMX/M2MBridge.git)
+
**at /.../M2MBridge/plugins create a directory that matched with the Thing type name to bridge example SNMPDevice
+
*Implement a nodejs module with the following interface
+
<quote>
+
function SNMPDevice() {
+
}
+
SNMPDevice.prototype.start = function ( context, complete) {
+
    try {
+
        complete(null);
+
    } catch (e) {
+
        complete(e);
+
    }
+
};
+
SNMPDevice.prototype.stop = function (complete) {
+
    try {
+
        complete(null);
+
    } catch (e) {
+
        complete(e);
+
    }
+
};
+
SNMPDevice.prototype.command = function (observation, complete) {
+
    try {
+
        complete(null);
+
    } catch (e) {
+
        complete(e);
+
    }
+
};
+
module.exports.SNMPDevice = SNMPDevice;
+
</quote>
+
 
+
== How to install it ==
+
*Clone git repository (https://github.com/AMTechMX/M2MBridge.git)
+
*Install nodejs https://nodejs.org/en/download/package-manager/
+
*Install npm (http://blog.npmjs.org/post/85484771375/how-to-install-npm)
+
*Delete at /.../M2MBridge/plugins/xxx unneeded plug-ins
+
*Install packages for m2mBridge core and plug-ins (https://docs.npmjs.com/cli/install:)
+
*Execute npm install at:
+
**M2MBridge directory
+
**each plug-in directory
+
 
+
== Existing plugins ==
+
 
+
=== LLRP ===
+
 
+
=== Bluetooth ===
+

Latest revision as of 11:16, 14 January 2019

AmtechM2mBridge.svg M2MBridge is a software stack that implements M2M edge functionality leveraging AMTech IoT Protocol

  1. Functionality
  2. Configuration example
  3. M2MBridge network
    Aggregation
    Edge reasoners
    Mesh network
  4. Intelligence at the Edge
    What is a plugin?
    EPC (Electronic product code)
    Smoothing observations
  5. Observations production and consumption
  6. Cloud Configuration
    Observation production config
    Validation
    Sample configuration for beacons
  7. Automatic updates on bridge instance delete
  8. Implementation notes
  9. How to implement a new plugin
  10. Set up a new Raspberry PI
  11. M2MBridge Edge Configuration
  12. M2MBridge updates
  13. How to install & execute
  14. HelloWorld plugin
  15. Supported plugins
    1. Wi-fi.svg Tcp-ip.svg Wifi or RJ45 Ethernet
      SNMPDevice.svg SNMPDevice
      LLRPReader.svg LLRPReader
      LLRPAntenna.svg LLRPAntenna
      Thing-magic.svg ThingMagicEPCReader
      LLRPAntenna.svg LLRPAntenna
      Plc-icon.svg OPCUADevice
      Modbus.svg ModbusDevice
      WioGeneric.png Wio Devices (troubleshooting inside)
      WioNode.svg.svg wioNode
      WioLink.svg wioLink
    2. Bt.svg BLE 4.0
      BLEbeaconsScanner.svg BLEbeaconsScanner
      BleOBDScanner.svg BLEODB2Scanner
      BLEPeripheralsScanner.svg BLEPeripheralsScanner
      BluvisioniBEEK.jpg BLEBluvisionBeeksScanner
      BLEGattCentral.svg BLEGattCentral
    3. I2c.svg I2C
      Watersensor.svg PCA9536I2CWaterDetectionWithBuzzer
      TSL2561Light.svg TSL2561I2CLight
      Soundvibration.svg ADC121C021I2CSoundVibrationShock
      Ncd-i2c.png NCD I2C devices
      Grove-log.png Grove devices via I2C
    4. Usb-logo.svg USB 2.0
      Thing-magic.svg ThingMagicEPCReader
      LLRPAntenna.svg LLRPAntenna
      Phidgets-Logo.png Phidgets USB sensors
    5. Xbee-pro-900hp.svg XBee-Pro 900HP
      Relay-home-automation.svg NCDXbee900Relay
      Energy-monitor.svg NCDXbee900EnergyMonitor
      Ncd-i2c.png NCD devices supporting XBee-Pro 900HP communication
      Libelium.svg Libelium waspmote
      SmartEnvironment.jpg Smart environment PRO
      SmartAgriculture.png Smart Agriculture
      SmartWater.jpg Smart Water
      SmartWaterIons.png Smart Water Ions
      SmartCities.jpg Smart Cities
      SmartParking.jpg Smart Parking
      SmartSecurity.jpg Smart Security
      Radiation.png Radiation
      AmbientControl.png Ambient Control