mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 00:03:28 +02:00
Add convenience flags for knowing if a device is usable, ready, and owned by us.
This commit is contained in:
@@ -58,6 +58,7 @@ dbapi.saveDevice = function(serial, device) {
|
||||
, provider: device.provider
|
||||
, owner: null
|
||||
, status: device.status
|
||||
, ready: false
|
||||
, statusChangedAt: r.now()
|
||||
, createdAt: r.now()
|
||||
, lastHeartbeatAt: r.now()
|
||||
@@ -89,6 +90,7 @@ dbapi.unsetDeviceOwner = function(serial, owner) {
|
||||
dbapi.setDeviceAbsent = function(serial) {
|
||||
return db.run(r.table('devices').get(serial).update({
|
||||
present: false
|
||||
, ready: false
|
||||
, lastHeartbeatAt: null
|
||||
}))
|
||||
}
|
||||
@@ -101,7 +103,8 @@ dbapi.setDeviceChannel = function(serial, channel) {
|
||||
|
||||
dbapi.saveDeviceIdentity = function(serial, identity) {
|
||||
return db.run(r.table('devices').get(serial).update({
|
||||
platform: identity.platform
|
||||
ready: true
|
||||
, platform: identity.platform
|
||||
, manufacturer: identity.manufacturer
|
||||
, operator: identity.operator
|
||||
, model: identity.model
|
||||
|
||||
Reference in New Issue
Block a user