Home Reference Source Repository
public class | source

SkygearIoT

Skygear IoT container

Constructor Summary

Public Constructor
public

constructor(skygear: SkygearContainer)

Member Summary

Public Members
public get

console: Console

A javascript console that outputs to the skygear server.

public get

Device-specific data

Method Summary

Public Methods
public

async initDevice(platform: Object): Promise

Binds SDK with provided platform, setup event handlers.

public

reportStatus(payloadOverride: Object): Promise

Reports device status to the skygear server.

Public Constructors

public constructor(skygear: SkygearContainer) source

Params:

NameTypeAttributeDescription
skygear SkygearContainer

Public Members

public get console: Console source

A javascript console that outputs to the skygear server.

public get device: Object source

Device-specific data

Properties:

NameTypeAttributeDescription
device.id string
device.platform Object

See initialize method.

device.loginID string
device.pubsubChannel string

PubSub channel name for this device.

Public Methods

public async initDevice(platform: Object): Promise source

Binds SDK with provided platform, setup event handlers. Register this device with the current user if not registered

Note: This function must be called AFTER logging into skygear and you MUST ensure that the current user is not already registered with another device.

Params:

NameTypeAttributeDescription
platform Object
platform.action Object

Object containing platform specific actions, all actions are optional.

platform.action.* async function
platform.deviceSecret string

A string that is unique to the hardware, could be SoC model + serial number.

platform.appVersion string

Version string of the user application.

Return:

Promise

Resolves on complete, reject on error.

public reportStatus(payloadOverride: Object): Promise source

Reports device status to the skygear server. This function is called automatically as requested by the server.

Params:

NameTypeAttributeDescription
payloadOverride Object
  • optional

Override fields in the default payload

payloadOverride.status string
  • optional

Device status

payloadOverride.metadata Object
  • optional

Additional status metadata

Return:

Promise