1 /* 2 * Copyright (C) 2021 Huawei Device Co., Ltd. 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. 14 */ 15 16 #ifndef OHOS_RIL_VENDOR_SMS_DEFS_H 17 #define OHOS_RIL_VENDOR_SMS_DEFS_H 18 19 #include "hril_enum.h" 20 #include "hril_public_struct.h" 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif 25 26 /** 27 * @brief Defines the SMS response. 28 */ 29 typedef struct { 30 /** 31 * TP-Message-Reference for GSM, and BearerData MessageId for CDMA 32 * from 3GPP2 C.S0015-B, v2.0, 4.5-1 33 */ 34 int32_t msgRef; 35 /** 36 *Protocol Data Unit 37 */ 38 char *pdu; 39 /** 40 * if unknown or not applicable, that is -1 41 * from 3GPP 27.005, 3.2.5 for GSM/UMTS, 42 * 3GPP2 N.S0005 (IS-41C) Table 171 for CDMA 43 */ 44 int32_t errCode; 45 } HRilSmsResponse; 46 47 /** 48 * @brief Defines the SMS message information in a SIM card. 49 */ 50 typedef struct { 51 /** 52 * Number index 53 */ 54 int32_t index; 55 /** 56 * Status 57 */ 58 int32_t state; 59 /** 60 * Short message service center 61 */ 62 char *smsc; 63 /** 64 * Protocol Data Unit 65 */ 66 char *pdu; 67 } HRilSmsWriteSms; 68 69 /** 70 * @brief Defines the SMSC address information. 71 */ 72 typedef struct { 73 /** 74 * SMSC address type. For details, see 3GPP TS 24.011 [6]. 75 */ 76 int32_t tosca; 77 /** 78 * SMSC address. For details, see 3GPP TS 24.011 [6]. 79 */ 80 char *address; 81 } HRilServiceCenterAddress; 82 83 /** 84 * @brief Defines the GSM cell broadcast configuration information. 85 * 86 * From 3GPP TS 27.005 AT+CSCB=[<mode>[,<mids>[,<dcss>]]] 87 */ 88 typedef struct { 89 /** 90 * Mode (activated or not) 91 */ 92 int32_t mode; 93 /** 94 * Message IDs 95 */ 96 char *mids; 97 /** 98 * Data coding schemes 99 */ 100 char *dcss; 101 } HRilCBConfigInfo; 102 103 /** 104 * @brief Defines the CDMA cell broadcast configuration information. 105 */ 106 typedef struct { 107 /** 108 * Service 109 */ 110 int32_t service; 111 /** 112 * Language 113 */ 114 int32_t language; 115 /** 116 * Selected or not 117 */ 118 unsigned char checked; 119 } HRilCdmaCBConfigInfo; 120 121 /** 122 * @brief Defines the cell broadcast report information. 123 * 124 * From 3GPP TS 27.005 if text mode (+CMGF=1): 125 * <CR><LF>+CBM: 126 * <sn>,<mid>,<dcs>,<page>,<pages><CR><LF><data><CR> 127 * <LF> if PDU mode 128 * (+CMGF=0): 129 * <CR><LF>+CBM: <length><CR><LF><pdu><CR><LF> 130 */ 131 typedef struct { 132 /** 133 * Cell broadcast SN 134 */ 135 int32_t sn; 136 /** 137 * Message IDs 138 */ 139 int32_t mid; 140 /** 141 * Cell broadcast page number 142 */ 143 int32_t page; 144 /** 145 * Total number of cell broadcast pages 146 */ 147 int32_t pages; 148 /** 149 * Data coding schemes 150 */ 151 char *dcs; 152 /** 153 * Decoded cell broadcast content 154 */ 155 char *data; 156 /** 157 * Number of PDU bytes 158 */ 159 int32_t length; 160 /** 161 * Protocol data unit 162 */ 163 char *pdu; 164 } HRilCBConfigReportInfo; 165 166 typedef struct { 167 int32_t digitMode; 168 int32_t mode; 169 int32_t type; 170 int32_t plan; 171 unsigned char number; 172 unsigned char bytes[HRIL_MAX_CDMA_ADDRESS_LEN]; 173 } HRilCdmaSmsAddress; 174 175 typedef struct { 176 int32_t type; 177 unsigned char odd; 178 unsigned char number; 179 unsigned char bytes[HRIL_MAX_CDMA_ADDRESS_LEN]; 180 } HRilCdmaSmsSubAddress; 181 182 typedef struct { 183 int32_t serviceId; 184 unsigned char isExist; 185 int32_t type; 186 HRilCdmaSmsAddress address; 187 HRilCdmaSmsSubAddress subAddress; 188 int32_t size; 189 unsigned char bytes[HRIL_MAX_CDMA_MESSAGE_LEN]; 190 } HRilCdmaSmsMessageInfo; 191 192 typedef struct { 193 void (*SendGsmSms)(const ReqDataInfo *requestInfo, const char *const *data, size_t dataLen); 194 void (*SendSmsAck)(const ReqDataInfo *requestInfo, const int32_t *data, size_t dataLen); 195 void (*SendCdmaSms)(const ReqDataInfo *requestInfo, const char *data, size_t dataLen); 196 void (*SendCdmaAck)(const ReqDataInfo *requestInfo, const char *data, size_t dataLen); 197 void (*AddSimMessage)(const ReqDataInfo *requestInfo, const HRilSmsWriteSms *data, size_t dataLen); 198 void (*DelSimMessage)(const ReqDataInfo *requestInfo, const int32_t *data, size_t dataLen); 199 void (*UpdateSimMessage)(const ReqDataInfo *requestInfo, const HRilSmsWriteSms *data, size_t dataLen); 200 void (*SetSmscAddr)(const ReqDataInfo *requestInfo, const HRilServiceCenterAddress *data, size_t dataLen); 201 void (*GetSmscAddr)(const ReqDataInfo *requestInfo); 202 void (*SetCBConfig)(const ReqDataInfo *requestInfo, const HRilCBConfigInfo *data, size_t dataLen); 203 void (*GetCBConfig)(const ReqDataInfo *requestInfo); 204 void (*GetCdmaCBConfig)(const ReqDataInfo *requestInfo); 205 void (*SetCdmaCBConfig)(const ReqDataInfo *requestInfo, const HRilCdmaCBConfigInfo *data, size_t dataLen); 206 void (*AddCdmaSimMessage)(const ReqDataInfo *requestInfo, const HRilSmsWriteSms *data, size_t dataLen); 207 void (*DelCdmaSimMessage)(const ReqDataInfo *requestInfo, const int32_t *data, size_t dataLen); 208 void (*UpdateCdmaSimMessage)(const ReqDataInfo *requestInfo, const HRilSmsWriteSms *data, size_t dataLen); 209 } HRilSmsReq; 210 #ifdef __cplusplus 211 } 212 #endif 213 #endif // OHOS_RIL_VENDOR_SMS_DEFS_H 214