Files
kunlun/export/inc/cli/iot_cli_sg_ctrl_api.h
2024-09-28 14:24:04 +08:00

105 lines
3.7 KiB
C

/****************************************************************************
Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
be copied by any method or incorporated into another program without
the express written consent of Aerospace C.Power. This Information or any portion
thereof remains the property of Aerospace C.Power. The Information contained herein
is believed to be accurate and Aerospace C.Power assumes no responsibility or
liability for its use in any way and conveys no license or title under
any patent or copyright and makes no representation or warranty that this
Information is free from patent or copyright infringement.
****************************************************************************/
#ifndef IOT_CLI_SG_CTRL_API_H
#define IOT_CLI_SG_CTRL_API_H
#include "os_types_api.h"
#include "iot_pkt_api.h"
#include "iot_utils_api.h"
#ifdef __cplusplus
extern "C" {
#endif
#pragma pack(push) /* save the pack status */
#pragma pack(1) /* 1 byte align */
/** message id used for cli report message to sg ctrl */
#define IOT_CLI_SG_CTRL_MSG_REQ_JOIN_NODE (0x01)
#define IOT_CLI_SG_CTRL_MSG_REQ_DATA_DL (0x02)
/** message id used for sg ctrl report message to cli */
#define IOT_CLI_SG_CTRL_MSG_RPT_IS_READY (0x01)
#define IOT_CLI_SG_CTRL_MSG_RPT_DATA_UL (0x02)
/** translate packet proto type */
#define IOT_CTRL_PROTO_3762 (0x00)
#define IOT_CTRL_PROTO_SPG (0x01)
#define IOT_CTRL_PROTO_INVALID (0xFF)
typedef struct _iot_cli_sg_ctrl_join_node_dl {
/** connect node mac address : big endian */
uint8_t node[IOT_MAC_ADDR_LEN];
/** node band id */
uint8_t band_id;
/** 1 - ckq connect; 0 - ckb connect */
uint8_t ckq;
} iot_cli_sg_ctrl_join_node_dl;
typedef struct _iot_cli_sg_ctrl_join_node_ack {
/** 0 - receive join node ack, other is wrong */
uint8_t result;
} iot_cli_sg_ctrl_join_node_ack;
/** cli notify plc mgr state to sg */
typedef struct _iot_cli_sg_ctrl_is_ready {
/** new state of plc mgr 0 - is disconnect, 1 - connect */
uint8_t ready;
/** mac address of the device had connected */
uint8_t mac[IOT_MAC_ADDR_LEN];
} iot_cli_sg_ctrl_is_ready_t;
/** plc mgr send cctt data to ctrl sg */
typedef struct _iot_cli_sg_ctrl_data_dl {
/** reserved space for future use. */
uint8_t reserved[16];
/** app proto packet sequence number */
uint16_t app_sn;
/** cctt proto type see - IOT_CTRL_PROTO_XXX */
uint8_t proto;
/** data length */
uint16_t data_len;
/** cctt data */
uint8_t data[0];
} iot_cli_sg_ctrl_data_dl_t;
typedef struct _iot_cli_sg_ctrl_data_dl_ack {
/** 0 - receive data ok, see ERR_XX */
uint8_t result;
uint16_t app_sn;
} iot_cli_sg_ctrl_data_dl_ack_t;
/** sg ctrl uplink data to plc mgr */
typedef struct _iot_cli_sg_ctrl_data_ul {
/** reserved space for future use. */
uint8_t reserved[16];
/** cctt proto type see - IOT_CTRL_PROTO_XXX */
uint8_t proto;
/** uplink data length */
uint16_t data_len;
/** uplink data */
uint8_t data[0];
} iot_cli_sg_ctrl_data_ul_t;
#pragma pack(pop) /* restore the pack status */
#ifdef __cplusplus
}
#endif
#endif /* IOT_CLI_SG_CTRL_API_H */