Utility libraries (com.altair.sc.utils)
Email class
Email class is a commodity class for sending emails from Altair SmartCore. Groovy or Java emails and communications in general will not work in Altair SmartCore SDK for security reasons.
Public properties:
Property name | Type | Default value | Comment |
---|---|---|---|
subject | String | "smartcore platform" | |
message | String | "" | |
to | String | "" | Semicolon (;) separated addressees |
cc | String | "" | Semicolon (;) separated carbon copy addressees |
bcc | String | "" | Semicolon (;) separated blind carbon copy addressees |
Public method:
send()Sends the email with the object properties
BasicHttp class
BasicHttp class is a commodity class for accessing external URLs from Altair SmartCore. Groovy or Java communications in general will not work in Altair SmartCore SDK for security reasons.
Public properties:
Property name | Type | Default value | Comment |
---|---|---|---|
url | String | "" | |
verb | String | "" | |
headers | java.util.Map | null | Key-value map |
params | java.util.Map | null | Key-value map |
payload | String | "" | |
http_auth | java.util.Map | null | Key-value map |
Public method:
send()Send the request (HTTP GET) to the URL specified and returns the text response from this request
Sms class
SMS class is a commodity class sending SMS from Altair SmartCore. Groovy or Java communications in general will not work in Altair SmartCore SDK for security reasons.
Public properties:
Property name | Type | Default value | Comment |
---|---|---|---|
to | String | "" | Comma (,) separated phone numbers. Phone numbers must a have the country prefix (ex: 0044) If no prefix is found, 0034 is assumed. Example: 0034123456789 |
message | String | "" | Message text, max 160 characters |
Public method:
send()Send the SMS to all the Phone numbers. Returns a response with sending results: send result | operation ID | phone numbers addressees. Example: OK|1F11FEADCB6A4|1
Twitter class
Twitter class is a commodity class sending tweet from Altair SmartCore. Groovy or Java communications in general will not work in Altair SmartCore SDK for security reasons.
Public properties:
Property name | Type | Default value | Comment |
---|---|---|---|
status | String | "" | Message text |
Public method:
send()Tweet your status
Sigfox class
Sigfox class is a commodity class for Sigfox integration with Altair SmartCore. It allows parsing incoming messages, processing them and return a response to be sent via downlink to the sigfox device.
Public properties:
Property name | Type | Default value | Comment |
---|---|---|---|
sigfox_login | String | "" | |
sigfox_password | String | "" | |
sigfox_devicetype_id | String | "" | |
smartcore_group | String | "" | Full Altair SmartCore group ID_developer |
Sigfox API credentials and ID can be gathered following this documentation.
Public methods:
Encode()Encode the response message into sigfox required format.
Decodes a sigfox incoming message into a string.
Pack method creates the response for a sigfox dowlink message.
batchProvision provisions into a Altair SmartCore group all devices on a sigfox device type.
In general, all Sigfox listeners will follow the next template.
MQTTPublisher class
MQTTPublisher class is a commodity class for publishing messages to a MQTT topic from Altair SmartCore.
Public constructors:
MQTTPublisher (int qualityOfService, String username, String password)Constructs a MQTTPublisher object with a default configuration. This is recommended to use mqttbroker.altairsmartcore.com.
A retained message is a normal MQTT message with the retained flag set to true. The broker stores the last retained message and the corresponding QoS for that topic. Each client that subscribes to a topic pattern that matches the topic of the retained message receives the retained message immediately after they subscribe. The broker stores only one retained message per topic.
Constructs a MQTTPublisher object assuming some configuration. This is recommended to use an external MQTT broker that admits TCP protocol as it is going to be connected using TCP.
A retained message is a normal MQTT message with the retained flag set to true. The broker stores the last retained message and the corresponding QoS for that topic. Each client that subscribes to a topic pattern that matches the topic of the retained message receives the retained message immediately after they subscribe. The broker stores only one retained message per topic.
Constructs a MQTTPublisher object with the full configuration set in the constructor. This is recommended to use an external MQTT broker with the SSL protocol. The certificate must be in one line, so carrier returns must be replaced with "n".
Public method:
publish (String topic, Object data)Publishes a message to a topic. The message can be any data structure (String, Number, Boolean, Map, Collection...). You can publish messages to different topics with the same MQTTPublisher object if the MQTT broker configuration is the same.
Below you can find an example with the "retained" parameter set to true:
Below you can find an example of how to eliminate the "retained" message: