Soracom Inventory
Custom Object Models
Many device resources are defined in the OMA LwM2M Object and Resource Registry. However, you can also define additional objects by using Custom Object Models.
Custom objects are defined in XML or JSON. The following custom object defines three resources:
- a CurrentX
read
resource at/0
which returns a float value. - a TargetY
read
andwrite
resource at/1
which contains a float value. - a Execute Command
execute
resource at/2
which executes a command.
<?xml version="1.0" encoding="UTF-8"?>
<LWM2M xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://openmobilealliance.org/tech/profiles/LWM2M.xsd">
<Object ObjectType="MODefinition">
<Name>Custom Model</Name>
<Description1>Custom model</Description1>
<ObjectID>30000</ObjectID>
<ObjectURN>urn:oma:lwm2m:oma:30000</ObjectURN>
<MultipleInstances>Single</MultipleInstances>
<Mandatory>Optional</Mandatory>
<Resources>
<Item ID="0">
<Name>CurrentX</Name>
<Operations>R</Operations>
<MultipleInstances>Single</MultipleInstances>
<Mandatory>Mandatory</Mandatory>
<Type>Float</Type>
<RangeEnumeration />
<Units>m</Units>
<Description>Current location in X.</Description>
</Item>
<Item ID="1">
<Name>TargetY</Name>
<Operations>RW</Operations>
<MultipleInstances>Single</MultipleInstances>
<Mandatory>Mandatory</Mandatory>
<Type>Float</Type>
<RangeEnumeration />
<Units>m</Units>
<Description>Target location in Y.</Description>
</Item>
<Item ID="2">
<Name>Execute Command</Name>
<Operations>E</Operations>
<MultipleInstances>Single</MultipleInstances>
<Mandatory>Mandatory</Mandatory>
<Type />
<RangeEnumeration />
<Units />
<Description>Execute command.</Description>
</Item>
</Resources>
<Description2 />
</Object>
</LWM2M>
When a custom object model definition is added to Soracom Inventory, its resources will be available to all managed devices. However, each device Agent must also be configured or include additional implementation to support the custom object.
Adding Custom Object Models
-
Login to the User Console. From the Menu, open the Object Models screen.
-
Click the Add object model button.
-
Enter the object model Schema, and ensure that the Format matches the definition format. Then click Save.
The object model will be listed in the Object Models list.
The resources for device whose agents have been configured for custom object model will automatically update, and you will be able to see the custom object model resources in the device details view: