7.2.1 Clothes Washing Machine APIs using oneM2M
Because the resource tree structure for each of the models is different the oneM2M primitives needed to access the services of the clothes washing machine will also be different. However, the goal for interworking device models is to allow a user to issue the same command to perform an operation regardless of which model is used. This can be approximated in a dynamic manner using the oneM2M base ontology to describe each of the services offered by the device and the resources that provide access to those services. For example, the washing machine that we have described offers the following operations:
- TURN ON WASHING MACHINE
- TURN OFF WASHING MACHINE
- TOGGLE THE WASHING MACHINE STATUS
- GET STATUS OF WASHING MACHINE
The oneM2M primitives to execute these operations are dependent on the resource tree structure used to model the washing machine. For example, to determine the status of the washing machine for each model the following oneM2M requests and responses are used:
Model | Request | Response |
---|---|---|
SDT | RETRIEVE /cseBaseName/IPE_ROOT/deviceclothesWasher/runState | { " currentMachineState ": 3 "machineStates": [1,3,5,6] "currentJobState": 6 "jobStates":[2,3,4,5,6] "progressPercentage":95.0 } |
SAREF | RETRIEVE /cseBaseName/IPE_ROOT/My-WashingMachine/sarefWashingMachine/MonitorService | { "WashingMachineStatus":WASHING } |
Custom | RETRIEVE /cseBaseName/IPE_ROOT/myWashingMachine/Status/la | { "WashingMachineStatus":WASHING } |
Similarly, to command the washing machine to STOP the following oneM2M primitives are sent:
Model | Request |
---|---|
SDT | UPDATE /cseBaseName/IPE_ROOT/deviceClothesWasher/binarySwitch {"state": False } |
SAREF | UPDATE /cseBaseName/IPE_ROOT/My-WashingMachine/SwitchOnService {"BinaryInput": False} |
Custom | CREATE /cseBaseName/IPE_ROOT/myWashingMachine/Command {"OFF"} |