mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-05-10 22:02:09 +08:00
更新报错
This commit is contained in:
@@ -1,6 +0,0 @@
|
||||
|
||||
2023-08-22 15:15:49--------------------------------
|
||||
|
||||
2023-08-22 15:51:54--------------------------------
|
||||
|
||||
2023-08-23 16:11:33--------------------------------
|
||||
@@ -146,8 +146,6 @@ func (s *HookService) OnClientDisconnected(ctx context.Context, in *exhook.Clien
|
||||
Datas: string(v),
|
||||
Type: message.DisConnectMes,
|
||||
}
|
||||
// todo 网关掉线子设备全部离线状态,更改设备下线状态
|
||||
|
||||
s.messageCh <- data
|
||||
return &exhook.EmptySuccess{}, nil
|
||||
}
|
||||
|
||||
@@ -104,17 +104,16 @@ func getRuleChain(etoken *tool.DeviceAuth) *ruleEntity.RuleDataJson {
|
||||
return &ruleData
|
||||
}
|
||||
|
||||
func buildRuleMessage(etoken *tool.DeviceAuth, dei *DeviceEventInfo, msgType string) message.Message {
|
||||
func buildRuleMessage(etoken *tool.DeviceAuth, dei *DeviceEventInfo, msgType string) *message.Message {
|
||||
metadataVals := map[string]interface{}{
|
||||
"deviceId": etoken.DeviceId,
|
||||
"deviceName": etoken.Name,
|
||||
"deviceType": etoken.DeviceType,
|
||||
"productId": etoken.ProductId,
|
||||
}
|
||||
metadata := message.NewDefaultMetadata(metadataVals)
|
||||
msgVals := make(map[string]interface{})
|
||||
json.Unmarshal([]byte(dei.Datas), &msgVals)
|
||||
return message.NewMessageWithDetail(etoken.User, msgType, msgVals, metadata)
|
||||
return message.NewMessage(etoken.User, msgType, msgVals, metadataVals)
|
||||
}
|
||||
|
||||
func SendZtWebsocket(deviceId, message string) {
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
package iothub
|
||||
|
||||
// 指令下发
|
||||
/*func Control(assets, thingModel, device_name, parameter string, operation bool) error {
|
||||
topic := fmt.Sprintf("control/%s/%s", assets, device_name)
|
||||
log.Println(topic)
|
||||
payload := fmt.Sprintf(`{"method":"control","data":{"parameter": "%s","operation":%t}}`, parameter, operation)
|
||||
//Publish(*global.GVA_MQTT, topic, 1, payload)
|
||||
return nil
|
||||
}
|
||||
|
||||
func ControlState(assets, thingModel, device_name string) (map[string]interface{}, error) {
|
||||
topic := fmt.Sprintf("control/%s/%s", assets, device_name)
|
||||
payload := fmt.Sprintf(`{"method":"state","data":{}}`)
|
||||
if Publish(*global.GVA_MQTT, topic, 1, payload) != nil {
|
||||
return nil, errors.New("下发获取状态参数指令失败")
|
||||
}
|
||||
select {
|
||||
case state := <-controlState:
|
||||
return state, nil
|
||||
case <-time.After(10 * time.Second):
|
||||
return nil, errors.New("请求指令状态超时")
|
||||
}
|
||||
}
|
||||
*/
|
||||
Reference in New Issue
Block a user