git clone https://@opensourceprojects.eu/git/p/c2net/dcf/iot-hub/iot-hub-2/code c2net-dcf-iot-hub-iot-hub-2-code



File Date Author Commit
Resources 2017-01-04 pedro pedro [faad81] cleaned main directory
site-c2net-raspberry 2017-01-05 pedro pedro [ad9834] readme draft 8
src 2017-01-05 psimoes psimoes [9cefea] Communication made
.gitignore 2016-09-27 psimoes psimoes [2b9685] ignore hidden files as well
README.md 2017-01-05 pedro pedro [231924] draft readme 6
pom.xml 2016-11-07 pedro pedro [c2e9d2] added pub/sub features for dataposter. Also ala...
setEnv.sh 2017-01-04 pedro pedro [55208c] socket implementation and ip adaptivity done

Read Me

IoT Hub - UNINOVA

Table of contents

Hardware Requirements

Minimum specs

  • CPU speed 700MHz
  • RAM 512MB
  • ROM 8G

Initial Notes

The IoT Hub can be used under any Linux distro but the SETUP installers where written to an Debian based system. So if you use other distro, please see the prerequisites under "How to install System"

Description

The IoT Hub is composed five packages described bellow:

  • Communication => DataPoster provides outputschema communication (collected values) between the IoT Hub and C2NeT RM component using SocketIOConnector. SocketIOListener provides communication between C2NeT RM component and IoT Hub regarding the sensors configuration.

  • Controller => DeviceManagement is responsible for init communication Sockets, start the implemented DataListenersChannels defined in configs.xml file, start sensor data collection as provided by the C2NeT RM component. FileChangeWatcher handles I/0 to config files

  • DataListener => DataListenersChannels for the following protocols: Zigbee, Wifi, Serial, Can-Bus

  • Models => models to directly manage the data, logic, and rules of the application

  • Utils => useful objects that don't fit any of the above categories

How install System

Before starting up the system, in order to run correctly, the IoT Hub needs to have dependencies installed as well as some initial configuration files.

To create the configuration files (which will be empty until RM provides proper configuration):

 execute the file_config.sh with super user privileges.

To install dependencies:

 execute install.sh with super user privileges

In case install.sh fails for some reason, install the following prerequisites:

Java8, Maven, Rxtx, Xbee and Git

and then on the project directory do:

 sudo mvn clean package

Important Note: if your hub is installed in an Minimum Hardware Requirents enviroment, we strongly recommend you to compile the project outside of the hub and then transfer the generated jar to your hub. the jar should be placed inside target directory in the project main folder.

How start the system:

go to /opt/c2net-iot-hub/Resources/configs.xml . verifify that at least one of the CommunicationListner is present.

 run setEnv.sh as superuser.

Rm received configuration message:

the defined message for configuring hub and it's sensors follows the structure below:

{
        "id": "",
        "name": "",
        "instanceOf": "",
        "subsystemOf": "",
        "status": "",
        "virtual": "",
        "properties": [],
        "resources": [{
            "id": "",
            "name": "",
            "instanceOf": "",
            "subsystemOf": "",
            "status": "",
            "virtual": "",
            "properties": []
        }]
}

The first set of properties is dedicated to identify the properties of the Hub in the Resource Manager. Some of this properties are internal of the Resource Manager, like id, instanceOf, etc... while others have some user interaction (through the RM User Interface). In this manner, and in the scope of the Hubs properties, there are some requirements that the resultant configuration have to match coming from the RM. Inside the "properties" array, it is compulsory the definition of a property called "HubID" (which will be use to implement the communication between Hubs and Pub/Sub at Pub/Sub). Below there is an example of this property definition:

{
        "id": "",
        "name": "",
        "instanceOf": "",
        "subsystemOf": "",
        "status": "",
        "virtual": "",
        "properties":[
            {
                "name"="topicID",
                "type"="string",
                "value"="${HUB MAC ADDRESS}"
            }
        ],
        "resources": [{
            "id":"",
            "name":"",
            "instanceOf":"",
            "subsystemOf":"",
            "status":"",
            "virtual":"",
            "properties":[]
        }]
}

To implement the output schema it is mandatory to include a property called "outputSchema" at "resources" level property where the output schema of the data generated by the Hub is reprensented. See an example below showing a possible output schema coming from an IoT Hub:

 {
        "id":"",
        "name":"",
        "instanceOf":"",
        "subsystemOf":"",
        "status":"",
        "virtual":"",
        "properties":[],
        "resources":[{
            "id": "",
            "name": "",
            "instanceOf": "",
            "subsystemOf": "",
            "status": "",
            "virtual": "",
            "properties":[
                {
                        "name"="outputSchema",
                        "type"="JSON",
                        "value"="[
                            {
                            'name'='${resource_property_name}',
                            'type'='${resource_property_type}',
                            'time'='${resource_property_time}'
                            }
                         ]"
                }
            ]
        }]
}

The resource property time is optional (if not present, it will use a default time of 1 minute). Name and Type are mandatory.