|
@@ -124,12 +124,26 @@ func processReportStatus(deviceid, vendorId string, message *gjson.Json) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// TODO 子设备上线
|
|
|
-func processDevLogin(deviceId string) {
|
|
|
-
|
|
|
+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
|
|
|
}
|
|
|
|
|
|
-// TODO 子设备下线
|
|
|
-func processDevLogout(deviceId string) {
|
|
|
+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
|
|
|
}
|