liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 1 | #ifndef MBTK_ADB_INFO_H |
| 2 | #define MBTK_ADB_INFO_H |
| 3 | #include "mbtk_type.h" |
| 4 | |
| 5 | #define MBTK_ADB_PACK_FLAG 0xF6F7F8F9 |
| 6 | |
| 7 | // flag[4] + type[1] + data_len[2] [+ data[data_len]] |
| 8 | #define MBTK_ADB_PACK_HEAD_SIZE 7 |
| 9 | |
| 10 | // Message ID. |
| 11 | typedef enum |
| 12 | { |
| 13 | MBTK_ADB_MSG_CONN_START = 0x01, // cli->ser : Start handshake. |
| 14 | MBTK_ADB_MSG_CONN_SUCCESS, // ser->cli : Connect success. |
| 15 | MBTK_ADB_MSG_PUSH, // cli->ser : Start push data(ARG : data_len[4] path_len[2] path[path_len]). |
| 16 | MBTK_ADB_MSG_PUSH_READY, // ser->cli : Server ready,client can send data. |
| 17 | MBTK_ADB_MSG_PUSH_COMPLETE, // cli->ser : Push complete. |
| 18 | MBTK_ADB_MSG_PUSH_SIZE, // ser->cli : Server recv data lenght(ARG : data_len[4]). |
| 19 | MBTK_ADB_MSG_CMD_REQ, // cli->ser : Send shell/at command.(ARG : shell/at command). |
| 20 | MBTK_ADB_MSG_CMD_RSP, // ser->cli : Shell/at command response.(ARG : shell/at command response). |
| 21 | MBTK_ADB_MSG_CMD_KILL, // cli->ser : Kill shell command. |
| 22 | MBTK_ADB_MSG_CMD_RSP_COMPLETE, // ser->cli : Shell/at command response complete. |
| 23 | MBTK_ADB_MSG_CLOSE_START, // cli->ser : Start close connect. |
| 24 | MBTK_ADB_MSG_CLOSE_SUCCESS, // ser->cli : Close connect success. |
| 25 | |
| 26 | // ERR start |
| 27 | // MBTK_ADB_MSG_ERR_UNKNOWN = 0x80, |
| 28 | |
| 29 | MBTK_ADB_MSG_DATA = 0xFF // Data |
| 30 | } mbtk_adb_msg_enum; |
| 31 | |
| 32 | // Message error ID. |
| 33 | typedef enum |
| 34 | { |
| 35 | MBTK_ADB_MSG_ERR_SUCCESS = 0x0, |
| 36 | MBTK_ADB_MSG_ERR_UNKNOWN = 0x80, |
| 37 | MBTK_ADB_MSG_ERR_PACK, // Packet error. |
| 38 | MBTK_ADB_MSG_ERR_IO, // Read/Write error. |
| 39 | MBTK_ADB_MSG_ERR_FILE_SIZE, // File size error. |
| 40 | MBTK_ADB_MSG_ERR_FILE_PATH, // File path error. |
| 41 | MBTK_ADB_MSG_ERR_TRANS_NO_START, // Data transfer not started. |
| 42 | MBTK_ADB_MSG_ERR_UNKNOWN_MSG, // Unknown msg. |
| 43 | MBTK_ADB_MSG_ERR_COMMAND, // Shell or AT command error. |
| 44 | |
| 45 | } mbtk_adb_msg_err_enum; |
| 46 | |
| 47 | typedef struct |
| 48 | { |
| 49 | mbtk_adb_msg_enum msg_id; |
| 50 | |
| 51 | uint16 data_len; |
| 52 | uint8 *data; |
| 53 | } mbtk_adb_pack_t; |
| 54 | |
| 55 | #endif /* MBTK_ADB_INFO_H */ |