Beruflich Dokumente
Kultur Dokumente
IoTivity
Networking
Copyright 2000-2015 Laboratory
Networking 1/00
Laboratory
Current issues
Incompatibility of platforms: Manufacturers are providing a large number
of IoT devices. Those devices could be based on Linux, Android,
Adruino, iOS, etc. To let them work together requires a hub/controller to
interpret (or translate) the data, commands.
http://iot-datamodels.blogspot.kr/
IoTivity demo Networking Laboratory 6/37
More about CoAP
Most IoT systems use UDP. However, since UDP is neither stable nor
reliable, it needs to combine with another application protocol to
improve the stability
Client
Client configuration
Functions for PUT/GET/POST/OBSERVE and its callbacks
Constructor
On finishing the task, the library function trigger the associated callback
at the same tier with the call
Each device processes the query and responds if it satisfies the request
filter
myClient myServer
Register resource
findResource()
OCResource
foundResource()
get()
GET
OCRepresentation onGetCallback()
FindResource s Callback
Process onGetCallback
if (requestType == "GET") {
std::cout << "\tReceived GET request\n";
pResponse->setResourceRepresentation(lightResource::get());
if(OC_STACK_OK == OC::OCPlatform::sendResponse(pResponse)) {
ehResult = OC_EH_OK;
}
}
myput myServer
put()
entityHandler
(requestType == PUT)
OCResource onPUTCallback()
get()
GET
OCRepresentation onGetCallback()
findResource()
put() and Observe()
- entityHandler(requestType == PUT)
- notifyObserver()
void onGetCallback(const HeaderOptions& hO, const OCRepresentation& rep, const int eCode){
if (eCode == OC_STACK_OK){
myQuery myQuery
Client Server
get()
l_rep.setEnergy("energyLevel", l_energy);
Client:
Ocrepresentation.getValueToString(energyLevel)
if (requestType == "PUT") {
recvmsg = request->getResourceRepresentation();
if (recvmsg.getValueToString("mode") == "aggregation") {
//do something here
}
}
Things-manager
Extra example
Networking
Copyright 2000-2015 Laboratory
Networking 33/00
Laboratory
Guideline link
Follow this link:
https://wiki.iotivity.org/getting_started_iotivity_services_for_android_0_9
_1
Path for android SDK:
Iotivity/extlibs/android/sdk/android-sdk/
Path for android NDK:
Iotivity/extlibs/android/ndk/android-ndk/
Link for installing android plugin for eclipse:
https://dl-ssl.google.com/android/eclipse/