|
@@ -24,12 +24,10 @@ export function start (device) {
|
|
|
`${productId}/${deviceId}/online`,
|
|
`${productId}/${deviceId}/online`,
|
|
|
`${productId}/${deviceId}/offline`,
|
|
`${productId}/${deviceId}/offline`,
|
|
|
`${productId}/${deviceId}/status/reply`,
|
|
`${productId}/${deviceId}/status/reply`,
|
|
|
- `${productId}/${deviceId}/screenshot/reply`,
|
|
|
|
|
`${productId}/${deviceId}/resource/progress`
|
|
`${productId}/${deviceId}/resource/progress`
|
|
|
], onMessage)
|
|
], onMessage)
|
|
|
createImmediateType('online', { parser: onlineParser })
|
|
createImmediateType('online', { parser: onlineParser })
|
|
|
createLoadType('status', { defaults: '未知', parser: statusParser })
|
|
createLoadType('status', { defaults: '未知', parser: statusParser })
|
|
|
- createLoadType('screenshot', { parser: screenshotParser })
|
|
|
|
|
createLoopType('download', { parser: downloadParser })
|
|
createLoopType('download', { parser: downloadParser })
|
|
|
if (__SENSOR__) {
|
|
if (__SENSOR__) {
|
|
|
updateSensors(createLoopType('sensor', { parser: sensorParser }))
|
|
updateSensors(createLoopType('sensor', { parser: sensorParser }))
|
|
@@ -42,7 +40,6 @@ export function stop () {
|
|
|
`${productId}/${deviceId}/online`,
|
|
`${productId}/${deviceId}/online`,
|
|
|
`${productId}/${deviceId}/offline`,
|
|
`${productId}/${deviceId}/offline`,
|
|
|
`${productId}/${deviceId}/status/reply`,
|
|
`${productId}/${deviceId}/status/reply`,
|
|
|
- `${productId}/${deviceId}/screenshot/reply`,
|
|
|
|
|
`${productId}/${deviceId}/resource/progress`
|
|
`${productId}/${deviceId}/resource/progress`
|
|
|
], onMessage)
|
|
], onMessage)
|
|
|
productId = null
|
|
productId = null
|
|
@@ -99,8 +96,6 @@ function getTypeBySend (topic) {
|
|
|
switch (topic) {
|
|
switch (topic) {
|
|
|
case 'status/ask':
|
|
case 'status/ask':
|
|
|
return 'status'
|
|
return 'status'
|
|
|
- case 'screenshot/ask':
|
|
|
|
|
- return 'screenshot'
|
|
|
|
|
default:
|
|
default:
|
|
|
return null
|
|
return null
|
|
|
}
|
|
}
|
|
@@ -113,8 +108,6 @@ function getType (topic) {
|
|
|
return 'online'
|
|
return 'online'
|
|
|
case 'status/reply':
|
|
case 'status/reply':
|
|
|
return 'status'
|
|
return 'status'
|
|
|
- case 'screenshot/reply':
|
|
|
|
|
- return 'screenshot'
|
|
|
|
|
case 'resource/progress':
|
|
case 'resource/progress':
|
|
|
return 'download'
|
|
return 'download'
|
|
|
default:
|
|
default:
|
|
@@ -183,7 +176,6 @@ function onlineParser (inst, message, topic) {
|
|
|
return true
|
|
return true
|
|
|
}
|
|
}
|
|
|
onUpdate(types.get('status'), '{}')
|
|
onUpdate(types.get('status'), '{}')
|
|
|
- onUpdate(types.get('screenshot'))
|
|
|
|
|
onUpdate(types.get('download'), 'clear')
|
|
onUpdate(types.get('download'), 'clear')
|
|
|
return false
|
|
return false
|
|
|
}
|
|
}
|
|
@@ -199,11 +191,6 @@ function statusParser (inst, message) {
|
|
|
return (inst.value = status)
|
|
return (inst.value = status)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-function screenshotParser (inst, message) {
|
|
|
|
|
- inst.value = message ? `data:image/jpeg;base64,${message.replace(/\s/g, '')}` : null
|
|
|
|
|
- return inst.value
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
function downloadParser (inst, message) {
|
|
function downloadParser (inst, message) {
|
|
|
try {
|
|
try {
|
|
|
if (message === 'clear') {
|
|
if (message === 'clear') {
|