Home Reference Source Repository
public class | source

SkygearIoT

You can directly use an instance of this class. skygearIoT

Constructor Summary

Public Constructor
public

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(metadata: Object): *

Reports device status to the skygear server.

Public Constructors

public constructor() source

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 if they do not apply to your platform.

platform.action.shutdown function
platform.action.restart 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(metadata: Object): * source

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

Params:

NameTypeAttributeDescription
metadata Object
  • optional

Metadata to be saved with the status record

Return:

*