blob: 7ea5e2a60fe9da86dad7388bf58fd93af69ae7e6 [file] [log] [blame]
yu.dongc33b3072024-08-21 23:14:49 -07001/*****************************************************************************
2* Copyright Statement:
3* --------------------
4* This software is protected by Copyright and the information contained
5* herein is confidential. The software may not be copied and the information
6* contained herein may not be used or disclosed except with the written
7* permission of MediaTek Inc. (C) 2016
8*
9* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
10* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS (""MEDIATEK SOFTWARE"")
11* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
12* AN ""AS-IS"" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
13* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
14* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
15* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
16* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
17* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
18* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
19* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
20* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
21*
22* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
23* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
24* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
25* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
26* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
27*
28* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
29* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
30* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
31* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
32* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
33*
34*****************************************************************************/
35/*************************************************************
36*
37* This Software is the property of VIA Telecom, Inc. and may only be used pursuant to a license from VIA Telecom, Inc.
38*
39* Any unauthorized use inconsistent with the terms of such license is strictly prohibited.
40*
41* Copyright (c) 2006-2010 VIA Telecom, Inc. All rights reserved.
42*
43*************************************************************/
44#ifndef VALSMSAPI_H
45#define VALSMSAPI_H
46
47#ifdef __cplusplus
48extern "C" {
49#endif
50
51/*===========================================================================
52
53 V A L S M S A P I H E A D E R F I L E
54
55 This file contains the exported interfaces for the SMS
56 module of the VIA Abstraction Layer.
57
58
59===========================================================================*/
60
61#include "sysdefs.h"
62#include "valapi.h"
63#include "valsmsdefine.h"
64#include "c2k_nvram_def.h"
65#include "c2k_sms_struct.h"
66#include "kal_public_defs.h"
67
68
69#define VAL_SMS_MAX_REGISTERED_IDS 10 /*!< Max registered app */
70#define VAL_SMS_TELESRVID_COUNT 20 /*!< Max registered teleservice id */
71#define VAL_SMS_MAX_SMS_PDU_LEN 253 /*!< Max sms pdu length */
72#define VAL_SMS_CLASS_SUCESS 0
73#define VAL_SMS_CAUSECODE_SUCESS 32768
74#define VAL_SMS_MOSEQ_ID_MAX 0xFE
75#define VAL_MAX_SAVED_SMS_ID_PAIR 20
76#define VAL_SMS_MO_TYPE_3GPP2 01
77#define VAL_SMS_TRANS_LEN 10
78#define CNMATIMEOUT 2000 /* according 3gpp2 spec, SMS ack should be returned in 2 seconds. */
79
80/*Timer duration of CNMA for UIM related MT SMS, sometimes SIM takes more than 2s to handle the data.*/
81#define CNMA_TIMEOUT_FOR_UIM_SMS 5000
82
83
84#ifdef MTK_CBP_ENCRYPT_VOICE
85#define MODE_MANUAL 0
86#define MODE_AUTO 1
87#define NUMBER_MAX_LEN 11
88
89typedef enum
90{
91 VAL_SMS_MODE_ERROR,
92 VAL_SMS_DECRYPT_ERROR,
93 VAL_SMS_SIGNATURE_VERFY_ERROR,
94 VAL_SMS_SEND_FAIL,
95 VAL_SMS_OTHER_ERROR,
96} ValSmsReportErrClassT;
97
98#endif
99
100/*! Sms in PDU format*/
101typedef struct
102{
103 kal_uint8 SmsState;
104#ifdef MTK_CBP_ENCRYPT_VOICE
105 kal_bool CryptSmsPres;
106#endif
107 kal_uint8 SmsLength;
108 kal_uint8 SmsData[VAL_SMS_MAX_SMS_PDU_LEN];
109} ValSmsPduRecordT;
110
111typedef struct
112{
113 kal_uint16 SeqNum;
114 ValSmsPduRecordT PduRecord;
115}ValSmsRecordT;
116
117/*! Val sms sending info */
118typedef struct
119{
120 kal_bool Acked; /*!< Acked flag */
121 kal_uint16 MoSeqNum; /*!< Sending equence number */
122#ifdef SYS_OPTION_NO_UI
123 kal_uint16 StoredRecId;
124#endif
125} ValSmsSendInfoT;
126
127/*! Val sms Updating status */
128typedef enum
129{
130 VAL_SMS_UPDATE_NONE, /*!< Free for update */
131 VAL_SMS_UPDATE_BUSY /*!< Busy for update */
132}ValSmsUpdateStatusIdT;
133
134/*! Val sms update info */
135typedef struct
136{
137 kal_uint16 UpdateRecId; /*!< Update recored id */
138 ValSmsUpdateStatusIdT UpdateStatus; /*!< Update status */
139} ValSmsUpdateInfoT;
140
141#ifdef SYS_OPTION_NO_UI
142typedef enum
143{
144 VAL_SMS_EVENT_INCOMING_MESSAGE = 0x00000001,
145 VAL_SMS_EVENT_SEND_STATUS_MESSAGE,
146 VAL_SMS_EVENT_MEM_STATUS_MESSAGE,
147 VAL_SMS_EVENT_SMS_WRITE_ERR_MESSAGE, /*incoming msg write error event*/
148 VAL_SMS_EVENT_SMS_SRV_READY_MESSAGE, /*the vsms service is ready*/
149 VAL_SMS_EVENT_SMS_RECEIVED_BUT_MEM_FULL, /*received a msg, but memory full, so the msg lost*/
150 VAL_SMS_MAX_EVENTS
151} ValSmsEventIdT;
152#else
153typedef kal_uint32 ValSmsEventIdT;
154#endif
155/*! SMS callback function structure */
156typedef void (*ValSmsEventFunc) ( RegIdT RegId, ValSmsEventIdT Event, void *MsgP );
157
158/*! SMS Event register table structure */
159typedef struct
160{
161 kal_bool IsUse; /*!< if this entry is in use */
162 kal_uint8 NumTeleSrvId; /*!< Teleservice Id count */
163 kal_uint16 TeleSrvId[VAL_SMS_TELESRVID_COUNT]; /*!< Teleservice id */
164 ValSmsEventFunc CallBack; /*!< Function to call back */
165} ValSmsRegTableT;
166
167/*! VAL SMS general result type */
168typedef enum
169{
170 VAL_SMS_SUCCESS,
171 VAL_SMS_ERR_SMS_NOT_READY,
172 VAL_SMS_ERR_MSG_FORMAT,
173 VAL_SMS_ERR_INVALID_PARAMETER,
174 VAL_SMS_ERR_BUSY_SENDING, /* while a register application send a sms message while the previous was not acknowleged*/
175 VAL_SMS_ERR_DESTINATION_BUSY,
176 VAL_SMS_ERR_NO_MEMORY,
177 VAL_SMS_FDN_APPROVE_REQ_SENT,
178 VAL_SMS_FDN_APPROVE_FAILED = 14,
179 VAL_SMS_ERR_OTHER_FAILED
180#ifdef __TC10_IPC_CDMA_SUPPORT__
181 ,VAL_SMS_ERR_FDN
182#endif
183} ValSmsResultT;
184
185/*! Sms terminal status */
186typedef enum
187{
188 VAL_SMS_NO_TERMINAL_PROBLEMS,
189 VAL_SMS_DESTINATION_RESOURSE_SHORTAGE,
190 VAL_SMS_DESTINATION_OUT_OF_SERVICE,
191 VAL_SMS_MAX_TERM_STATUS
192} ValSmsTermStatusT;
193
194#define IS_VALID_SMS_TERM_STATUS(a) ((VAL_SMS_NO_TERMINAL_PROBLEMS <= (a)) && ((a) < VAL_SMS_MAX_TERM_STATUS))
195
196/*! Val sms cause code define */
197typedef enum
198{
199 VAL_SMS_CC_ADDRESS_VACANT = 0,
200 VAL_SMS_CC_ADDRESS_TRANSLATION_FAILURE = 1,
201 VAL_SMS_CC_NETWORK_RESOURCE_SHORTAGE = 2,
202 VAL_SMS_CC_NETWORK_FAILURE = 3,
203 VAL_SMS_CC_INVALID_TELESERVICE_ID = 4,
204 VAL_SMS_CC_OTHER_NETWORK_PROBLEM = 5,
205 VAL_SMS_CC_OTHER_NETWORK_PROBLEM_MORE_FIRST = 6,
206 VAL_SMS_CC_OTHER_NETWORK_PROBLEM_MORE_LAST = 31,
207 VAL_SMS_CC_NO_PAGE_RESPONSE_S = 32,
208 VAL_SMS_CC_DESTINATION_BUSY = 33,
209 VAL_SMS_CC_NO_ACKNOWLEDGEMENT = 34,
210 VAL_SMS_CC_DESTINATION_RESOURCE_SHORTAGE = 35,
211 VAL_SMS_CC_SMS_DELIVERY_POSTPONED = 36,
212 VAL_SMS_CC_DESTINATION_OUT_OF_SERVICE = 37,
213 VAL_SMS_CC_DESTINATION_NO_LONGER_AT_THIS_ADDRESS = 38,
214 VAL_SMS_CC_OTHER_TERMINAL_PROBLEM = 39,
215 VAL_SMS_CC_OTHER_TERMINAL_PROBLEM_FIRST = 40,
216 VAL_SMS_CC_OTHER_TERMINAL_PROBLEM_LAST = 47,
217 VAL_SMS_CC_SMS_DELIVER_POSTPONED_MORE_FIRST = 48,
218 VAL_SMS_CC_SMS_DELIVER_POSTPONED_MORE_LAST = 63,
219 VAL_SMS_CC_RADIO_INTERFACE_RESOURCE_SHORTAGE = 64,
220 VAL_SMS_CC_RADIO_INTERFACE_INCOMPATIBILITY = 65,
221 VAL_SMS_CC_OTHER_RADIO_INTERFACE_PROBLEM = 66,
222 VAL_SMS_CC_OTHER_RADIO_IF_PROBLEM_MORE_FIRST = 67,
223 VAL_SMS_CC_OTHER_RADIO_IF_PROBLEM_MORE_LAST = 95,
224 VAL_SMS_CC_ENCODING_PROBLEM = 96,
225 VAL_SMS_CC_SMS_ORIGINATION_DENIED = 97,
226 VAL_SMS_CC_SMS_TERMINATION_DENIED = 98,
227 VAL_SMS_CC_SUPPLEMENTARY_SERVICE_NOT_SUPPORTED = 99,
228 VAL_SMS_CC_SMS_NOT_SUPPORTED = 100,
229 VAL_SMS_CC_RESERVED = 101,
230 VAL_SMS_CC_MISSING_EXPECTED_PARAMETER = 102,
231 VAL_SMS_CC_MISSING_MANDATORY_PARAMETER = 103,
232 VAL_SMS_CC_UNRECOGNIZED_PARAMETER_VALUE = 104,
233 VAL_SMS_CC_UNEXPECTED_PARAMETER_VALUE = 105,
234 VAL_SMS_CC_USER_DATA_SIZE_ERROR = 106,
235 VAL_SMS_CC_OTHER_GENERAL_PROBLEMS = 107,
236 VAL_SMS_CC_OTHER_GENERAL_PROBLEMS_MORE_FIRST = 108,
237 VAL_SMS_CC_OTHER_GENERAL_PROBLEMS_MORE_LAST = 255,
238 VAL_SMS_CC_MESSAGE_DELIVERED_SUCCESSFULLY = 32768,
239 VAL_SMS_CC_WAITING_FOR_TL_ACK = 32769,
240 VAL_SMS_CC_OUT_OF_RESOURCES = 32770,
241 VAL_SMS_CC_ACCESS_TOO_LARGE = 32771,
242 VAL_SMS_CC_DRC_TOO_LARGE = 32772,
243 VAL_SMS_CC_NETWORK_NOT_READY = 32773,
244 VAL_SMS_CC_PHONE_NOT_READY = 32774,
245 VAL_SMS_CC_NOT_ALLOWED_IN_AMPS = 32775,
246 VAL_SMS_CC_NOT_SUPPORTED = 32776,
247 VAL_SMS_CC_INVALID_TRANSACTION = 32777,
248 VAL_SMS_CC_MESSAGE_NOT_SENT = 32778,
249 VAL_SMS_CC_MESSAGE_BEGIN_SENT = 32779,
250 VAL_SMS_MAX_CC
251} ValSmsCCT;
252
253/*! Macro for validating ValSmsCauseCodeT */
254#define IS_VALID_SMS_CAUSE_CODE(a) \
255 (((VAL_SMS_CC_ADDRESS_VACANT == (a)) || ((VAL_SMS_CC_ADDRESS_VACANT <(a)) && \
256 ((a) <= VAL_SMS_CC_OTHER_NETWORK_PROBLEM))) || \
257 ((VAL_SMS_CC_NO_PAGE_RESPONSE_S <= (a)) && \
258 ((a) <= VAL_SMS_CC_OTHER_TERMINAL_PROBLEM)) || \
259 ((VAL_SMS_CC_RADIO_INTERFACE_RESOURCE_SHORTAGE <= (a)) && \
260 ((a) <= VAL_SMS_CC_SMS_NOT_SUPPORTED)) || \
261 ((VAL_SMS_CC_MISSING_EXPECTED_PARAMETER <= (a)) && ((a) < VAL_SMS_MAX_CC)))
262
263
264/*! Send status */
265/*val sms event message type for ui*/
266typedef struct
267{
268 ValSmsRecIdT recid;
269} ValSmsIncomingMsgT;
270
271typedef struct
272{
273 kal_uint8 SeqNum; /* The PSW-MMI SeqNum id used in msg assembly */
274 ValSmsErrClassT ErrClass;
275 ValSmsCauseCodeT CauseCode;
276} ValSmsSendStatusMsgT;
277
278/* val message type for sms uint */
279typedef struct
280{
281 ValDeviceT device;
282 kal_bool MemStatusFull; /*KAL_TRUE for memory full, KAL_FALSE for memory enough */
283} ValSmsMemStatMsgT;
284
285typedef struct
286{
287 kal_bool SmsMemFull; /*KAL_TRUE for no memory, KAL_FALSE for memory enough */
288 ValDeviceT device;
289} ValSmsMemStatusMsgT;
290
291typedef struct
292{
293 ValDeviceT device;
294} ValSmsWriteErrMsgT;
295
296/*----------------------------------
297message storage type define
298------------------------------------*/
299
300typedef enum
301{
302 /*VAL SMS Msg type teleservice value in IS-637:*/
303
304 MSG_IS91_PAGE_MSG,
305 MSG_IS91_VOICE_MAIL, /* analog mode teleservice */
306 MSG_IS91_SHORT_MESSAG,
307 MSG_VOICE_MAIL_MWI,
308
309 MSG_TELE_SRV_IS91, /* IS91_TS_ID_IS91 = 4096, */
310 MSG_TELE_SRV_PAGE, /* VAL_SMS_TS_ID_PAGE = 4097, */
311 MSG_TELE_SRV_MESSAGE, /* VAL_SMS_TS_ID_MESSAGE = 4098, */
312 MSG_TELE_SRV_VMN, /* VAL_SMS_TS_ID_VOICE_MAIL = 4099, */
313 MSG_TELE_SRV_WAP, /* VAL_SMS_TS_ID_WAP, */
314 MSG_TELE_SRV_WEMT, /* VAL_SMS_TS_ID_WEMT, */
315 MSG_TELE_SRV_SCPT, /* VAL_SMS_TS_ID_SCPT, */
316 MSG_TELE_SRV_CATPT, /* VAL_SMS_TS_ID_CATPT */
317 MSG_BROAD_CAST_SRV, /* broadcast SMS service, not a teleservice, here for the purpose of management for all SMS service */
318#if defined(LGT_EXTENSIONS)
319 MSG_TELE_SRV_UNKNOWN, /* VAL_SMS_LGT_UNKNOWN */
320#endif
321 MSG_TELE_SRV_UNICOM,
322 MSG_AUTO_REG_SRV,
323 MSG_AUTO_DM_PUSH,
324 MSG_TELE_SRV_GPS,
325 MSG_TELE_SRV_DANDCN,
326 MAX_REG_MSG
327} ValSmsTeleSrvType;
328
329typedef struct
330{
331 kal_bool isUse;
332#ifdef SYS_OPTION_NO_UI
333 ValSmsTeleSrvIdT TeleSrvId;
334#else
335 kal_uint16 TeleSrvId;
336#endif
337 kal_uint8 RegIdCount;
338 kal_bool NeedSave;
339 kal_uint8 NeedSaveCount;
340} RegEvtInfoT;
341
342
343/*the memory status*/
344typedef struct
345{
346 kal_uint16 nFlashMaxSmsRec;
347 kal_uint16 nFlashFreeSmsRec;
348 kal_uint16 nUimMaxSmsRec;
349 kal_uint16 nUimFreeSmsRec;
350} ValSmsStorParamsT;
351
352
353typedef struct
354{
355 kal_int16 refNum;
356 kal_uint8 maxNum;
357 kal_uint8 seqNum;
358 kal_uint8 numSegments;
359 kal_uint16 recid;
360}ValEmsHeaderT;
361
362typedef enum
363{
364 Unused =0,
365 RxUnReadBox,
366 RxReadBox,
367 TxSentBox,
368 DraftBox,
369 RxUnRead,
370 DuplicateUnRead,
371 RxRead,
372 DuplicateRead,
373 TxSent,
374 TxNotSent,
375 SentDelivered,
376 SentIncompleteDelivery,
377 SentDeliveryFailed,
378 SentNoServicePending,
379 DraftRead,
380 DraftSent,
381 DraftNotSent,
382 NUM_ETS_SMS_BOX
383} ValSmsEtsMsgTypeT;
384
385
386typedef enum
387{
388 SMS_ETS_EVT_ADDED,
389 SMS_ETS_EVT_DELETED,
390 SMS_ETS_EVT_MODIFIED,
391 SMS_ETS_EVT_RECEIVED,
392 SMS_ETS_EVT_SENT
393} ValSmsEtsEventT;
394
395typedef enum
396{
397 /*=== General errors ===*/
398
399 UI_General_SUCCESS,
400 UI_General_Index_Out_Of_Range,
401 UI_General_Not_Implemented,
402 UI_General_Storage_Full,
403 UI_General_Empty_Index,
404
405 /*=== SMS errors ===*/
406
407 /*Network Problems*/
408 UI_SMS_ADDRESS_VACANT,
409 UI_SMS_ADDRESS_TRANSLATION,
410 UI_SMS_NETWORK_RESOURCE_SHORTAGE,
411 UI_SMS_NETWORK_FAILURE,
412 UI_SMS_INVALID_TELESERVICE_ID,
413 UI_SMS_OTHER_NETWORK_PROBLEM,
414 UI_SMS_OTHER_NETWORK_PROBLEM_MORE_FIRST,
415 UI_SMS_OTHER_NETWORK_PROBLEM_MORE_LAST,
416
417 /*General Problems*/
418 UI_SMS_NO_PAGE_RESPONSE,
419 UI_SMS_DESTINATION_BUSY,
420 UI_SMS_NO_ACKNOWLEDGEMENT,
421 UI_SMS_DESTINATION_RESOURCE_SHORTAGE,
422 UI_SMS_DELIVERY_POSTPONED,
423 UI_SMS_DESTINATION_OUT_OF_SERVICE,
424 UI_SMS_DESTINATION_NO_LONGER_AT_THIS_ADDRESS,
425 UI_SMS_OTHER_TERMINAL_PROBLEM,
426 UI_SMS_OTHER_TERMINAL_PROBLEM_MORE_FIRST,
427 UI_SMS_OTHER_TERMINAL_PROBLEM_MORE_LAST,
428 UI_SMS_DELIVER_POSTPONED_MORE_FIRST,
429 UI_SMS_DELIVER_POSTPONED_MORE_LAST,
430 UI_SMS_RADIO_INTERFACE_RESOURCE_SHORTAGE,
431 UI_SMS_RADIO_INTERFACE_INCOMPATIBILITY,
432 UI_SMS_OTHER_RADIO_INTERFACE_PROBLEM,
433 UI_SMS_OTHER_RADIO_INTERFACE_PROBLEM_MORE_FIRST,
434 UI_SMS_OTHER_RADIO_INTERFACE_PROBLEM_MORE_LAST,
435 UI_SMS_ENCODING_PROBLEM,
436 UI_SMS_SUPPLEMENTARY_SERVICE_NOT_SUPPORTED,
437 UI_SMS_RESERVED,
438 UI_SMS_MISSING_EXPECTED_PARAMETER,
439 UI_SMS_MISSING_MANDATORY_PARAMETER,
440 UI_SMS_UNRECOGNIZED_PARAMATER_VALUE,
441 UI_SMS_UNEXPECTED_PARAMATER_VALUE,
442 UI_SMS_OTHER_GENERAL_PROBLEMS,
443 UI_SMS_OTHER_GENERAL_PROBLEMS_MORE_FIRST,
444 UI_SMS_OTHER_GENERAL_PROBLEMS_MORE_LAST,
445
446 /*SERVICE NOT AVAILABLE*/
447 UI_SMS_ORIGINATION_DENIED,
448
449 /*INVALID DESTINATION*/
450 UI_SMS_TERMINATION_DENIED,
451
452 /*SERVICE NOT SUPPORTED*/
453 UI_SMS_NOT_SUPPORTED,
454
455 /*MESSAGE TOO LONG FOR NETWORK*/
456 UI_SMS_USER_DATA_SIZE_ERROR,
457
458 /*Other Messages*/
459 UI_SMS_WAITING_FOR_TL_ACK,
460 UI_SMS_OUT_OF_RESOURCES,
461 UI_SMS_ACCESS_TOO_LARGE,
462 UI_SMS_DRC_TOO_LARGE,
463 UI_SMS_NETWORK_NOT_READY,
464 UI_SMS_PHONE_NOT_READY,
465 UI_SMS_NOT_ALLOWED_IN_AMPS,
466 UI_SMS_INVALID_TRANSACTION,
467 UI_SMS_MESSAGE_NOT_SENT,
468 UI_SMS_MESSAGE_BEGIN_SENT,
469 UI_SMS_MAX_NUMBER_OF_DESTINATIONS_IS_10,
470 UI_SMS_MESSAGE_DELIVERY_FAILED
471} ValSmsEtsStatT;
472
473/* VAL_SMS_GET_COUNT_MSG */
474typedef struct
475{
476 kal_uint8 Storage;
477} ValSmsEtsGetCountMsgT;
478
479typedef struct
480{
481 kal_uint32 MsgCount[NUM_ETS_SMS_BOX];
482} ValSmsEtsGetCountRspMsgT;
483
484/* VAL_SMS_GET_FIRST_MSG */
485typedef struct
486{
487 kal_uint8 Type;
488 kal_uint8 Storage;
489} ValSmsEtsGetFirstMsgT;
490
491typedef struct
492{
493 kal_uint8 Status;
494 kal_uint8 Type;
495 kal_uint8 Storage;
496 kal_uint16 Index;
497 kal_uint8 EmsFlag;
498 kal_uint8 EmsSegment;
499 kal_uint8 EmsLast;
500 kal_uint8 PhbType;
501 kal_uint8 PhbByteCount;
502 kal_uint8 Pb_Pdu_data[1];
503} ValSmsEtsGetMsgRspMsgT;
504
505/* VAL_SMS_GET_NEXT_MSG */
506
507/* VAL_SMS_WRITE_MSG */
508typedef struct
509{
510 kal_uint8 Type;
511 kal_uint8 Storage;
512 kal_uint16 Index; /* for EMS only? */
513 kal_uint8 EmsFlag;
514 kal_uint8 EmsSegment;
515 kal_uint8 EmsLast;
516 kal_uint8 pdu_len;
517 kal_uint8 Pdu[VAL_SMS_MAX_SMS_PDU_LEN];
518} ValSmsEtsWriteMsgT;
519
520typedef struct
521{
522 kal_uint8 Status;
523 kal_uint8 Storage;
524 kal_uint16 Index;
525 kal_uint8 EmsSegment;
526 kal_uint16 RefNum;
527} ValSmsEtsWriteRspMsgT;
528
529/* VAL_SMS_DEL_ALL_MSG */
530typedef struct
531{
532 kal_uint8 Type;
533 kal_uint8 Storage;
534} ValSmsEtsDelAllMsgT;
535
536typedef struct
537{
538 kal_uint8 Status;
539 kal_uint8 Type;
540 kal_uint8 Storage;
541} ValSmsEtsDelAllRspMsgT;
542
543/* VAL_SMS_DEL_MSG */
544typedef struct
545{
546 kal_uint16 Index;
547 kal_uint8 Storage;
548} ValSmsEtsDelMsgT;
549
550typedef struct
551{
552 kal_uint8 Status;
553 kal_uint16 Index;
554 kal_uint8 Storage;
555} ValSmsEtsDelRspMsgT;
556
557/* VAL_SMS_SEND_MSG */
558typedef struct
559{
560 kal_uint8 Storage;
561 kal_uint16 Index; /* for EMS only? */
562 kal_uint8 EmsFlag;
563 kal_uint8 EmsSegment;
564 kal_uint8 EmsLast;
565 kal_uint8 Save;
566 kal_uint8 Confirmation;
567 kal_uint8 pdu_len;
568 kal_uint8 Pdu[VAL_SMS_MAX_SMS_PDU_LEN];
569} ValSmsEtsSendMsgT;
570
571typedef struct
572{
573 kal_uint8 Status;
574 kal_uint8 Storage;
575 kal_uint16 Index;
576 kal_uint8 EmsSegment;
577 kal_uint16 RefNum;
578 kal_uint8 ErrorClass;
579} ValSmsEtsSendRspMsgT;
580
581/* VAL_SMS_SEND_INDEX_MSG */
582typedef struct
583{
584 kal_uint8 Storage;
585 kal_uint16 Index;
586 kal_uint8 Save;
587 kal_uint8 Confirmation;
588} ValSmsEtsSendIndexMsgT;
589
590typedef struct
591{
592 kal_uint8 Status;
593 kal_uint8 Storage;
594 kal_uint16 Index;
595} ValSmsEtsSendIndexRspMsgT;
596
597/* VAL_SMS_SET_STATUS_MSG */
598typedef struct
599{
600 kal_uint8 Storage;
601 kal_uint16 Index;
602 kal_bool Read;
603} ValSmsEtsSetStatusMsgT;
604
605typedef struct
606{
607 kal_uint8 Status;
608 kal_uint8 Storage;
609 kal_uint16 Index;
610} ValSmsEtsSetStatusRspMsgT;
611
612/* VAL_SMS_SPY_MSG */
613typedef struct
614{
615 kal_uint8 Event;
616 kal_uint8 Storage;
617 kal_uint16 Index;
618} ValSmsEtsSpyMsgT;
619
620#ifdef MTK_CBP_ENCRYPT_VOICE
621typedef struct
622{
623 kal_uint8 len;
624 kal_uint8 CallNum[NUMBER_MAX_LEN];
625} ValSmsMocKeyReqMsgT;
626typedef struct
627{
628 kal_uint8 OpType;
629 kal_uint8 Result;
630} ValSmsRemoteCtrlInsRspMsgT;
631
632typedef ValSmsRemoteCtrlInsRspMsgT ValEncrySmsRemoteCtrlInsRspMsgT;
633
634typedef struct
635{
636 kal_uint8 len;
637 kal_uint8 CallNum[NUMBER_MAX_LEN];
638} ValMtEncryptNotificationIndMsgT;
639
640typedef struct
641{
642 kal_uint8 keyReqtype;/*1 MO,0 MT*/
643 kal_uint8 mode; /*0: MANUAL,1: auto*/
644 kal_uint8 calledNum[NUMBER_MAX_LEN];/*number ,max =11*/
645 kal_uint8 calledBytes;
646} ValSmsEncryKeyReqMsgT;
647
648typedef struct
649{
650 kal_uint8 mode;/*1 MO,0 MT*/
651} ValSmsModuleClearContextMsgT;
652
653#endif
654
655
656typedef struct {
657 kal_uint8 sms_format; /* reply sequence used in bearer reply opt */
658 kal_uint8 sms_status;
659 kal_uint16 msg_id;
660 kal_uint8 seq_id; /* SMS sequence Number */
661 kal_bool is_used;
662 kal_uint8 pduLen;
663 kal_uint8 *pduPt;
664} ValSmsTransAseT;
665
666typedef struct {
667 kal_uint16 msg_id;
668 kal_uint16 seq_id;
669 kal_bool is_used;
670} ValSmsIdPairT;
671#if (defined MTK_DEV_CCCI_FS) || (defined MTK_PLT_ON_PC_UT)
672void valsmsDbmResponse(ilm_struct* current_ilm);
673#endif
674
675typedef PACKED_PREFIX struct {
676
677 kal_uint8 send_over_ims_cs;
678 kal_uint16 length;
679 kal_uint8 pdu[VAL_SMS_MAX_SMS_PDU_LEN];
680 kal_bool is_no_error; //KAL_TRUE: no error, KAL_FALSE: has error
681} PACKED_POSTFIX ValC2kSmsRspT;
682
683typedef PACKED_PREFIX struct {
684 kal_uint16 length;
685 kal_uint8 pdu[VAL_SMS_MAX_SMS_PDU_LEN];
686} PACKED_POSTFIX SdmValC2kSmsSendReqT ;
687
688/* MSG_ID_IMCSMS_VAL_C2K_SMS_SEND_REQ */
689typedef PACKED_PREFIX struct {
690 kal_uint16 length;
691 kal_uint8 data[VAL_SMS_MAX_SMS_PDU_LEN];
692} PACKED_POSTFIX ImcValC2kSmsSendReqT;
693
694typedef struct {
695 kal_uint16 length;
696 kal_uint8 pdu[MAX_C2K_SMS_PDU_LEN];
697 c2k_sms_rat_enum send_over_ims_cs;
698} SdmCvalC2kSmsSendReqT;
699
700typedef struct{
701 kal_uint16 length;
702 kal_uint8 data[MAX_C2K_SMS_PDU_LEN];
703} ImcsmsCvalC2kSmsSendReqT;
704
705typedef struct{
706 kal_uint16 length;
707 kal_uint8 data[MAX_C2K_SMS_PDU_LEN];
708} ImcsmsCvalC2kSmsRecvReqT;
709
710typedef struct
711{
712 kal_uint16 msg_id;
713 kal_uint16 pdulen;
714 kal_uint8 pdumsg[VAL_SMS_MAX_SMS_PDU_LEN];
715} ValSmsSdmSendReqPendingInfoT;
716
717typedef struct {
718 LOCAL_PARA_HDR
719 kal_uint8 src_id; /* Required for L4C*/
720 l4_addr_bcd_struct tel_number; /* The telephone number to be approved*/
721 kal_uint8 is_retrieve; /* Whether retrieving the hit entry of the given number is required*/
722 l4c_phb_approval_type_enum approval_type; /* l4c_phb_approval_type_enum */
723} l4cphb_approve_req_struct;
724
725typedef struct {
726 kal_uint8 src_id; /* The `src_id' of the corresponding reqest is forwarded back in this field.*/
727 phb_errno_enum result; /* phb_errno_enum; Operation result*/
728 kal_uint16 cause;
729 phb_type_enum type; /* phb_type_enum; Type of phone number entries*/
730 kal_uint8 esc;
731} l4cphbapprovecnftT;
732
733typedef struct {
734 c2k_sms_rat_enum send_over_ims_cs;
735 kal_uint16 length;
736 kal_uint8 pdu[MAX_C2K_SMS_PDU_LEN];
737 kal_bool is_no_error; //KAL_TRUE: no error, KAL_FALSE: has error
738} SdmCvalC2kSmsRspT;
739
740
741/*****************************************************************************
742
743 FUNCTION NAME: ValSmsGetStorParams
744
745 DESCRIPTION:
746
747 To get current storage memory statue parameters.
748
749 PARAMETERS:
750
751 pSmsStorParams: the buffer where to write the ValSmsStorParamsT info back
752
753 RETURNED VALUES:
754 success is true.failed is false
755
756*****************************************************************************/
757kal_bool ValSmsGetStorParams( ValSmsStorParamsT* pSmsStorParams );
758
759/*! Macro for valid sms service option */
760#define IS_VALID_SMS_SO(a) (((a) == 0) || ((a) == VAL_SERVICE_OPTION_6) || ((a) == VAL_SERVICE_OPTION_14))
761
762void ValSmsInitUimSms( void );
763void ValSmsInit( void );
764kal_bool ValSmsProcessMsg( kal_uint32 MsgId, void *MsgBufP, kal_uint32 MsgLen );
765void ValSmsSendCbsCfgToPsw(ValSmsCbsInfoT* CbsInfo);
766
767RegIdT ValSmsRegister( ValSmsEventFunc CallBack );
768//don't modify following Function, brew has referred to it
769ValSmsResultT ValSmsUnregister( RegIdT RegId );
770ValSmsResultT ValSmsStartRegSrv( RegIdT RegId, ValSmsTeleSrvIdT TeleSrvId);
771ValSmsResultT ValSmsStopRegSrv( RegIdT RegId, ValSmsTeleSrvIdT TeleId );
772
773//don't modify following Function, brew has referred to it
774kal_bool ValSmsGetSmsStatus( void );
775void ValSmsSetSmsStatus(kal_bool Flg);
776
777void ValSmsSetSendOnTraffic( kal_bool sendOnTraffic );
778ValSmsResultT ValSmsSetPrefSvcOpt( ValServiceOptionT SmsSo );
779ValSmsResultT ValSmsSetBroadcastParams( kal_uint32 SvcMask, kal_uint32 LangMask, kal_uint8 Priority );
780ValSmsResultT ValSmsUpdateTxtMessage(ValSmsTxtRecordT *pSmsTxtMsg,kal_uint16 recId);
781ValSmsResultT ValSmsUpdatePduMessage(ValSmsPduRecordT *pSmsRecord,kal_uint16 recId);
782ValSmsResultT ValSmsReadTxtMessage(ValSmsTxtRecordT *pSmsMessage,kal_uint16 recId);
783ValSmsResultT ValSmsReadPduMessage(ValSmsPduRecordT *pSmsRecord,kal_uint16 recId);
784
785#ifdef SYS_OPTION_NO_UI
786ValSmsResultT ValSmsSendPduMessage( RegIdT RegId, ValSmsRecIdT* recidP, kal_uint8* MsgBufP, kal_uint8 nbytes, kal_uint16* MsgId, kal_bool ToBeSave );
787ValSmsResultT ValSmsSendTxtMessage( RegIdT RegId, ValSmsRecIdT* recid, ValSmsTxtRecordT* SmsTxtMsgP, kal_uint16* MsgId, kal_bool ToBeSave);
788#else
789ValSmsResultT ValSmsSendPduMessage(RegIdT RegId, kal_uint8 *MsgBufP, kal_uint8 MsgLength);
790ValSmsResultT ValSmsSendTxtMessage(RegIdT RegId, ValSmsTxtRecordT *TxtRecord);
791#endif
792kal_bool ValSmsProcessMsg( kal_uint32 MsgId, void* MsgBuf, kal_uint32 MsgLen );
793void ValSmsSendAck(ValSmsResultT Result, kal_uint32 SeqNumber);
794
795ValSmsTeleSrvIdT ValSmsGetTeleSrvFromPdu(kal_uint8 *DataP, kal_uint8 Length);
796
797kal_bool CheckSmsPdu(kal_uint8 *ValSmsPduP, kal_uint8 Length);
798ValDeviceT ValSmsGetStorage( void );
799void ValSmsSetMultiSMSMode(kal_bool IsMultiSMS);
800
801int ValSmsSendMessage( ValSmsTxtRecordT *MessageP );
802
803
804
805#ifdef MTK_DEV_C2K_IRAT
806void valProcSdmC2kSmsSendReqMsg(kal_uint16 length,kal_uint8* pdu);
807void valProcSdmC2kSmsOverImsSendReqMsg(kal_uint16 length,kal_uint8 *pdu);
808void valProcImcsmsC2kSmsSendReqMsg(kal_uint16 length,kal_uint8 *pdu);
809void valProcSdmC2kSmsSendIndMsg(kal_uint8 format,kal_uint16 length,kal_uint8* pdu);
810void valProcSdmC2kSmsSendRspMsg(kal_uint8 send_over_ims_cs,kal_uint16 length,kal_uint8 *pdu);
811void valProcSdmC2kSmsRspMsg(SdmCvalC2kSmsRspT* pValSmsRsp);
812void valProcUiccPPdownLoadRspMsg(kal_uint8 *pdu,kal_uint8 length,kal_uint8 seq_id);
813void valPreProcPPdownloadMsg(kal_uint8 *pdu,kal_uint8 length,kal_uint8 seq_id);
814void valProcUtkSmsMsg(kal_uint8 *pdu,kal_uint8 length);
815void valProcImcsmsC2kSmsRecvReqMsg(kal_uint16 length,kal_uint8 *data);
816void SendSmsAckForIms(kal_uint8 *ackPdu, kal_uint8 pduLen);
817
818#endif
819
820void CNMASendSMSMsg(kal_uint8 length, kal_uint8 *pduBuf,kal_uint16 seqNum);
821kal_bool ValSmsIsAddrE911(kal_uint8 *data, kal_uint16 length);
822
823#ifdef __cplusplus
824}
825#endif /* __cplusplus */
826
827
828#endif /* VALSMSAPI_H */
829
830
831