Sometimes M2M Assets should poll the platform on demand, such as in the case of avoiding excessive data charges from chatty assets. A mechanism was developed that instructs the Asset to contact (poll) the platform for actions that the Asset needs to act on such as File Uploads, Set DataItem, etc.
The Shoulder Tap SMS message is the platform’s way of contacting the Asset – tapping it on the shoulder to let it know there’s a message waiting for it. The Asset responds by polling for the waiting message. This implementation in the platform provides a way to configure the Model Profile that is responsible for sending an SMS Shoulder Tap message to an M2M Asset. The Model Profile contains model-wide instructions for how and when a Shoulder Tap message should be sent.
How does it work?
The M2M asset is set not to poll the Axeda Platform for a long period, but the Enterprise user has some actions that the Asset needs to act upon such as FOTA (Firmware Over-the-Air).
- Software package deployed to M2M Asset from Axeda Platform and put into Egress queue.
- The Shoulder Tap mechanism executes a Custom Object that then sends a message to the Asset through a delivery method like SMS, UDP, etc.
- The Asset’s SMS, etc. handler receives the message and the Asset then sends a POLL to the Platform and acts upon the action in the egress queue
How do you make Shoulder Tap work for your M2M Assets?
- The first step is to create a Model Profile, the model profile will tell Asset of this model, how to communicate. For Example, if the Model Profile is Shoulder Tap, then the mechanism used to communicate to the Asset will imply Shoulder Tap. Execute the attached custom object, createSMSModelProfile.groovy, and it will create a Model Profile named "SMSModelProfile".
- When you create a new Model, you will see “SMSModelProfile“ appear in the Communication Profile dropdown list as follows:
- The next step is to create the Custom Object Transport script which is responsible for sending out the SMS or other method of communication to the Asset. In this example the custom object is be named SMSCustomObject. The contents of this custom object are outside the scope of this article, but could be REST API calls to Twilio, Jasper or to a wireless provider's REST APIs to communicate with the remote device using an SMS message. This could also be used with the IntegrationPublisher API to send a JMS message to a server the customer controls which could then be used to talk directly with custom libraries that are not directly compatible with the Axeda Platform.
- Once the Shoulder Tap scripting has been tested and is working correctly, you can now directly send a Shoulder Tap to the Asset from an action or through an ExtendedUI Module, such as shown below:
import com.axeda.platform.sdk.v1.services.ServiceFactory; final ServiceFactory sFact = new ServiceFactory() def assetId = (Long)parameters.get("assetId") def stapService = ServiceFactory.getShoulderTapService() stapService.sendShoulderTap( assetId )
See Extending the Axeda Platform UI - Custom Tabs and Modules for more about creating and configuring Extended UI Modules.
What about Retries?
- maxRetryCount - This built in attribute’s value defines the number of times the platform will retry to send the Shoulder Tap message before it gives up.
- retryInterval -The retry interval that can be used if the any message delivery needs to be retried.
Retry Count and Interval are configured in the Model Profile Custom Object like so:
final DeliveryMethodDescriptor dmd = new DeliveryMethodDescriptor();