1 /** 2 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. \n 14 * 15 * Description: Provides at msg service header. Only for AT module. \n 16 */ 17 18 #ifndef AT_MSG_H 19 #define AT_MSG_H 20 21 #include "at_product.h" 22 23 typedef enum { 24 AT_CMD_MSG = 0x0, 25 AT_CMD_RESULT_MSG = 0x1, 26 AT_CMD_INTERACTIVITY_MSG = 0x2, 27 AT_CMD_TIMEOUT_MSG = 0x3, 28 AT_CMD_URC_REPORT_MSG = 0x4 29 } at_msg_type_t; 30 31 typedef struct { 32 uint16_t channel_id; 33 uint16_t len; 34 } at_cmd_msg_t; 35 36 typedef struct { 37 uint16_t err_code; 38 uint16_t cmd_id; 39 } at_result_msg_t; 40 41 typedef struct { 42 uint16_t urc_type; 43 } at_urc_report_msg_t; 44 45 typedef struct { 46 uint16_t type; 47 uint16_t cmd_id; 48 } at_timeout_msg_t; 49 50 typedef struct { 51 at_msg_type_t type; 52 union { 53 at_cmd_msg_t cmd; 54 at_result_msg_t result; 55 at_urc_report_msg_t urc; 56 at_timeout_msg_t timeout; 57 at_cmd_msg_t interactivity; 58 } sub_msg; 59 } at_msg_block_t; 60 61 errcode_t at_msg_send(at_msg_block_t *msg); 62 63 void at_msg_process(at_msg_block_t *msg); 64 #endif 65