Class org.bluemelon.bluesense.Master

Description

Central communication class to the BlueSense network.

Method Index

new Master()
addIPAddress(), clearDeviceTable(), onListDevice(), onListDeviceCount(), registerHandler(), requestDeviceTable(), start(), stop()

Constructor Detail

Master

function Master(ip)

This constructor will initiate a connection with the gateway to the BlueSense network.

Parameters

ipis optional and can be used to connect to a remote running gateway.

Method Detail

onListDeviceCount

function onListDeviceCount(count:Number)

This event shows the number of found devices in response to a requestDeviceTable call.

Parameters

countrepresents the number of found devices

onListDevice

function onListDevice(deviceId:Number, type:Number, typeName:String, version:Number)

This event will be called once for each found device in response to a requestDeviceTable call.

Parameters

deviceIdrepresents the unique identifier of the found device
typerepresents the hardware type of the device in decimal notation
typeNamegives the textual representation of the hardware type
versioncontains the firmware version of the device

start

function start(intervalMs:Number)

Use this method to tell the gateway how often to exchange data between the BlueSense network and Flash.

Parameters

intervalMssets the interval in milli seconds, the lower this value the more responsive the network.

stop

function stop()

This method stops the exchange of data, it will probably be to no use to anyone.

requestDeviceTable

function requestDeviceTable()

To request a list of currently connected devices call this method. A moment later the device count and a list of devices will be returned using the onListDevice event.

clearDeviceTable

function clearDeviceTable()

Before you request a device table you might want to clear it using this method. This allowes you to get a clean list without previously, but not anymore, connected devices.

registerHandler

function registerHandler(device:Object, deviceId:Number, representsType:Number)

Do not call this function directly, it used by the Device class

addIPAddress

function addIPAddress(ip:String, username:String, password:String)