Constructor
new Alertdevices(logger)
Parameters:
Name |
Type |
Description |
logger |
object
|
logger instance to be used by this class instance. |
- Author:
-
- Source:
Methods
createDevice(basedataId, assetsId, name, model, platform, osVersion, uuid, state, callback)
Creates a new device in coredatabase table
Parameters:
Name |
Type |
Description |
basedataId |
integer
|
id of basedata this device belongs to |
assetsId |
integer
|
asset id of asset, this device belongs to |
name |
string
|
name of device |
model |
string
|
model of device |
platform |
string
|
platform of the device |
osVersion |
string
|
OS Version reported by device |
uuid |
string
|
uuid of device |
state |
integer
|
state (1 active, 0 inactive) |
callback |
function
|
success (true or false) |
- Source:
doesDeviceExist(uuid, callback)
Checks, if a device exists in database
Parameters:
Name |
Type |
Description |
uuid |
string
|
|
callback |
function
|
null or row of existing device |
- Source:
getAlertdeciceForUUID(uuid, callback)
Returns Alert Device from core database with given uuid
Parameters:
Name |
Type |
Description |
uuid |
string
|
uuid of device to return from core database |
callback |
function
|
rows or null |
- Source:
getAllAlertdevices(callback)
Returns all Alert Devices from core database
Parameters:
Name |
Type |
Description |
callback |
function
|
rows or null |
- Source:
removeDevice(deviceId, callback)
Parameters:
Name |
Type |
Description |
deviceId |
integer
|
id of device in core database table alertdevices |
callback |
function
|
success (true or false) |
- Source:
removeDeviceByUUID(uuid, callback)
Deletes a device from core database given by its uuis
Parameters:
Name |
Type |
Description |
uuid |
string
|
uuid of device to delete |
callback |
function
|
success (true/false) |
- Source:
setActive(deviceId, callback)
Sets the state of an device to active
Parameters:
Name |
Type |
Description |
deviceId |
integer
|
id of device in coredatabase to set state for |
callback |
function
|
success (true or false) |
- Source:
setInactive(deviceId, callback)
Sets the state of an device to inactive
Parameters:
Name |
Type |
Description |
deviceId |
integer
|
id of device in coredatabase to set state for |
callback |
function
|
success (true or false) |
- Source:
updateDevice(deviceId, name, model, platform, osVersion, uuid, callback)
Updates device information in core database. basedataId and assetId can not be updated as a device can not be moved from one person / asset to another.
Parameters:
Name |
Type |
Description |
deviceId |
integer
|
id of device in coredatabase table alertdevices to be updated now |
name |
string
|
name of device |
model |
string
|
model of device |
platform |
string
|
platform of device |
osVersion |
string
|
osVersion of device |
uuid |
string
|
uuid of device |
callback |
function
|
success (true or false) |
- Source:
updateLastSeenById(uuid, callback)
Updates the last seen timestamp for device with id
Parameters:
Name |
Type |
Description |
uuid |
string
|
|
callback |
function
|
success (true / false) |
- Source:
updateLastSeenByUUID(uuid, callback)
Updates the last seen timestamp for device with uuid
Parameters:
Name |
Type |
Description |
uuid |
string
|
|
callback |
function
|
success (true / false) |
- Source: