#include <si_std/listt.h>
#include <si_sha/autodev.h>
#include <si_sha/autopkt.h>
Go to the source code of this file.
Classes | |
struct | sc_nameToName |
A struct that facilitates string to string mappings. More... | |
struct | sc_automationDeviceMgr |
Automation Device Manager. More... | |
Typedefs | |
typedef struct sc_lase | sc_lase |
Functions | |
sm_listDecl (sc_nameToName) | |
Macro declares sc_nameToNameList, a list of nameToName structs. | |
sc_status | sc_automationDeviceMgr_construct (sc_automationDeviceMgr *pom, sc_lase *jscx) |
sc_status | sc_automationDeviceMgr_destruct (sc_automationDeviceMgr *pom) |
sc_status | sc_automationDeviceMgr_getInstanceNameFromDeviceAddress (sc_automationDeviceMgr *pom, const TCHAR *deviceAddr, const TCHAR **instanceName) |
sc_status | sc_automationDeviceMgr_getClassFromDeviceType (sc_automationDeviceMgr *pom, const TCHAR *deviceType, const TCHAR **className) |
sc_status | sc_automationDeviceMgr_getInstanceFromDeviceAddress (sc_automationDeviceMgr *pom, const TCHAR *deviceAddr, const TCHAR **instanceName) |
sc_status | sc_automationDeviceMgr_createDevice (sc_automationDeviceMgr *pom, const TCHAR *bridgeName, sc_automationDevice *pd) |
sc_status | sc_automationDeviceMgr_relayMessage (sc_automationDeviceMgr *pom, const TCHAR *deviceAddress, sc_automationPacket *pkt) |
sc_status | sc_automationDeviceMgr_saveArchive (sc_automationDeviceMgr *pom, const TCHAR *ident, const TCHAR *archive) |
sc_status | sc_automationDeviceMgr_saveLink (sc_automationDeviceMgr *pom, const TCHAR *srcIdent, const TCHAR *srcEvent, const TCHAR *dstIdent, const TCHAR *dstMethd) |
sc_status | sc_automationDeviceMgr_clearLinks (sc_automationDeviceMgr *pom, const TCHAR *srcIdent) |
sc_status | sc_automationDeviceMgr_renameDevice (sc_automationDeviceMgr *pom, const TCHAR *curName, const TCHAR *newName) |
The Automation device manager keeps track of mappings between device addresses and instance identifiers in JavaScript. It also maps device types to JavaScript class names.
This important function serves several critical purposes in CASE, including:
sc_status sc_automationDeviceMgr_clearLinks | ( | sc_automationDeviceMgr * | pom, | |
const TCHAR * | srcIdent | |||
) |
Clears any archived event links for which srcIdent
was the event source.
This is required before srcIdent
is saved, so that any previously stored links are forgotten.
[in,out] | pom | The device manager to use. |
[in] | srcIdent | The device to clear event links for. |
sc_status sc_automationDeviceMgr_construct | ( | sc_automationDeviceMgr * | pom, | |
sc_lase * | jscx | |||
) |
Constructs an automation device manager for the given JavaScript environment.
[in,out] | pom | The object manager to construct. |
[in] | jscx | The JavaScript environment to manage. |
sc_status sc_automationDeviceMgr_createDevice | ( | sc_automationDeviceMgr * | pom, | |
const TCHAR * | bridgeName, | |||
sc_automationDevice * | pd | |||
) |
Creates a JavaScript object for device pd
which is attached to bridge bridgeName
.
[in,out] | pom | The device manager to use. |
[in] | bridgeName | The JS identifier of the bridge the device is connected to. |
[in] | pd | The device to create an instance for. |
sc_status sc_automationDeviceMgr_destruct | ( | sc_automationDeviceMgr * | pom | ) |
Destructs the given device manager.
[in,out] | pom | The object manager to destruct. |
sc_status sc_automationDeviceMgr_getClassFromDeviceType | ( | sc_automationDeviceMgr * | pom, | |
const TCHAR * | deviceType, | |||
const TCHAR ** | className | |||
) |
Returns the JavaScript class name for the given device type.
className
should not be freed as it is stored in the cache.[in,out] | pom | The object manager to use. |
[in] | deviceType | The device address to find a name for. |
[out] | className | The returned class name, or NULL. |
sc_status sc_automationDeviceMgr_getInstanceFromDeviceAddress | ( | sc_automationDeviceMgr * | pom, | |
const TCHAR * | deviceAddr, | |||
const TCHAR ** | instanceName | |||
) |
Returns the JavaScript object identifier (name) for the device with the given address, if an object already exists for it, or NULL otherwise.
The difference between this and getInstanceNameFromDeviceAddress is that this function will return NULL for a named device that does not have an object instance already created for it in the current JavaScript context, whereas the other will always return the name for the device if was ever given one.
instanceName
should not be freed as it is stored in the cache.[in,out] | pom | The object manager to use. |
[in] | deviceAddr | The device address to find a name for. |
[out] | instanceName | The returned instance identifier, or NULL. |
sc_status sc_automationDeviceMgr_getInstanceNameFromDeviceAddress | ( | sc_automationDeviceMgr * | pom, | |
const TCHAR * | deviceAddr, | |||
const TCHAR ** | instanceName | |||
) |
Returns the JavaScript object identifier (name) for the given device address.
instanceName
should not be freed as it is stored in the cache.[in,out] | pom | The object manager to use. |
[in] | deviceAddr | The device address to find a name for. |
[out] | instanceName | The returned instance identifier, or NULL. |
sc_status sc_automationDeviceMgr_relayMessage | ( | sc_automationDeviceMgr * | pom, | |
const TCHAR * | deviceAddress, | |||
sc_automationPacket * | pkt | |||
) |
Relays the message in pkt
to the device object in JavaScript whose address matches deviceAddress
.
If the device with the given address does not yet have an associated JavaScript object instance, the device manager attempts to create one. If the device has not been seen yet or the type is unknown, the device manager will not be able to create an instance and the event will be dropped.
[in,out] | pom | The device manager to use. |
[in] | deviceAddress | The device to relay the message to. |
[in] | pkt | The message to relay. |
sc_status sc_automationDeviceMgr_renameDevice | ( | sc_automationDeviceMgr * | pom, | |
const TCHAR * | curName, | |||
const TCHAR * | newName | |||
) |
Renames the device with identifier curName
to newName
.
This renaming takes effect immediately, and is permanent. The next time the device is newly discovered (for example, on LASE restart) it will retain this new name.
[in,out] | pom | The device manager to use. |
[in] | curName | The current name of the device. |
[in] | newName | The new name of the device. |
sc_status sc_automationDeviceMgr_saveArchive | ( | sc_automationDeviceMgr * | pom, | |
const TCHAR * | ident, | |||
const TCHAR * | archive | |||
) |
Stores the given archive for the given device in the device database.
This information is restored to this device the next time it is discovered and a new JavaScript object instance is created for it (for example, if LASE is restarted).
[in,out] | pom | The device manager to use. |
[in] | ident | The identifier of the device for which the archive is saved. |
[in] | archive | The JSON string to store as an archive. |
sc_status sc_automationDeviceMgr_saveLink | ( | sc_automationDeviceMgr * | pom, | |
const TCHAR * | srcIdent, | |||
const TCHAR * | srcEvent, | |||
const TCHAR * | dstIdent, | |||
const TCHAR * | dstMethd | |||
) |
An event link is stored between devices srcIdent
and dstIdent
.
The link will be restored the next time the devices are re-created.
[in,out] | pom | The device manager to use. |
[in] | srcIdent | The identifier of the device sourcing the event. |
[in] | srcEvent | The name of the event linking src and dst. |
[in] | dstIdent | The identifier of the device that subscribed to the event. |
[in] | dstMethd | The name of the method to be called on the dst device when the event occurs. |