Files
kunlun/app/smart_meter/inc/iot_dm_event.h
2024-09-28 14:24:04 +08:00

65 lines
2.3 KiB
C

#ifndef IOT_DEV_MGMT_EVENT_AND_STATE_H
#define IOT_DEV_MGMT_EVENT_AND_STATE_H
/* Event of plug-in device and our monitor. */
typedef enum _iot_dm_event_e {
/* Customer event start. Customer care about those events. */
DM_EVENT_DEV_POWER_ON = 0x0,/* Device power on. I > I(standby). */
DM_EVENT_DEV_POWER_OFF = 0x1,/* Device power off. I <= I(standby). */
DM_EVENT_DEV_WORK_START = 0x2,/* Device start working. I > I(work). */
DM_EVENT_DEV_WORK_STOP = 0x3,/* Device stop working. I <= I(work). */
DM_EVENT_DEV_TRAP_START = 0x4,/* Device work in trap. P > P(trap). */
DM_EVENT_DEV_TRAP_STOP = 0x5,/* Device restore from trap. P <= P(trap). */
DM_EVENT_MON_NETWORK_IN = 0x6,/* Monitor joins one network. */
DM_EVENT_MON_NETWORK_OUT= 0x7,/* Monitor leaves one network. */
/* Customer event end. */
/* Private event start. Event for debugging. */
DM_EVENT_MON_POWER_ON = 0x8,/* Monitor power on. Maybe restore from power cut off. */
DM_EVENT_MON_POWER_OFF = 0x9,/* Monitor power off. Maybe power cut off*/
/* Private event end. */
DM_EVENT_INVALID
}iot_dm_event_e;
/* State of plug-in device. */
typedef enum _iot_dm_device_state_e {
/* No device plug into our monitor. */
DM_STATE_DEV_OFFLINE = 0x00,
/* Device plug into our monitor, staying in standby. */
DM_STATE_DEV_STANDBY = 0x01,
/* Device plug into our monitor, working right. */
DM_STATE_DEV_WORKING = 0x02,
/* Device plug into our monitor, running in trouble. */
DM_STATE_DEV_TRAPING = 0x03,
DM_STATE_DEV_MAX = 0x0F
}iot_dm_dev_state_e;
/* State of monitor. */
typedef enum _iot_dm_monitor_state_e {
/* Our monitor is not in any network. */
DM_STATE_MON_OFFLINE = 0x00,
/* Our monitor is in a network. */
DM_STATE_MON_ONLINE = 0x10,
DM_STATE_MON_MAX = 0xF0
}iot_dm_mon_state_e;
/* State should be iot_dm_mon_state_e | iot_dm_dev_state_e */
/* State of led on monitor.*/
typedef enum _iot_dm_led_state_e {
/* Data send / receive by monitor. Blinks on rate. */
DM_STATE_LED_TRANSFER = 0x0,
/* Monitor or plug-in device in trap. Blinks every 1 second. */
DM_STATE_LED_TRAPPING = 0x1,
/* Monitor offline. Light on alawys.*/
DM_STATE_LED_OFFLINE = 0x2,
/* Monitor online. Light off always. */
DM_STATE_LED_ONLINE = 0x3,
DM_STATE_LED_MAX
}iot_dm_led_state_e;
#endif