diff --git a/apps/iot/src/iot_host.erl b/apps/iot/src/iot_host.erl index a709772..0b83338 100644 --- a/apps/iot/src/iot_host.erl +++ b/apps/iot/src/iot_host.erl @@ -400,7 +400,9 @@ handle_event(cast, {handle, {data, Data}}, ?STATE_ACTIVATED, State = #state{aes {keep_state, State}; %% ping的数据是通过aes加密后的,因此需要在有会话的情况下才行 -handle_event(cast, {handle, {ping, CipherMetric}}, ?STATE_ACTIVATED, State = #state{uuid = UUID, name = Name, aes = AES, has_session = true}) -> +handle_event(cast, {handle, {ping, CipherMetric}}, ?STATE_ACTIVATED, State = #state{uuid = UUID, name = Name, aes = AES, + heartbeat_counter = HeartbeatCounter, has_session = true}) -> + MetricsInfo = iot_cipher_aes:decrypt(AES, CipherMetric), case catch jiffy:decode(MetricsInfo, [return_maps]) of Metrics when is_map(Metrics) -> @@ -411,10 +413,10 @@ handle_event(cast, {handle, {ping, CipherMetric}}, ?STATE_ACTIVATED, State = #st %% 检测消息是否需要报警 iot_watchdog:detection(UUID, Name, Metrics), - {keep_state, State#state{metrics = Metrics}}; + {keep_state, State#state{metrics = Metrics, heartbeat_counter = HeartbeatCounter + 1}}; Other -> lager:warning("[iot_host] host_id: ~p, ping is invalid json: ~p", [UUID, Other]), - {keep_state, State} + {keep_state, State#state{heartbeat_counter = HeartbeatCounter + 1}} end; handle_event(cast, {handle, {inform, Info0}}, ?STATE_ACTIVATED, State = #state{uuid = UUID, host_id = HostId, aes = AES, has_session = true}) -> diff --git a/docs/事件分类.md b/docs/事件分类.md index 44b55d5..f3f5cea 100644 --- a/docs/事件分类.md +++ b/docs/事件分类.md @@ -1,21 +1,20 @@ # 事件分类 ```text -11 23103 鼠类监测 -13 20407 异物占道 -14 10404 垃圾溢满 -12 22503 后厨非标着装 -15 23104 动火离人 -16 22706 强弱电间违规进入 -17 20863 作业人员抽烟监测 -18 20864 作业人员手机使用监测 -19 23105 挡鼠板监测 -20 23106 垃圾桶加盖 -21 22714 配电间人员进入监测 +11 23103 鼠类监测 +13 20407 异物占道 +14 10404 垃圾溢满 +12 22503 后厨非标着装 +15 23104 动火离人 +16 22715 强弱电间违规进入 +17 20863 作业人员抽烟监测 +18 20864 作业人员手机使用监测 +19 23105 挡鼠板监测 +20 23106 垃圾桶加盖 ``` 1、鼠类检测 0508103010001050300001 朴苑餐厅 2、异物占道 0512104030001050400003 行政楼B楼 3、垃圾溢满 0507106030001050600003 朴苑3舍 4、后厨非标着装 0500000000001022700537 监控摄像头532(诚苑餐厅 北侧) -5、动火离人 0500000000001022700538 监控摄像头533(诚苑餐厅 北侧) \ No newline at end of file +5、动火离人 0500000000001022700538 监控摄像头533(诚苑餐厅 北侧) \ No newline at end of file