|
@@ -89,10 +89,10 @@ func (mp *MQTTProvider) OnDeviceMessage(deviceid, vendorId string, msgtype strin
|
|
|
switch act {
|
|
|
case klink.DevSendAction:
|
|
|
processReportStatus(deviceid, vendorId, message)
|
|
|
- //case klink.DevLoginAction:
|
|
|
- // _ = processDevLogin(deviceid)
|
|
|
- //case klink.DevLogoutAction:
|
|
|
- // _ = processDevLogout(deviceid)
|
|
|
+ case klink.DevLoginAction:
|
|
|
+ _ = processDevLogin(deviceid, message.GetString("subDeviceId"))
|
|
|
+ case klink.DevLogoutAction:
|
|
|
+ _ = processDevLogout(deviceid, message.GetString("subDeviceId"))
|
|
|
case klink.DevNetConfigAction:
|
|
|
_ = processDevNetConfig(deviceid, message.GetString("md5"))
|
|
|
}
|
|
@@ -133,28 +133,14 @@ func processReportStatus(deviceid, vendorId string, message *gjson.Json) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func processDevLogin(subDeviceId string) error {
|
|
|
- reply := rpcs.ReplyGetOnline{}
|
|
|
- var args rpcs.ArgsGetOnline
|
|
|
- args.Id = subDeviceId
|
|
|
- err := server.RPCCallByName(nil, rpcs.DeviceManagerName, "DeviceManager.GetOnline", args, &reply)
|
|
|
- if err != nil {
|
|
|
- server.Log.Errorf("device online error. args: %v, error: %v", args, err)
|
|
|
- }
|
|
|
- return err
|
|
|
+func processDevLogin(deviceCode, subDeviceId string) error {
|
|
|
+ server.Log.Debugf("子设备上线:%s,%s", deviceCode, subDeviceId)
|
|
|
+ return nil
|
|
|
}
|
|
|
|
|
|
-func processDevLogout(subDeviceId string) error {
|
|
|
- args := rpcs.ArgsGetOffline{
|
|
|
- Id: subDeviceId,
|
|
|
- }
|
|
|
- reply := rpcs.ReplyGetOffline{}
|
|
|
- err := server.RPCCallByName(nil, rpcs.DeviceManagerName, "DeviceManager.GetOffline", args, &reply)
|
|
|
- if err != nil {
|
|
|
- server.Log.Errorf("device offline error. deviceid: %v, error: %v", subDeviceId, err)
|
|
|
- }
|
|
|
-
|
|
|
- return err
|
|
|
+func processDevLogout(deviceCode, subDeviceId string) error {
|
|
|
+ server.Log.Debugf("子设备下线:%s,%s", deviceCode, subDeviceId)
|
|
|
+ return nil
|
|
|
}
|
|
|
|
|
|
// 处理设备配网信息
|