Messages
Classes
- AbstractValidator
Class to preform the action of checking data in the form of an object against a struct
- ApiEventMsg ⇐
AbstractValidator Validates the apiEventMsg
- DeviceAckMsg ⇐
AbstractValidator Validates the deviceAckMsg
- DeviceDataEventMsg ⇐
AbstractValidator Validates a DeviceDataEventMsg
- DeviceEventAckMsg ⇐
AbstractValidator Validates a DeviceEventAckMsg
- InboundAckMsg ⇐
AbstractValidator Validates an InboundAckMsg
- InboundDataEventMsg ⇐
AbstractValidator Validates an inboundDataEventMsg
- IotHubEventMsg ⇐
AbstractValidator Validates an iothubEventMsg
- OutboundInitMsg ⇐
AbstractValidator Validates the outboundInitMsg
- OutboundSentMsg ⇐
AbstractValidator Validates the outboundSentMsg
- EmailMsg ⇐
AbstractValidator Validates an EmailMsg
- SmsMsg ⇐
AbstractValidator Validates a SmsMsg
- SolarTimer
Defines a Solar Timer. A solar timer will fire based off of an offset from either sunrise or sunset.
- AttributeCondition ⇐
Condition - Condition ⇐
AbstractValidator Defines a condition that can be tested for, yielding either true or false
- DeltaCondition ⇐
Condition - NotCondition ⇐
Condition - NotCondition ⇐
Condition
Functions
- parse()
Attempts to turn time into a milliseconds time. If it cannot, it will return dTime, which defaults to Date.now()
AbstractValidator
Class to preform the action of checking data in the form of an object against a struct
Kind: global class
new AbstractValidator(struct, data)
class that will check an object against a struct and add all the keys to itself
| Param | Type | Description |
|---|---|---|
| struct | Struct | a function returned by creating a struct with superstruct |
| data | object | an object that will be checked against the provided struct |
abstractValidator.toObject ⇒ object
Kind: instance property of AbstractValidator
Returns: object - - the validated object of the data originally provided
ApiEventMsg ⇐ AbstractValidator
Validates the apiEventMsg
Kind: global class
Extends: AbstractValidator
- ApiEventMsg ⇐
AbstractValidator- new ApiEventMsg()
- .toObject ⇒
object
new ApiEventMsg()
create a ApiEventMsg
| Param | Type | Description |
|---|---|---|
| data.eventType | string | the number type of the event from the spec |
| data.deviceId | string | A string representing the internal name of the device. |
| data.systemId | string | The name of the system the device belongs to |
| data.blueprintId | string | the id of the blueprint that the device belongs to |
| data.projectId | string | the id of the project that the device belongs to |
| data.attributeId | string | the id of the attribute affected |
| data.networkId | string | The networkId of the source |
| data.userId | string | the string user id of the event source |
| data.route | string | the string route taken into the data to create the event |
| data.fromModelInterface | string | whether or not the event was generated by calls to the model interface |
apiEventMsg.toObject ⇒ object
Kind: instance property of ApiEventMsg
Returns: object - - the validated object of the data originally provided
DeviceAckMsg ⇐ AbstractValidator
Validates the deviceAckMsg
Kind: global class
Extends: AbstractValidator
- DeviceAckMsg ⇐
AbstractValidator- new DeviceAckMsg()
- .toObject ⇒
object
new DeviceAckMsg()
create a DeviceAckMsg
| Param | Type | Description | |
|---|---|---|---|
| data.time | string \ | integer | the time of the message, as reported by the device |
| data.receivedTime | string \ | integer | the time of the message, as reported by the ingestion server |
| data.time | string \ | integer | the time of the message, as reported by the device |
| data.msgId | string | The message id, created at outbound initiated step | |
| data.deviceId | string | A string representing the internal name of the device. | |
| data.systemId | string | The name of the system the device belongs to | |
| data.networkId | string | The networkId of the source | |
| data.blueprintId | string | the id of the blueprint that the device belongs to | |
| data.projectId | string | the id of the project that the device belongs to | |
| data.status | string | final updated string status of the message | |
| data.response | object | This contains the response data from the device | |
| data.source | object | this contains the device, (or less likely) the user, or reason script source info of the inboundAckMsg this derived from |
deviceAckMsg.toObject ⇒ object
Kind: instance property of DeviceAckMsg
Returns: object - - the validated object of the data originally provided
DeviceDataEventMsg ⇐ AbstractValidator
Validates a DeviceDataEventMsg
Kind: global class
Extends: AbstractValidator
new DeviceDataEventMsg()
create the DeviceDataEventMsg class
| Param | Type | Description | |
|---|---|---|---|
| data.id | string | A uuid generated for this message | |
| data.time | string \ | integer | the time of the message, as reported by the device |
| data.receivedTime | string \ | integer | the time of the message, as reported by the ingestion server |
| data.storedTime | string \ | integer | the time of the message, as reported by the writer |
| data.historical | boolean | whether or not the message is known to be historical only (don't write to rt dbs) | |
| data.deviceId | string | A string representing the internal name of the device. | |
| data.systemId | string | The name of the system the device belongs to | |
| data.blueprintId | string | The id of the blueprint the device belongs to | |
| data.projectId | string | The id of the project the device belongs to | |
| data.networkId | string | The networkId of the source | |
| data.data | array \ | object | This contains a data report. The data report as a path, which is the name of the data field, and a value. The path should only contain a-z, A-Z, 0-9, _. Forward slashes (‘/’) are treated as directories |
| data.data.path | string | A string of keys, separated by a ‘/’. For examples, ‘speed’, or ‘battery/temperature1” | |
| data.data.value | number | the value of the path | |
| data.event | array \ | object | This contains an event report. The event indicates that something significant has happened. |
| data.event.type | string | The list that the event should be inserted into. If not supplied, this will default to ‘default’ | |
| data.event.time | string \ | number | Optional. Server time will be used |
| device.event.id | string | reserved | |
| data.source | object | this contains the device, user, or reason script source info of the object that created this msg | |
| data.userId | object | the userId (if any) that initiated the writing of information |
deviceDataEventMsg.toObject ⇒ object
Kind: instance property of DeviceDataEventMsg
Returns: object - - the validated object of the data originally provided
DeviceEventAckMsg ⇐ AbstractValidator
Validates a DeviceEventAckMsg
Kind: global class
Extends: AbstractValidator
new DeviceEventAckMsg()
create the DeviceEventAckMsg class
| Param | Type | Description | |
|---|---|---|---|
| data.id | string | the id of the event being acked | |
| data.time | string \ | integer | the time of the message, as reported by the device |
| data.receivedTime | string \ | integer | the time of the message, as reported by the ingestion server |
| data.storedTime | string \ | integer | the time of the message, as reported by the writer |
| data.deviceId | string | A string representing the internal name of the device. | |
| data.systemId | string | The name of the system the device belongs to | |
| data.blueprintId | string | The id of the blueprint the device belongs to | |
| data.projectId | string | The id of the project the device belongs to | |
| data.data | array \ | object | This contains a data report. The data report as a path, which is the name of the data field, and a value. The path should only contain a-z, A-Z, 0-9, _. Forward slashes (‘/’) are treated as directories |
| data.data.path | string | A string of keys, separated by a ‘/’. For examples, ‘speed’, or ‘battery/temperature1” | |
| data.data.value | number | the value of the path | |
| data.eventType | string | the type of the event being acked by id | |
| data.userId | string | the user (if any) that is acking the message | |
| data.source | string | the source info of the device, user, or reason script (if any) that is acking the event |
deviceEventAckMsg.toObject ⇒ object
Kind: instance property of DeviceEventAckMsg
Returns: object - - the validated object of the data originally provided
InboundAckMsg ⇐ AbstractValidator
Validates an InboundAckMsg
Kind: global class
Extends: AbstractValidator
new InboundAckMsg()
create a InboundAckMsg
| Param | Type | Description | |
|---|---|---|---|
| data.time | string \ | integer | the time of the message, as reported by the device |
| data.receivedTime | string \ | integer | the time of the message, as reported by the ingestion server |
| data.storedTime | string \ | integer | the time of the message, as reported by the writer |
| data.msgId | string | The message id, created at outbound initiated step | |
| data.networkId | string | The id of network contributing the acknowledgement | |
| data.deviceId | string | A string representing the external name of the device. This could be an IotHub device id, a MAC address of a sensor, etc | |
| data.systemId | string | the id of the system the device belongs to | |
| data.aliasKey | string | The name of the key that forms the mapping between the external device’s id and the internal device. This is stored in the internal device’s aliases list, and tends to be unique per network. | |
| data.status | string | an updated string status of the message | |
| data.response | object | This contains the response data from the device |
inboundAckMsg.toObject ⇒ object
Kind: instance property of InboundAckMsg
Returns: object - - the validated object of the data originally provided
InboundDataEventMsg ⇐ AbstractValidator
Validates an inboundDataEventMsg
Kind: global class
Extends: AbstractValidator
new InboundDataEventMsg()
create an InboundDataEventMsg
| Param | Type | Description | |
|---|---|---|---|
| data.time | string \ | integer | the time of the message, as reported by the device |
| data.receivedTime | string \ | integer | the time of the message, as reported by the ingestion server |
| data.historical | boolean | whether or not the message is known to be historical only (don't write to rt dbs) | |
| data.networkId | string | The networkId of the source | |
| data.deviceId | string | A string representing the external name of the device. This could be an IotHub device id, a MAC address of a sensor, etc | |
| data.aliasKey | string | The name of the key that forms the mapping between the external device’s id and the internal device. This is stored in the internal device’s aliases list, and tends to be unique per network. | |
| data.data | array \ | object | This contains a data report. The data report as a path, which is the name of the data field, and a value. The path should only contain a-z, A-Z, 0-9, _. Forward slashes (‘/’) are treated as directories |
| data.data.path | string | A string of keys, separated by a ‘/’. For examples, ‘speed’, or ‘battery/temperature1” | |
| data.data.value | number | the value of the path | |
| data.event | array \ | object | This contains an event report. The event indicates that something significant has happened. |
| data.event.type | string | The list that the event should be inserted into. If not supplied, this will default to ‘default’ | |
| data.event.time | string \ | number | Optional. Server time will be used |
| data.event.id | string | reserved | |
| data.source | object | additional info about the source of the message pertaining to a generating user or reason script |
inboundDataEventMsg.toObject ⇒ object
Kind: instance property of InboundDataEventMsg
Returns: object - - the validated object of the data originally provided
IotHubEventMsg ⇐ AbstractValidator
Validates an iothubEventMsg
Kind: global class
Extends: AbstractValidator
new IotHubEventMsg()
| Param | Type | Description | |
|---|---|---|---|
| data.data | object \ | array | This contains a data report. The data report as a path, which is the name of the data field, and a value. Multiple reports can be sent at once by sending an array of the about objects. |
| data.data.path | string | A string of keys, separated by a ‘/’. For examples, ‘speed’, or ‘battery/temperature1” | |
| data.data.value | number | the value of the path | |
| data.event | object \ | array | This contains an event report. The event indicates that something significant has happened |
| data.event.type | string | The list that the event should be inserted into. If not supplied, this will default to ‘default’ | |
| data.event.time | string \ | number | Optional. Server time will be used |
| device.event.id | string | reserved |
iotHubEventMsg.toObject ⇒ object
Kind: instance property of IotHubEventMsg
Returns: object - - the validated object of the data originally provided
OutboundInitMsg ⇐ AbstractValidator
Validates the outboundInitMsg
Kind: global class
Extends: AbstractValidator
new OutboundInitMsg()
create a OutboundInitMsg
| Param | Type | Description | |
|---|---|---|---|
| data.time | string \ | integer | the time of the message, as reported by the device |
| data.receivedTime | string \ | integer | the time of the message, as reported by the ingestion server |
| data.msgId | string | The message id, created at outbound initiated step | |
| data.deviceId | string | A string representing the internal name of the device. | |
| data.systemId | string | The name of the system the device belongs to | |
| data.blueprintId | string | the id of the blueprint that the device belongs to | |
| data.projectId | string | the id of the project that the device belongs to | |
| data.message | object | This contains the message to go out to the device | |
| data.source | object | information about the device, (or less likely) the user, or reason script that generated this message |
outboundInitMsg.toObject ⇒ object
Kind: instance property of OutboundInitMsg
Returns: object - - the validated object of the data originally provided
OutboundSentMsg ⇐ AbstractValidator
Validates the outboundSentMsg
Kind: global class
Extends: AbstractValidator
new OutboundSentMsg()
create a OutboundSentMsg
| Param | Type | Description | |
|---|---|---|---|
| data.time | string \ | integer | the time of the message, as reported by the device |
| data.receivedTime | string \ | integer | the time of the message, as reported by the ingestion server |
| data.msgId | string | The message id, created at outbound initiated step | |
| data.deviceId | string | A string representing the internal name of the device. | |
| data.systemId | string | The name of the system the device belongs to | |
| data.blueprintId | string | the id of the blueprint that the device belongs to | |
| data.projectId | string | the id of the project that the device belongs to | |
| data.status | string | an updated string status of the device | |
| data.sendInfo | object | any information or notes about the data sent | |
| data.source | object | information about the device, (or less likely) the user, or reason script that generated this message |
outboundSentMsg.toObject ⇒ object
Kind: instance property of OutboundSentMsg
Returns: object - - the validated object of the data originally provided
EmailMsg ⇐ AbstractValidator
Validates an EmailMsg
Kind: global class
Extends: AbstractValidator
- EmailMsg ⇐
AbstractValidator- new EmailMsg()
- .toObject ⇒
object
new EmailMsg()
create an EmailMsg
| Param | Type | Description | |
|---|---|---|---|
| data.subject | string | the subject line of the email to be sent | |
| data.to | string \ | array | the email address/es to send the email to |
| data.cc | string \ | array | the email address/es to cc on the email |
| data.bcc | string \ | array | the email address/es to bcc on the email |
| data.from | string | the email address the email is to be sent from | |
| data.html | string | email content as html | |
| data.text | string | email content as plain text | |
| data.template | string | ||
| data.context | string | ||
| data.attachments | array | attachments to be included with the email |
emailMsg.toObject ⇒ object
Kind: instance property of EmailMsg
Returns: object - - the validated object of the data originally provided
SmsMsg ⇐ AbstractValidator
Validates a SmsMsg
Kind: global class
Extends: AbstractValidator
- SmsMsg ⇐
AbstractValidator- new SmsMsg()
- .toObject ⇒
object
new SmsMsg()
create a SmsProcessorMsg
| Param | Type | Description | |
|---|---|---|---|
| data.recipients | array \ | string | the phone number/s to send the message to |
| data.message | string | the text of the message that will be sent |
smsMsg.toObject ⇒ object
Kind: instance property of SmsMsg
Returns: object - - the validated object of the data originally provided
SolarTimer
Defines a Solar Timer. A solar timer will fire based off of an offset from either sunrise or sunset.
Kind: global class
new SolarTimer(data)
Create a Solar Timer
| Param | Type | Description |
|---|---|---|
| data | object | |
| data.latitude | number | the north/south position on the earth in degrees |
| data.longitude | number | the east/west position on the earth in degreews |
| data.fromSunrise | boolean | if true, the timer is based on sunrise. Otherwise, sunset is used |
| data.offset | number | the offset in milliseconds from sunrise or sunset |
solarTimer.next()
Returns the next time to fire from the current time. If when is set and it is less than fromTime, -1 is returned.
Kind: instance method of SolarTimer
AttributeCondition ⇐ Condition
Kind: global class
Extends: Condition
- AttributeCondition ⇐
Condition- .toObject ⇒
object - .satisfies(context)
- .toObject ⇒
attributeCondition.toObject ⇒ object
Kind: instance property of AttributeCondition
Returns: object - - the validated object of the data originally provided
attributeCondition.satisfies(context)
Determines whether the condition is met or not given the context
Kind: instance method of AttributeCondition
| Param | Type | Description |
|---|---|---|
| context | * | The context with which the satisfies method is to be executed |
Condition ⇐ AbstractValidator
Defines a condition that can be tested for, yielding either true or false
Kind: global class
Extends: AbstractValidator
condition.toObject ⇒ object
Kind: instance property of Condition
Returns: object - - the validated object of the data originally provided
DeltaCondition ⇐ Condition
Kind: global class
Extends: Condition
- DeltaCondition ⇐
Condition- .toObject ⇒
object - .satisfies(context)
- .toObject ⇒
deltaCondition.toObject ⇒ object
Kind: instance property of DeltaCondition
Returns: object - - the validated object of the data originally provided
deltaCondition.satisfies(context)
Determines whether the condition is met or not given the context
Kind: instance method of DeltaCondition
| Param | Type | Description |
|---|---|---|
| context | * | The context with which the satisfies method is to be executed |
NotCondition ⇐ Condition
Kind: global class
Extends: Condition
notCondition.toObject ⇒ object
Kind: instance property of NotCondition
Overrides: toObject
Returns: object - - the validated object of the data originally provided
notCondition.satisfies(context)
Determines whether the condition is met or not given the context
Kind: instance method of NotCondition
| Param | Type | Description |
|---|---|---|
| context | * | The context with which the satisfies method is to be executed |
notCondition.satisfies(context)
Determines whether the condition is met or not given the context
Kind: instance method of NotCondition
| Param | Type | Description |
|---|---|---|
| context | * | The context with which the satisfies method is to be executed |
NotCondition ⇐ Condition
Kind: global class
Extends: Condition
notCondition.toObject ⇒ object
Kind: instance property of NotCondition
Overrides: toObject
Returns: object - - the validated object of the data originally provided
notCondition.satisfies(context)
Determines whether the condition is met or not given the context
Kind: instance method of NotCondition
| Param | Type | Description |
|---|---|---|
| context | * | The context with which the satisfies method is to be executed |
notCondition.satisfies(context)
Determines whether the condition is met or not given the context
Kind: instance method of NotCondition
| Param | Type | Description |
|---|---|---|
| context | * | The context with which the satisfies method is to be executed |
parse()
Attempts to turn time into a milliseconds time. If it cannot, it will return dTime, which defaults to Date.now()
Kind: global function
