|
|
@@ -1,23 +1,26 @@
|
|
|
-import { ThirdPartyDevice } from '@/constant'
|
|
|
+import { ThirdPartyDevice } from '@/constant.js'
|
|
|
import {
|
|
|
WillTopic,
|
|
|
createClient,
|
|
|
decodePayload
|
|
|
} from '@/utils/mqtt'
|
|
|
-import { transformPercentVolumeToLevelVolume } from '@/utils/control/volume'
|
|
|
-import { getStatusReport } from '@/api/device'
|
|
|
-import { getThirdPartyDevicesByThirdPartyDevice } from '@/api/mesh'
|
|
|
+import { transformPercentVolumeToLevelVolume } from '@/utils/control/volume.js'
|
|
|
+import {
|
|
|
+ getMultiCardStatusReport,
|
|
|
+ getReceivingCardStatusReport
|
|
|
+} from '@/api/device.js'
|
|
|
+import { getThirdPartyDevicesByThirdPartyDevice } from '@/api/mesh.js'
|
|
|
import {
|
|
|
Status,
|
|
|
Power
|
|
|
-} from './constant'
|
|
|
+} from './constant.js'
|
|
|
import {
|
|
|
GET_POWER_STATUS,
|
|
|
GET_RECEIVER_INFO,
|
|
|
parseCachePower,
|
|
|
getPowerStatusByMessage,
|
|
|
getReceivingCardStatusByMessage
|
|
|
-} from './nova'
|
|
|
+} from './nova.js'
|
|
|
|
|
|
export const TIMEOUT_MILLISECOND = 120000
|
|
|
export const EXPIRED_MILLISECOND = 300000
|
|
|
@@ -358,7 +361,7 @@ function startTask () {
|
|
|
fetching = true
|
|
|
console.log('monitor task', queue.size)
|
|
|
const ids = [...queue]
|
|
|
- getStatusReport(ids, { background: true, custom: true }).then(
|
|
|
+ getMultiCardStatusReport(ids, { background: true, custom: true }).then(
|
|
|
async ({ data }) => {
|
|
|
const map = {}
|
|
|
data.forEach(item => {
|
|
|
@@ -437,3 +440,18 @@ function startTask () {
|
|
|
setTimeout(flush, 500)
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+export function getReceivingCardStatusFromServer (id) {
|
|
|
+ getReceivingCardStatusReport(id, { background: true, custom: true }).then(res => {
|
|
|
+ if (res.data && getCacheById(id)[ThirdPartyDevice.RECEIVING_CARD].status !== Status.LOADING) {
|
|
|
+ const message = JSON.parse(res.data)
|
|
|
+ const data = getReceivingCardStatusByMessage(message)
|
|
|
+ if (data.success) {
|
|
|
+ emit(id, ThirdPartyDevice.RECEIVING_CARD, {
|
|
|
+ timestamp: message.timestamp,
|
|
|
+ ...data.data
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|