The following examples show you how to test specific situations; you can combine these custom objects with actions in a rule, to take appropriate action:
Detecting a Recurring Alarm -- In this Alarm Rule example, when an alarm arrives, the Platform checks if the alarm has occurred more than two times in the last five hours. Requires the Axeda® Connected Product Management Applications SDK.
Converting Temperature Values -- In this Action example, an incoming temperature value is in degrees Fahrenheit. The custom object converts this value into degrees Celsius and writes the new value back to the Platform. Requires the Axeda® Connected Product Management Applications SDK.
Searching Event Messages -- In this example, the incoming event message is searched for a specific substring. If the string is found, the custom object returns True.
The following example shows you how to use the Axeda® Connected Product Management Applications SDK to create an Action and then use the two custom objects in a custom action and custom rule: Custom Object Example: Creating a custom rule with two of the example custom objects
For examples of custom objects you may want to use with Axeda IDM Agents, refer to the topic, Custom Object Examples - IDM Agent. For an example of using the IDM Agent WS Extension type of custom object, refer to Example Custom Object of Type IDM Web Service Extension. For an example of using a custom object to create a property called Communication Mode and set its value for an IDM Agent, refer to Custom Object Example: Creating a Communication Mode Property for IDM Agents.
For an example of using a custom object as the Transport for the Shoulder Tap Delivery method, refer to Custom Object Example: Transport for Shoulder Tap Delivery Method.
By default, the Platform passes two parameters to all custom objects or custom applications defined in Extended UI Modules: “assetId” (to identify the related asset) and “extModuleId” (to identify this extended UI module).
If creating a custom object for display in an Extended UI Module (Extended UI Module type), you MUST specify the assetId parameter and configure that parameter for access. The following shows an example of a custom object configured to retrieve the assetID for the related asset (from the Asset dashboard):
import com.axeda.drm.sdk.*;
import com.axeda.drm.sdk.user.*;
StringBuilder builder = new StringBuilder();
builder.append('<html>')
builder.append('<body>')
builder.append('<a href="http://www.axeda.com" target="_blank">Visit Axeda</a>')
builder.append(parameters.get("assetId"));
builder.append('</body>')
builder.append('</html>')
return ['Content-Type': 'text/html', 'Content': builder.toString()]
Important: If you want to show a custom object in an Extended UI Module, the object MUST return actual, viewable content. If the custom object is not defined to render displayable data, the Extended UI Module will NOT be shown in the related Asset dashboards. In conjunction, if the selected object is deleted from the system or is NOT available to the logged in user, any Extended UI Module defined for that custom object is not shown in the related Asset dashboards.
The following example shows how you can send an email through the API: Custom Object Example: sending email through API
The following example shows how you can upload a file through the API: Custom Object Example: sending email through API
The following examples show you how to use the logger object with each type of custom object to write information to a log: