static void ZoneTempNotify(ZoneTempNotify notify) { Console.WriteLine("ZoneTempNotify:" + notify.DeviceID); }
//接受处理 private void receive_handle(MsgID cmd_id, byte[] data) { lock (wait_pack_look) { foreach (var item in wait_pack) { if (item.msg_id == cmd_id) { item.action.Invoke(cmd_id, data); return; } } } switch (cmd_id) { case MsgID.ConnectId: { SetDeviceReply reply; SetDeviceRequest(out reply); if (connected_action != null) { connected_action.Invoke(host); } } break; case MsgID.DisconnectId: { lock (wait_pack_look) { wait_pack.Clear(); } recv_buf.Clear(); if (disconnected_action != null) { disconnected_action.Invoke(host); } } break; case MsgID.ZoneTempNotifyId: { ZoneTempNotify notify = ZoneTempNotify.Parser.ParseFrom(data); if (notify == null) { return; } if (zone_temp_notify != null) { zone_temp_notify.Invoke(notify); } } break; case MsgID.ZoneAlarmNotifyId: { ZoneAlarmNotify notify = ZoneAlarmNotify.Parser.ParseFrom(data); if (notify == null) { return; } if (zone_alarm_notify != null) { zone_alarm_notify.Invoke(notify); } } break; case MsgID.DeviceEventNotifyId: { DeviceEventNotify notify = DeviceEventNotify.Parser.ParseFrom(data); if (notify == null) { return; } if (device_event_notify != null) { device_event_notify.Invoke(notify); } } break; case MsgID.TempSignalNotifyId: { TempSignalNotify notify = TempSignalNotify.Parser.ParseFrom(data); if (notify == null) { return; } if (temp_signal_notify != null) { temp_signal_notify.Invoke(notify); } } break; } }