A very simple M3DA TCP server. M3DA is a secure and bandwith efficient M2M protocol.
The specification : http://wiki.eclipse.org/Mihini/M3DA_Specification
The embedded client : http://www.eclipse.org/mihini
It's licensed under the term of the Eclipse Public License - v 1.0. See the LICENSE-EPLv1.0.html at the root of the repository.
Compile all the project
mvn install
With maven generate a runnable uber jar using the command :
cd server
mvn assembly:assembly -DdescriptorId=jar-with-dependencies
start it using the command
java -jar target/m3da-server-1.0-SNAPSHOT-jar-with-dependencies.jar
You can start connecting your M3DA client on the TCP port 44900 (IANA official port for M3DA).
You can see all the received data for a given client by GETing the URL : http://127.0.0.1:8080/clients/{client-identifier}/data
The client identifier is the value of "agent.config.agent.deviceId" in your mihini installation.
Examples:
RESULT:
{
"@sys.foo.Timestamp":[
{
"timestamp":"246977562322",
"value":[
1361975530
]
}
],
"@sys.foo.bar":[
{
"timestamp":"246977562322",
"value":[
123
]
}
]
}
You can push data to a given client by POSTing to the following URL : http://127.0.0.1:8080/clients/{client-identifier}/data
The client identifier is the value of "agent.config.agent.deviceId" in your mihini installation.
Examples:
Content:
{
"settings" : [{
"key" : "@sys.commands.ReadNode.key1",
"value" : "key1value"
}, {
"key" : "@sys.commands.ReadNode.key2",
"value" : "key2value"
}]
}
You can get the list of connect client by GETing the URL : http://127.0.0.1:8080/clients . You'll received the list of "in" clients (those that sent data) and "out" clients (those for which data is waiting to be pushed on the server.)
Example:
RESULT:
{
"in" : ["12131", "client1", "foobar"],
"out" : ["12131", "other-client"]
}
You can enable secure communication with your client. the client and the server will share a password for ciphering and authenticating communitions. Like TLS/SSL but is a more bandwidth friendly way (see the M3DA security specification : http://wiki.eclipse.org/Mihini/M3DA_Specification ).
Setup security :
Post the security information on http://127.0.0.1:8080/clients/{client-identifier}/security
The client identifier is the value of "agent.config.agent.deviceId" in your mihini installation.
Examples:
Content:
{
"authentication" : "HMAC_SHA1",
"encryption" : "AES_CTR_256",
"password" : "mySecurePassword$$$$"
}
The different authentication schemes are: NONE, HMAC_MD5, HMAC_SHA1
The different encryption shcemes are: NONE, AES_CTR_128, AES_CTR_256, AES_CBC_128, AES_CBC_256
The different used algorithm are explicited in the M3DA security specification.