FreeCalypso > hg > fc-magnetite
comparison src/g23m-aci/aci/cmh_sss.c @ 162:53929b40109c
src/g23m-aci: initial import from TCS3.2/LoCosto
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Tue, 11 Oct 2016 02:02:43 +0000 |
| parents | |
| children | f65a4399093d |
comparison
equal
deleted
inserted
replaced
| 161:4557e2a9c18e | 162:53929b40109c |
|---|---|
| 1 /* | |
| 2 +----------------------------------------------------------------------------- | |
| 3 | Project : GSM-PS (6147) | |
| 4 | Modul : CMH_SSS | |
| 5 +----------------------------------------------------------------------------- | |
| 6 | Copyright 2002 Texas Instruments Berlin, AG | |
| 7 | All rights reserved. | |
| 8 | | |
| 9 | This file is confidential and a trade secret of Texas | |
| 10 | Instruments Berlin, AG | |
| 11 | The receipt of or possession of this file does not convey | |
| 12 | any rights to reproduce or disclose its contents or to | |
| 13 | manufacture, use, or sell anything it may describe, in | |
| 14 | whole, or in part, without the specific written consent of | |
| 15 | Texas Instruments Berlin, AG. | |
| 16 +----------------------------------------------------------------------------- | |
| 17 | Purpose : This module provides the set functions related to the | |
| 18 | protocol stack adapter for SS. | |
| 19 +----------------------------------------------------------------------------- | |
| 20 */ | |
| 21 | |
| 22 #ifndef CMH_SSS_C | |
| 23 #define CMH_SSS_C | |
| 24 #endif | |
| 25 | |
| 26 #include "aci_all.h" | |
| 27 /*==== INCLUDES ===================================================*/ | |
| 28 #include "aci.h" | |
| 29 #include "aci_cmh.h" | |
| 30 | |
| 31 #ifdef FAX_AND_DATA | |
| 32 #include "aci_fd.h" | |
| 33 #endif /* of #ifdef FAX_AND_DATA */ | |
| 34 | |
| 35 #ifdef UART | |
| 36 #include "dti.h" | |
| 37 #include "dti_conn_mng.h" | |
| 38 #endif | |
| 39 | |
| 40 #include "ksd.h" | |
| 41 #include "psa.h" | |
| 42 #include "psa_ss.h" | |
| 43 #include "psa_sim.h" | |
| 44 #include "psa_sms.h" | |
| 45 #include "psa_cc.h" | |
| 46 #include "cmh.h" | |
| 47 #include "cmh_ss.h" | |
| 48 #include "cmh_sim.h" | |
| 49 #include "cmh_sms.h" | |
| 50 #include "cmh_cc.h" | |
| 51 | |
| 52 #ifdef SIM_TOOLKIT | |
| 53 #include "psa_cc.h" | |
| 54 #include "psa_sat.h" | |
| 55 #include "cmh_sat.h" | |
| 56 #include "ati_cmd.h" | |
| 57 #include "aci_cmd.h" | |
| 58 #include "cmh_cc.h" | |
| 59 #endif /* of SIM_TOOLKIT */ | |
| 60 | |
| 61 #include "psa_util.h" | |
| 62 #ifdef GPRS | |
| 63 #include "gaci_cmh.h" | |
| 64 #endif /* GPRS */ | |
| 65 #include "phb.h" | |
| 66 | |
| 67 | |
| 68 #include "aci_ext_pers.h" | |
| 69 #include "aci_slock.h" | |
| 70 | |
| 71 #ifdef SIM_PERS | |
| 72 #include "general.h" // inluded for UINT8 compilation error in sec_drv.h | |
| 73 #include "sec_drv.h" | |
| 74 | |
| 75 EXTERN T_SEC_DRV_CONFIGURATION *cfg_data; | |
| 76 EXTERN T_SIM_MMI_INSERT_IND *last_sim_mmi_insert_ind; | |
| 77 #endif | |
| 78 | |
| 79 #ifdef FF_PHONE_LOCK | |
| 80 EXTERN T_OPER_RET_STATUS aci_ext_set_phone_lock_satus(T_SEC_DRV_EXT_PHONE_LOCK_TYPE type,T_SEC_DRV_EXT_PHONE_LOCK_STATUS status,const char *passwd); | |
| 81 EXTERN T_OPER_RET_STATUS aci_ext_set_phone_lock_key(const char *pOldKey,const char *pNewKey); | |
| 82 #endif | |
| 83 | |
| 84 #if defined (SIM_PERS) || defined (FF_PHONE_LOCK) | |
| 85 EXTERN T_ACI_RETURN cmhSS_check_oper_result(T_OPER_RET_STATUS result); | |
| 86 #endif | |
| 87 | |
| 88 /*==== CONSTANTS ==================================================*/ | |
| 89 #define AT_TOA_DEF_INT (129) /* toa default for international no.*/ | |
| 90 #define AT_TOA_DEF_NAT (145) /* toa default for national no.*/ | |
| 91 #define AT_TOS_DEF (128) /* tos default */ | |
| 92 #define AT_CFNRY_DEF_TIME (20) /* default no reply time */ | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 /*==== EXPORT =====================================================*/ | |
| 98 | |
| 99 /*==== VARIABLES ==================================================*/ | |
| 100 #ifdef TI_PS_FF_AT_P_CMD_CUSCFG | |
| 101 EXTERN T_ACI_CUSCFG_PARAMS cuscfgParams; | |
| 102 #endif | |
| 103 GLOBAL SHORT Ext_USSD_Res_Pending_sId; | |
| 104 GLOBAL T_CUSDR_EXT_USSD_RES Ext_USSD_Res_Pending = CUSDR_EXT_USSD_RES_Not_Pending; | |
| 105 | |
| 106 /*==== FUNCTIONS ==================================================*/ | |
| 107 | |
| 108 /* | |
| 109 +--------------------------------------------------------------------+ | |
| 110 | PROJECT : GSM-PS (6147) MODULE : CMH_SSS | | |
| 111 | STATE : code ROUTINE : sAT_PlusCCFC | | |
| 112 +--------------------------------------------------------------------+ | |
| 113 | |
| 114 PURPOSE : This is the functional counterpart to the +CCFC AT command | |
| 115 which is responsible to set the parameters for call | |
| 116 forwarding supplementary services. | |
| 117 | |
| 118 <reason> : reason for CF. | |
| 119 <mode> : CF mode. | |
| 120 <number> : number to be forwarded to. | |
| 121 <type> : type of number. | |
| 122 <class> : class of calls. | |
| 123 <subaddr>: subaddress of number. | |
| 124 <satype> : type of subaddress. | |
| 125 <time> : no reply time. | |
| 126 */ | |
| 127 | |
| 128 GLOBAL T_ACI_RETURN sAT_PlusCCFC ( T_ACI_CMD_SRC srcId, | |
| 129 T_ACI_CCFC_RSN reason, | |
| 130 T_ACI_CCFC_MOD mode, | |
| 131 CHAR* number, | |
| 132 T_ACI_TOA* type, | |
| 133 T_ACI_CLASS class_type, | |
| 134 CHAR* subaddr, | |
| 135 T_ACI_TOS* satype, | |
| 136 SHORT time) | |
| 137 { | |
| 138 SHORT sId1, sId2; /* holds service id */ | |
| 139 UBYTE ssCd; /* holds ss code */ | |
| 140 UBYTE bst1, bst2; /* holds basic service type */ | |
| 141 UBYTE bs1, bs2; /* holds basic service */ | |
| 142 UBYTE ton, tos; /* holds type of number/subaddress */ | |
| 143 UBYTE npi, oe; /* holds numbering plan/odd.even indicator */ | |
| 144 BOOL mltyTrnFlg = FALSE; /* flags for multi transaction */ | |
| 145 T_CLPTY_PRM *ccfc_cldPty; | |
| 146 | |
| 147 #ifdef SIM_TOOLKIT | |
| 148 T_ACI_RETURN retVal; | |
| 149 #endif /* of SIM_TOOLKIT */ | |
| 150 | |
| 151 TRACE_FUNCTION ("sAT_PlusCCFC"); | |
| 152 | |
| 153 /* | |
| 154 *------------------------------------------------------------------- | |
| 155 * check command source | |
| 156 *------------------------------------------------------------------- | |
| 157 */ | |
| 158 if(!cmh_IsVldCmdSrc (srcId)) | |
| 159 { | |
| 160 return( AT_FAIL ); | |
| 161 } | |
| 162 | |
| 163 if( cmhPrm[srcId].ssCmdPrm.mltyTrnFlg NEQ 0 ) | |
| 164 { | |
| 165 TRACE_EVENT("ssCmdPrm.mltyTrnFlg NEQ 0 !!! CCFC busy"); | |
| 166 return( AT_BUSY ); | |
| 167 } | |
| 168 | |
| 169 /* | |
| 170 *------------------------------------------------------------------- | |
| 171 * check parameter <time> | |
| 172 *------------------------------------------------------------------- | |
| 173 */ | |
| 174 if( time EQ ACI_NumParmNotPresent ) | |
| 175 { | |
| 176 time = AT_CFNRY_DEF_TIME; | |
| 177 } | |
| 178 else if (time < CCFC_TIME_MIN AND time >= 1) | |
| 179 { | |
| 180 /* 07.07 allows [1...30] for time while | |
| 181 09.02 allows [5...30]. So map [1..4] to 5 */ | |
| 182 time = CCFC_TIME_MIN; | |
| 183 } | |
| 184 else if( time > CCFC_TIME_MAX OR time < CCFC_TIME_MIN ) | |
| 185 { | |
| 186 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
| 187 return( AT_FAIL ); | |
| 188 } | |
| 189 | |
| 190 /* Implements Measure # 85 */ | |
| 191 if(!cmhSS_checkCCFC_RSN(reason, &ssCd)) | |
| 192 { | |
| 193 return( AT_FAIL ); | |
| 194 } | |
| 195 /* | |
| 196 *------------------------------------------------------------------- | |
| 197 * check parameter <class> | |
| 198 *------------------------------------------------------------------- | |
| 199 */ | |
| 200 if( !cmhSS_CheckClass( class_type, &bs1, &bst1, &bs2, &bst2, &mltyTrnFlg )) | |
| 201 { | |
| 202 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
| 203 return( AT_FAIL ); | |
| 204 } | |
| 205 | |
| 206 /* SIM TOOLKIT & FDN HANDLING */ | |
| 207 | |
| 208 retVal = cmhSS_CF_SAT_Handle( srcId, reason, mode, number, type, class_type, subaddr, satype, time); | |
| 209 | |
| 210 if( retVal NEQ AT_CMPL ) | |
| 211 return( retVal ); | |
| 212 | |
| 213 | |
| 214 | |
| 215 | |
| 216 | |
| 217 /* | |
| 218 *------------------------------------------------------------------- | |
| 219 * check parameter <class> against possible ALS-Lock | |
| 220 *------------------------------------------------------------------- | |
| 221 */ | |
| 222 if ((ALSlock EQ ALS_MOD_SPEECH AND class_type EQ CLASS_AuxVce) OR | |
| 223 (ALSlock EQ ALS_MOD_AUX_SPEECH AND class_type NEQ CLASS_AuxVce)) | |
| 224 { | |
| 225 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_AlsLock ); | |
| 226 return( AT_FAIL ); | |
| 227 } | |
| 228 | |
| 229 /* | |
| 230 *------------------------------------------------------------------- | |
| 231 * get a new service table entry | |
| 232 *------------------------------------------------------------------- | |
| 233 */ | |
| 234 sId1 = psaSS_stbNewEntry(); | |
| 235 | |
| 236 if( sId1 EQ NO_ENTRY ) | |
| 237 { | |
| 238 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_SrvTabFull ); | |
| 239 return( AT_FAIL ); | |
| 240 } | |
| 241 | |
| 242 sId2 = NO_ENTRY; | |
| 243 | |
| 244 if( mltyTrnFlg ) | |
| 245 { | |
| 246 ssShrdPrm.stb[sId1].ntryUsdFlg = TRUE; | |
| 247 | |
| 248 sId2 = psaSS_stbNewEntry(); | |
| 249 | |
| 250 if( sId2 EQ NO_ENTRY ) | |
| 251 { | |
| 252 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_SrvTabFull ); | |
| 253 return( AT_FAIL ); | |
| 254 } | |
| 255 } | |
| 256 | |
| 257 /* | |
| 258 *------------------------------------------------------------------- | |
| 259 * check parameter <mode> | |
| 260 *------------------------------------------------------------------- | |
| 261 */ | |
| 262 switch( mode ) | |
| 263 { | |
| 264 /* | |
| 265 *--------------------------------------------------------------- | |
| 266 * enable, disable and erase call forwarding service | |
| 267 *--------------------------------------------------------------- | |
| 268 */ | |
| 269 case( CCFC_MOD_Disable ): | |
| 270 case( CCFC_MOD_Enable ): | |
| 271 case( CCFC_MOD_Erasure ): | |
| 272 | |
| 273 CCD_START; | |
| 274 | |
| 275 if( mode EQ CCFC_MOD_Disable ) | |
| 276 psaSS_asmDeactivateSS( ssCd, bst1, bs1 ); | |
| 277 | |
| 278 else if( mode EQ CCFC_MOD_Enable ) | |
| 279 psaSS_asmActivateSS( ssCd, bst1, bs1 ); | |
| 280 | |
| 281 else if( mode EQ CCFC_MOD_Erasure ) | |
| 282 psaSS_asmEraseSS( ssCd, bst1, bs1 ); | |
| 283 | |
| 284 ssShrdPrm.stb[sId1].ntryUsdFlg = TRUE; | |
| 285 ssShrdPrm.stb[sId1].ssCode = ssCd; | |
| 286 ssShrdPrm.stb[sId1].srvOwn = (T_OWN)srcId; | |
| 287 ssShrdPrm.stb[sId1].ClassType = class_type; /* the complete classes defined by the user */ | |
| 288 | |
| 289 /* start first transaction */ | |
| 290 ssShrdPrm.stb[sId1].curCmd = AT_CMD_CCFC; | |
| 291 | |
| 292 cmhSS_flagTrn( sId1, &(cmhPrm[srcId].ssCmdPrm.mltyTrnFlg)); | |
| 293 psaSS_NewTrns(sId1); | |
| 294 | |
| 295 if( mltyTrnFlg ) | |
| 296 { | |
| 297 if( mode EQ CCFC_MOD_Disable ) | |
| 298 psaSS_asmDeactivateSS( ssCd, bst2, bs2 ); | |
| 299 | |
| 300 else if( mode EQ CCFC_MOD_Enable ) | |
| 301 psaSS_asmActivateSS( ssCd, bst2, bs2 ); | |
| 302 | |
| 303 else if( mode EQ CCFC_MOD_Erasure ) | |
| 304 psaSS_asmEraseSS( ssCd, bst2, bs2 ); | |
| 305 | |
| 306 ssShrdPrm.stb[sId2].ntryUsdFlg = TRUE; | |
| 307 ssShrdPrm.stb[sId2].ssCode = ssCd; | |
| 308 ssShrdPrm.stb[sId2].srvOwn = (T_OWN)srcId; | |
| 309 ssShrdPrm.stb[sId2].ClassType =class_type; /* the complete classes defined by the user */ | |
| 310 | |
| 311 /* start second transaction */ | |
| 312 ssShrdPrm.stb[sId2].curCmd = AT_CMD_CCFC; | |
| 313 | |
| 314 cmhSS_flagTrn( sId2, &(ssShrdPrm.mltyTrnFlg)); /* only for the second one */ | |
| 315 cmhSS_flagTrn( sId2, &(cmhPrm[srcId].ssCmdPrm.mltyTrnFlg)); | |
| 316 | |
| 317 psaSS_NewTrns(sId2); | |
| 318 } | |
| 319 | |
| 320 CCD_END; | |
| 321 break; | |
| 322 | |
| 323 /* | |
| 324 *--------------------------------------------------------------- | |
| 325 * register call forwarding service | |
| 326 *--------------------------------------------------------------- | |
| 327 */ | |
| 328 case( CCFC_MOD_Register ): | |
| 329 | |
| 330 if(number EQ NULL) | |
| 331 { | |
| 332 TRACE_EVENT("ERROR: cannot register CCFC without a number"); | |
| 333 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
| 334 return( AT_FAIL ); | |
| 335 } | |
| 336 MALLOC(ccfc_cldPty, sizeof(T_CLPTY_PRM)); | |
| 337 cmhCC_init_cldPty( ccfc_cldPty ); | |
| 338 | |
| 339 cmh_bldCalPrms( number, ccfc_cldPty ); | |
| 340 | |
| 341 /* check for TOA default */ | |
| 342 if(type EQ NULL) | |
| 343 { | |
| 344 ton = ccfc_cldPty->ton; | |
| 345 npi = ccfc_cldPty->npi; | |
| 346 } | |
| 347 else if(type->ton EQ TON_NotPresent OR | |
| 348 type->npi EQ NPI_NotPresent) | |
| 349 { | |
| 350 ton = ccfc_cldPty->ton; | |
| 351 npi = ccfc_cldPty->npi; | |
| 352 } | |
| 353 else | |
| 354 { | |
| 355 ton = type->ton; | |
| 356 npi = type->npi; | |
| 357 } | |
| 358 | |
| 359 /* check for TOS default */ | |
| 360 if(satype EQ NULL) | |
| 361 { | |
| 362 tos = TOS_X213; | |
| 363 oe = OEI_EVEN; | |
| 364 } | |
| 365 else if(satype->tos EQ TOS_NotPresent OR | |
| 366 satype->oe EQ OE_NotPresent) | |
| 367 { | |
| 368 tos = TOS_X213; | |
| 369 oe = OEI_EVEN; | |
| 370 } | |
| 371 else | |
| 372 { | |
| 373 tos = satype -> tos; | |
| 374 oe = satype -> oe; | |
| 375 } | |
| 376 | |
| 377 if(subaddr EQ NULL AND | |
| 378 ccfc_cldPty->sub[0] NEQ 0) /* if not set by user AND number contained a subaddress */ | |
| 379 { | |
| 380 subaddr = (CHAR *)ccfc_cldPty->sub; | |
| 381 } | |
| 382 | |
| 383 CCD_START; | |
| 384 | |
| 385 psaSS_asmRegisterSS( ssCd, bst1, bs1, | |
| 386 ton, npi, (UBYTE*)ccfc_cldPty->num, tos, oe, (UBYTE *)subaddr, (UBYTE)time ); | |
| 387 | |
| 388 ssShrdPrm.stb[sId1].ntryUsdFlg = TRUE; | |
| 389 ssShrdPrm.stb[sId1].ssCode = ssCd; | |
| 390 ssShrdPrm.stb[sId1].srvOwn = (T_OWN)srcId; | |
| 391 | |
| 392 /* start first transaction */ | |
| 393 ssShrdPrm.stb[sId1].curCmd = AT_CMD_CCFC; | |
| 394 cmhSS_flagTrn( sId1, &(cmhPrm[srcId].ssCmdPrm.mltyTrnFlg)); | |
| 395 psaSS_NewTrns(sId1); | |
| 396 | |
| 397 if( mltyTrnFlg ) | |
| 398 { | |
| 399 psaSS_asmRegisterSS( ssCd, bst2, bs2, | |
| 400 ton, npi, (UBYTE*)ccfc_cldPty->num, tos, oe, (UBYTE *)subaddr, (UBYTE)time ); | |
| 401 | |
| 402 ssShrdPrm.stb[sId2].ntryUsdFlg = TRUE; | |
| 403 ssShrdPrm.stb[sId2].ssCode = ssCd; | |
| 404 ssShrdPrm.stb[sId2].srvOwn = (T_OWN)srcId; | |
| 405 | |
| 406 /* start second transaction */ | |
| 407 ssShrdPrm.stb[sId2].curCmd = AT_CMD_CCFC; | |
| 408 cmhSS_flagTrn( sId2, &(ssShrdPrm.mltyTrnFlg)); /* only for the second one */ | |
| 409 cmhSS_flagTrn( sId2, &(cmhPrm[srcId].ssCmdPrm.mltyTrnFlg)); | |
| 410 psaSS_NewTrns(sId2); | |
| 411 } | |
| 412 MFREE(ccfc_cldPty); | |
| 413 CCD_END; | |
| 414 break; | |
| 415 | |
| 416 /* | |
| 417 *--------------------------------------------------------------- | |
| 418 * unexpected mode | |
| 419 *--------------------------------------------------------------- | |
| 420 */ | |
| 421 case( CCFC_MOD_NotPresent ): | |
| 422 default: | |
| 423 | |
| 424 ssShrdPrm.stb[sId1].ntryUsdFlg = FALSE; | |
| 425 if( sId2 NEQ NO_ENTRY ) ssShrdPrm.stb[sId2].ntryUsdFlg = FALSE; | |
| 426 | |
| 427 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
| 428 return( AT_FAIL ); | |
| 429 } | |
| 430 | |
| 431 /* | |
| 432 *------------------------------------------------------------------- | |
| 433 * log command execution | |
| 434 *------------------------------------------------------------------- | |
| 435 */ | |
| 436 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
| 437 { | |
| 438 T_ACI_CLOG cmdLog; /* holds logging info */ | |
| 439 | |
| 440 cmdLog.atCmd = AT_CMD_CCFC; | |
| 441 cmdLog.cmdType = CLOG_TYPE_Set; | |
| 442 cmdLog.retCode = AT_EXCT; | |
| 443 cmdLog.cId = ACI_NumParmNotPresent; | |
| 444 cmdLog.sId = sId1+1; | |
| 445 cmdLog.cmdPrm.sCCFC.srcId = srcId; | |
| 446 cmdLog.cmdPrm.sCCFC.reason = reason; | |
| 447 cmdLog.cmdPrm.sCCFC.mode = mode; | |
| 448 cmdLog.cmdPrm.sCCFC.number = number; | |
| 449 cmdLog.cmdPrm.sCCFC.type = type; | |
| 450 cmdLog.cmdPrm.sCCFC.class_type = class_type; | |
| 451 cmdLog.cmdPrm.sCCFC.subaddr = subaddr; | |
| 452 cmdLog.cmdPrm.sCCFC.satype = satype; | |
| 453 cmdLog.cmdPrm.sCCFC.time = time; | |
| 454 | |
| 455 rAT_PercentCLOG( &cmdLog ); | |
| 456 } | |
| 457 #endif | |
| 458 | |
| 459 return( AT_EXCT ); | |
| 460 } | |
| 461 | |
| 462 /* | |
| 463 +--------------------------------------------------------------------+ | |
| 464 | PROJECT : GSM-PS (6147) MODULE : CMH_SSS | | |
| 465 | STATE : code ROUTINE : sAT_PlusCLCK | | |
| 466 +--------------------------------------------------------------------+ | |
| 467 | |
| 468 PURPOSE : This is the functional counterpart to the +CLCK AT command | |
| 469 which is responsible to set the parameters for call | |
| 470 barring supplementary services. | |
| 471 | |
| 472 <fac> : CB facility. | |
| 473 <mode> : CB mode. | |
| 474 <passwd> : password for CB facility. | |
| 475 <class_type>: class of calls. | |
| 476 */ | |
| 477 LOCAL BOOL check_sat_cb_pwd_required(UBYTE ssCd, CHAR *passwd) | |
| 478 { | |
| 479 #ifdef SIM_TOOLKIT | |
| 480 SHORT ss_id = NO_ENTRY; | |
| 481 T_OWN owner; | |
| 482 | |
| 483 /* Special case: there was an SS (by STK) transaction running. | |
| 484 It returned get password, handle the password for this transaction */ | |
| 485 | |
| 486 TRACE_FUNCTION ("check_sat_ss_pwd_required ()"); | |
| 487 | |
| 488 /* satShrdPrm.sId_pwd_requested will be reset by any mnss_end_ind | |
| 489 to be sure it has been reset. | |
| 490 This means: user has to give password right after error has been | |
| 491 shown. */ | |
| 492 ss_id = satShrdPrm.sId_pwd_requested; | |
| 493 if( ss_id EQ NO_ENTRY) | |
| 494 { | |
| 495 return(FALSE); | |
| 496 } | |
| 497 | |
| 498 if( ssShrdPrm.stb[ss_id].srvOwn NEQ OWN_SRC_SAT ) | |
| 499 { | |
| 500 satShrdPrm.sId_pwd_requested = NO_ENTRY; | |
| 501 return(FALSE); | |
| 502 } | |
| 503 TRACE_EVENT("Password required during a SAT session"); | |
| 504 | |
| 505 if( ssShrdPrm.stb[ss_id].curCmd NEQ ((T_ACI_AT_CMD)KSD_CMD_CB) ) | |
| 506 { | |
| 507 TRACE_EVENT_P1("Wrong command context: %d", ssShrdPrm.stb[ss_id].curCmd); | |
| 508 satShrdPrm.sId_pwd_requested = NO_ENTRY; | |
| 509 return(FALSE); | |
| 510 } | |
| 511 owner = ssShrdPrm.stb[ss_id].srvOwn; | |
| 512 | |
| 513 if(ssShrdPrm.stb[ss_id].ssCode EQ ssCd) | |
| 514 { | |
| 515 /* store for later use (as usual)*/ | |
| 516 strncpy | |
| 517 ( | |
| 518 (char *) cmhPrm[owner].ssCmdPrm.CXXXpwd, | |
| 519 (char *) passwd, | |
| 520 MAX_PWD_NUM | |
| 521 ); | |
| 522 cmhPrm[owner].ssCmdPrm.CXXXpwd[MAX_PWD_NUM] = '\0'; | |
| 523 psaSS_asmVerifyPWD( cmhPrm[owner].ssCmdPrm.CXXXpwd); | |
| 524 psaSS_CntTrns(ss_id); | |
| 525 satShrdPrm.sId_pwd_requested = NO_ENTRY; | |
| 526 return(TRUE); /* as pwd only needed for SAT session*/ | |
| 527 } | |
| 528 else | |
| 529 { | |
| 530 TRACE_EVENT_P1("Wrong Service type: %d", ssCd); | |
| 531 } | |
| 532 satShrdPrm.sId_pwd_requested = NO_ENTRY; | |
| 533 #endif /* SIM_TOOLKIT */ | |
| 534 return(FALSE); | |
| 535 } | |
| 536 | |
| 537 /* | |
| 538 +------------------------------------------------------------------------------ | |
| 539 | Function : sAT_PlusCLCK | |
| 540 +------------------------------------------------------------------------------ | |
| 541 | Description : This is the functional counterpart to the +CLCK AT command | |
| 542 | which is responsible to set the parameters for call | |
| 543 | barring supplementary services. also fo locking and unlocking ME for categories | |
| 544 | Networl lock, Network Subset lock, Service Provider Lock, Corporate Lock, SIM Lock | |
| 545 | | |
| 546 | Parameters : <fac> : CB facility. | |
| 547 | <mode> : CB mode. | |
| 548 | <passwd> : password for CB facility. | |
| 549 | <class_type>: class of calls. | |
| 550 | | |
| 551 | Return : AT_FAIL - execution of command failed | |
| 552 | AT_CMPL - execution of command completed | |
| 553 | AT_EXCT - execution of command is in progress | |
| 554 | AT_BUSY - execution of command is rejected due | |
| 555 | | |
| 556 +------------------------------------------------------------------------------ | |
| 557 */ | |
| 558 | |
| 559 GLOBAL T_ACI_RETURN sAT_PlusCLCK ( T_ACI_CMD_SRC srcId, | |
| 560 T_ACI_FAC fac, | |
| 561 T_ACI_CLCK_MOD mode, | |
| 562 CHAR * passwd, | |
| 563 T_ACI_CLASS class_type) | |
| 564 { | |
| 565 SHORT sId1, sId2; /* holds service id */ | |
| 566 UBYTE ssCd; /* holds ss code */ | |
| 567 UBYTE bst1, bst2; /* holds basic service type */ | |
| 568 UBYTE bs1, bs2; /* holds basic service */ | |
| 569 BOOL mltyTrnFlg = FALSE; /* flags for multi transaction */ | |
| 570 #ifdef SIM_PERS | |
| 571 T_SIMLOCK_TYPE slocktype; | |
| 572 T_SIMLOCK_STATUS rlockstatus; | |
| 573 #endif | |
| 574 SHORT psasim_ret; | |
| 575 BOOL done = FALSE; | |
| 576 #ifdef SIM_PERS | |
| 577 T_ACI_CME_ERR err_code = CME_ERR_NotPresent; /* code holding the correct error code calculated */ | |
| 578 UBYTE cmdBuf; /* buffers current command */ | |
| 579 #endif | |
| 580 #ifdef SIM_PERS | |
| 581 T_OPER_RET_STATUS fcResetStat; /*holds Failure Counter Reset Return Status Introduced on 11/03/2005*/ | |
| 582 T_OPER_RET_STATUS masterunlockStat; | |
| 583 T_SIMLOCK_STATUS retSlStatus; /* holds return code */ | |
| 584 #endif | |
| 585 #ifdef FF_PHONE_LOCK | |
| 586 T_OPER_RET_STATUS phone_lock_oper_ret_stat; | |
| 587 #endif | |
| 588 T_ACI_RETURN retVal; | |
| 589 | |
| 590 TRACE_FUNCTION ("sAT_PlusCLCK ()"); | |
| 591 | |
| 592 /* | |
| 593 *------------------------------------------------------------------- | |
| 594 * check command source | |
| 595 *------------------------------------------------------------------- | |
| 596 */ | |
| 597 if(!cmh_IsVldCmdSrc (srcId)) | |
| 598 { | |
| 599 return( AT_FAIL ); | |
| 600 } | |
| 601 | |
| 602 /* | |
| 603 *------------------------------------------------------------------- | |
| 604 * check parameter <fac> | |
| 605 *------------------------------------------------------------------- | |
| 606 */ | |
| 607 /* Implements Measure # 166 */ | |
| 608 #ifdef SIM_PERS | |
| 609 if((fac EQ FAC_Fc) OR ( fac EQ FAC_Fcm) OR ( fac EQ FAC_Mu) OR (fac EQ FAC_Mum)) | |
| 610 { | |
| 611 ssCd = NOT_PRESENT_8BIT; | |
| 612 } | |
| 613 else | |
| 614 #endif | |
| 615 if( !cmhSS_getSSCd(fac, &ssCd) ) | |
| 616 { | |
| 617 return( AT_FAIL ); | |
| 618 } | |
| 619 /* | |
| 620 *------------------------------------------------------------------- | |
| 621 * if action is related to SS | |
| 622 *------------------------------------------------------------------- | |
| 623 */ | |
| 624 if( ssCd NEQ NOT_PRESENT_8BIT ) | |
| 625 { | |
| 626 /* | |
| 627 *------------------------------------------------------------------- | |
| 628 * check parameter <passwd> | |
| 629 *------------------------------------------------------------------- | |
| 630 */ | |
| 631 if( passwd AND strlen( passwd ) > MAX_PWD_NUM ) | |
| 632 { | |
| 633 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
| 634 return( AT_FAIL ); | |
| 635 } | |
| 636 | |
| 637 /* | |
| 638 *------------------------------------------------------------------- | |
| 639 * check parameter <class> | |
| 640 *------------------------------------------------------------------- | |
| 641 */ | |
| 642 if( !cmhSS_CheckCbClass( class_type, &bs1, &bst1, &bs2, &bst2, &mltyTrnFlg )) | |
| 643 { | |
| 644 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow ); | |
| 645 return( AT_FAIL ); | |
| 646 } | |
| 647 | |
| 648 if( cmhPrm[srcId].ssCmdPrm.mltyTrnFlg NEQ 0 ) | |
| 649 return( AT_BUSY ); | |
| 650 | |
| 651 /* | |
| 652 *------------------------------------------------------------------- | |
| 653 * check combination of <mode> and <fac> | |
| 654 *------------------------------------------------------------------- | |
| 655 */ | |
| 656 if((fac EQ FAC_Ab OR fac EQ FAC_Ag OR fac EQ FAC_Ac) | |
| 657 AND mode NEQ CLCK_MOD_Unlock ) | |
| 658 { | |
| 659 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow ); | |
| 660 return( AT_FAIL ); | |
| 661 } | |
| 662 | |
| 663 /*** Shangai's labs tessession fix: adapted to this version from 1.3.3 (TCS 2.0) ****/ | |
| 664 /* Special case: there was an SS (by STK) transaction running. | |
| 665 It returned get password, handle the password for this transaction */ | |
| 666 done = check_sat_cb_pwd_required(ssCd, passwd); | |
| 667 if(done) | |
| 668 { | |
| 669 return(AT_CMPL); /* as pwd only needed for SAT session*/ | |
| 670 } | |
| 671 /* End fix */ | |
| 672 | |
| 673 | |
| 674 /* SIM TOOLKIT & FDN HANDLING */ | |
| 675 retVal = cmhSS_Call_Barr_SAT_Handle( srcId, mode, fac, passwd, class_type); | |
| 676 | |
| 677 if( retVal NEQ AT_CMPL ) | |
| 678 return( retVal ); | |
| 679 | |
| 680 /* | |
| 681 *------------------------------------------------------------------- | |
| 682 * get a new service table entry | |
| 683 *------------------------------------------------------------------- | |
| 684 */ | |
| 685 sId1 = psaSS_stbNewEntry(); | |
| 686 | |
| 687 if( sId1 EQ NO_ENTRY ) | |
| 688 { | |
| 689 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_SrvTabFull ); | |
| 690 return( AT_FAIL ); | |
| 691 } | |
| 692 | |
| 693 sId2 = NO_ENTRY; | |
| 694 | |
| 695 if( mltyTrnFlg ) | |
| 696 { | |
| 697 ssShrdPrm.stb[sId1].ntryUsdFlg = TRUE; | |
| 698 sId2 = psaSS_stbNewEntry(); | |
| 699 | |
| 700 if( sId2 EQ NO_ENTRY ) | |
| 701 { | |
| 702 ssShrdPrm.stb[sId1].ntryUsdFlg = FALSE; | |
| 703 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_SrvTabFull ); | |
| 704 return( AT_FAIL ); | |
| 705 } | |
| 706 } | |
| 707 | |
| 708 /* | |
| 709 *------------------------------------------------------------------- | |
| 710 * check parameter <mode> | |
| 711 *------------------------------------------------------------------- | |
| 712 */ | |
| 713 switch( mode ) | |
| 714 { | |
| 715 /* | |
| 716 *--------------------------------------------------------------- | |
| 717 * lock and unlock call barring service | |
| 718 *--------------------------------------------------------------- | |
| 719 */ | |
| 720 case( CLCK_MOD_Unlock ): | |
| 721 case( CLCK_MOD_Lock ): | |
| 722 | |
| 723 CCD_START; | |
| 724 | |
| 725 if( mode EQ CLCK_MOD_Unlock ) | |
| 726 psaSS_asmDeactivateSS( ssCd, bst1, bs1 ); | |
| 727 | |
| 728 else if( mode EQ CLCK_MOD_Lock ) | |
| 729 psaSS_asmActivateSS( ssCd, bst1, bs1 ); | |
| 730 | |
| 731 ssShrdPrm.stb[sId1].ntryUsdFlg = TRUE; | |
| 732 ssShrdPrm.stb[sId1].ssCode = ssCd; | |
| 733 ssShrdPrm.stb[sId1].srvOwn = (T_OWN)srcId; | |
| 734 | |
| 735 /* start first transaction */ | |
| 736 ssShrdPrm.stb[sId1].curCmd = AT_CMD_CLCK; | |
| 737 cmhSS_flagTrn( sId1, &(cmhPrm[srcId].ssCmdPrm.mltyTrnFlg)); | |
| 738 psaSS_NewTrns(sId1); | |
| 739 | |
| 740 if( mltyTrnFlg ) | |
| 741 { | |
| 742 if( mode EQ CLCK_MOD_Unlock ) | |
| 743 psaSS_asmDeactivateSS( ssCd, bst2, bs2 ); | |
| 744 | |
| 745 else if( mode EQ CLCK_MOD_Lock ) | |
| 746 psaSS_asmActivateSS( ssCd, bst2, bs2 ); | |
| 747 | |
| 748 ssShrdPrm.stb[sId2].ntryUsdFlg = TRUE; | |
| 749 ssShrdPrm.stb[sId2].ssCode = ssCd; | |
| 750 ssShrdPrm.stb[sId2].srvOwn = (T_OWN)srcId; | |
| 751 | |
| 752 /* start second transaction */ | |
| 753 ssShrdPrm.stb[sId2].curCmd = AT_CMD_CLCK; | |
| 754 cmhSS_flagTrn( sId2, &(ssShrdPrm.mltyTrnFlg)); /* only for the second one */ | |
| 755 cmhSS_flagTrn( sId2, &(cmhPrm[srcId].ssCmdPrm.mltyTrnFlg)); | |
| 756 psaSS_NewTrns(sId2); | |
| 757 } | |
| 758 CCD_END; | |
| 759 break; | |
| 760 | |
| 761 /* | |
| 762 *--------------------------------------------------------------- | |
| 763 * unexpected mode | |
| 764 *--------------------------------------------------------------- | |
| 765 */ | |
| 766 case( CLCK_MOD_NotPresent ): | |
| 767 default: | |
| 768 | |
| 769 ssShrdPrm.stb[sId1].ntryUsdFlg = FALSE; | |
| 770 if( sId2 NEQ NO_ENTRY ) ssShrdPrm.stb[sId2].ntryUsdFlg = FALSE; | |
| 771 | |
| 772 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
| 773 return( AT_FAIL ); | |
| 774 } | |
| 775 | |
| 776 /* | |
| 777 *------------------------------------------------------------------- | |
| 778 * store password for later use | |
| 779 *------------------------------------------------------------------- | |
| 780 */ | |
| 781 if( passwd ) | |
| 782 { | |
| 783 strncpy | |
| 784 ( | |
| 785 (char *) cmhPrm[srcId].ssCmdPrm.CXXXpwd, | |
| 786 (char *) passwd, | |
| 787 MAX_PWD_NUM | |
| 788 ); | |
| 789 cmhPrm[srcId].ssCmdPrm.CXXXpwd[MAX_PWD_NUM] = '\0'; | |
| 790 } | |
| 791 } | |
| 792 | |
| 793 /* | |
| 794 *------------------------------------------------------------------- | |
| 795 * if action is related to SIM | |
| 796 *------------------------------------------------------------------- | |
| 797 */ | |
| 798 else | |
| 799 { | |
| 800 if( simEntStat.curCmd NEQ AT_CMD_NONE ) | |
| 801 return( AT_BUSY ); | |
| 802 | |
| 803 switch (fac) | |
| 804 { | |
| 805 /* | |
| 806 *--------------------------------------------------------------- | |
| 807 * access PIN 1 | |
| 808 *--------------------------------------------------------------- | |
| 809 */ | |
| 810 case FAC_Sc: | |
| 811 switch( mode ) | |
| 812 { | |
| 813 case( CLCK_MOD_Unlock ): | |
| 814 case( CLCK_MOD_Lock ): | |
| 815 if (simShrdPrm.PINStat EQ PS_PUK1) | |
| 816 { | |
| 817 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_SimPukReq); | |
| 818 return( AT_FAIL ); | |
| 819 } | |
| 820 if (!psaSIM_ChkSIMSrvSup(SRV_CHV1_Disable)) | |
| 821 { | |
| 822 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow); | |
| 823 return( AT_FAIL ); | |
| 824 } | |
| 825 if( !passwd OR (strlen( passwd ) > PIN_LEN) ) | |
| 826 { | |
| 827 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
| 828 return( AT_FAIL ); | |
| 829 } | |
| 830 if( strlen( passwd ) < MIN_PIN_LEN OR | |
| 831 strlen( passwd ) > PIN_LEN ) | |
| 832 { | |
| 833 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
| 834 return( AT_FAIL ); | |
| 835 } | |
| 836 cmhSIM_FillInPIN ( passwd, simShrdPrm.setPrm[srcId].curPIN, PIN_LEN ); | |
| 837 simShrdPrm.setPrm[srcId].PINType = PHASE_2_PIN_1; | |
| 838 simEntStat.curCmd = AT_CMD_CLCK; | |
| 839 simShrdPrm.owner = (T_OWN)srcId; | |
| 840 simEntStat.entOwn = srcId; | |
| 841 | |
| 842 if( mode EQ CLCK_MOD_Lock ) | |
| 843 { | |
| 844 psasim_ret = psaSIM_EnablePIN( ); | |
| 845 } | |
| 846 else /* if( mode EQ CLCK_MOD_Unlock ) */ | |
| 847 { | |
| 848 psasim_ret = psaSIM_DisablePIN( ); | |
| 849 } | |
| 850 | |
| 851 if(psasim_ret < 0) | |
| 852 { | |
| 853 TRACE_EVENT( "FATAL RETURN psaSIM in +CLCK" ); | |
| 854 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Internal ); | |
| 855 return( AT_FAIL ); | |
| 856 } | |
| 857 break; | |
| 858 | |
| 859 default: | |
| 860 | |
| 861 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
| 862 return( AT_FAIL ); | |
| 863 } | |
| 864 break; | |
| 865 | |
| 866 /* | |
| 867 *--------------------------------------------------------------- | |
| 868 * access fixed dialling feature | |
| 869 *--------------------------------------------------------------- | |
| 870 */ | |
| 871 case FAC_Fd: | |
| 872 if (!psaSIM_ChkSIMSrvSup(SRV_FDN)) | |
| 873 { | |
| 874 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow); | |
| 875 return( AT_FAIL ); | |
| 876 } | |
| 877 /* | |
| 878 Check the SIM PIN States before sending any request to SIM | |
| 879 */ | |
| 880 if ( simShrdPrm.PINStat EQ PS_PUK2 ) | |
| 881 { | |
| 882 TRACE_EVENT("sAT_PlusCLCK_ME(): SIM PIN-2 Bolcked PUK-2 Required"); | |
| 883 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_SimPuk2Req ); | |
| 884 return( AT_FAIL ); | |
| 885 } | |
| 886 | |
| 887 /* | |
| 888 According to the standards 27.007 Sec 7.4 for facility "FDN": | |
| 889 if PIN2 authentication has not been done during the current session, | |
| 890 PIN2 is required as <passwd>; Below condition will do the | |
| 891 same to check to see whether <passwd> is required / not. | |
| 892 */ | |
| 893 | |
| 894 if ( simShrdPrm.pn2Stat EQ PS_PIN2 OR | |
| 895 simShrdPrm.pn2Stat EQ NO_VLD_PS ) | |
| 896 { | |
| 897 if ( simShrdPrm.PINStat EQ PS_RDY OR | |
| 898 simShrdPrm.PINStat EQ PS_PIN2 ) | |
| 899 { | |
| 900 simShrdPrm.PINStat = PS_PIN2; | |
| 901 } | |
| 902 else | |
| 903 { | |
| 904 TRACE_EVENT("sAT_PlusCLCK_ME(): SIM PIN State is NOT Valid"); | |
| 905 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_SimFail ); | |
| 906 return( AT_FAIL ); | |
| 907 } | |
| 908 | |
| 909 if( !passwd OR ( strlen( passwd ) > PIN_LEN OR | |
| 910 strlen( passwd ) < MIN_PIN_LEN ) ) | |
| 911 { | |
| 912 TRACE_EVENT("sAT_PlusCLCK_ME(): SIM PIN-2 Password is Omitted"); | |
| 913 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_SimPin2Req ); | |
| 914 return( AT_FAIL ); | |
| 915 } | |
| 916 } | |
| 917 | |
| 918 /* | |
| 919 * test class_type whether it is supported and store it temporarily for further use | |
| 920 */ | |
| 921 if( class_type EQ CLASS_NotPresent OR /* default case */ | |
| 922 class_type EQ CLASS_VceDatFax ) /* case 7 */ | |
| 923 { | |
| 924 simShrdPrm.classFDN = CLASS_VceDatFax; | |
| 925 } | |
| 926 else if ( class_type EQ CLASS_VceDatFaxSms ) /* case 15 */ | |
| 927 { | |
| 928 simShrdPrm.classFDN = CLASS_VceDatFaxSms; /* set global class type */ | |
| 929 } | |
| 930 else /* parameter not supported */ | |
| 931 { | |
| 932 TRACE_EVENT( "class type not supported, +CLCK rejected" ); | |
| 933 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotSupp ); | |
| 934 return( AT_FAIL ); | |
| 935 } | |
| 936 simShrdPrm.setPrm[srcId].actProc = (mode EQ CLCK_MOD_Lock)? | |
| 937 SIM_FDN_ENABLE:SIM_FDN_DISABLE; | |
| 938 | |
| 939 simEntStat.curCmd = AT_CMD_CLCK; | |
| 940 simShrdPrm.owner = (T_OWN)srcId; | |
| 941 simEntStat.entOwn = srcId; | |
| 942 | |
| 943 if( psaSIM_ActivateSIM() < 0 ) /* activate SIM card */ | |
| 944 { | |
| 945 TRACE_EVENT( "FATAL RETURN psaSIM in +CLCK" ); | |
| 946 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Internal ); | |
| 947 return( AT_FAIL ); | |
| 948 } | |
| 949 | |
| 950 /* store PIN 2 for later use */ | |
| 951 /* if( passwd ) ... already checked in the beginning! */ | |
| 952 cmhSIM_FillInPIN ( passwd, simShrdPrm.setPrm[srcId].curPIN, PIN_LEN ); | |
| 953 | |
| 954 break; | |
| 955 | |
| 956 /* | |
| 957 *--------------------------------------------------------------- | |
| 958 * lock ALS setting with PIN2 | |
| 959 *--------------------------------------------------------------- | |
| 960 */ | |
| 961 case FAC_Al: | |
| 962 | |
| 963 if( !passwd OR ( strlen( passwd ) > PIN_LEN OR | |
| 964 strlen( passwd ) < MIN_PIN_LEN ) ) | |
| 965 { | |
| 966 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
| 967 return( AT_FAIL ); | |
| 968 } | |
| 969 | |
| 970 cmhSIM_FillInPIN ( passwd, simShrdPrm.setPrm[srcId].curPIN, PIN_LEN ); | |
| 971 | |
| 972 simShrdPrm.setPrm[srcId].actProc = (mode EQ CLCK_MOD_Lock)? | |
| 973 SIM_ALS_LOCK:SIM_ALS_UNLOCK; | |
| 974 | |
| 975 simShrdPrm.setPrm[srcId].PINType = PHASE_2_PIN_2; | |
| 976 | |
| 977 simEntStat.curCmd = AT_CMD_CLCK; | |
| 978 simShrdPrm.owner = (T_OWN)srcId; | |
| 979 simEntStat.entOwn = srcId; | |
| 980 | |
| 981 if( psaSIM_VerifyPIN() < 0 ) /* check PIN2 card */ | |
| 982 { | |
| 983 TRACE_EVENT( "FATAL RETURN psaSIM in +CLCK" ); | |
| 984 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Internal ); | |
| 985 return( AT_FAIL ); | |
| 986 } | |
| 987 | |
| 988 break; | |
| 989 | |
| 990 /* | |
| 991 *--------------------------------------------------------------- | |
| 992 * ME Personalisation | |
| 993 *--------------------------------------------------------------- | |
| 994 */ | |
| 995 #ifdef SIM_PERS | |
| 996 case FAC_Pn: | |
| 997 case FAC_Pu: | |
| 998 case FAC_Pp: | |
| 999 case FAC_Pc: | |
| 1000 case FAC_Ps: | |
| 1001 case FAC_Pf: | |
| 1002 case FAC_Bl: | |
| 1003 | |
| 1004 switch (fac) | |
| 1005 { | |
| 1006 case FAC_Pn: slocktype = SIMLOCK_NETWORK; break; | |
| 1007 case FAC_Pu: slocktype = SIMLOCK_NETWORK_SUBSET; break; | |
| 1008 case FAC_Pp: slocktype = SIMLOCK_SERVICE_PROVIDER; break; | |
| 1009 case FAC_Pc: slocktype = SIMLOCK_CORPORATE; break; | |
| 1010 case FAC_Ps: slocktype = SIMLOCK_SIM; break; | |
| 1011 case FAC_Pf: slocktype = SIMLOCK_FIRST_SIM; break; | |
| 1012 case FAC_Bl: slocktype = SIMLOCK_BLOCKED_NETWORK; break; | |
| 1013 default: slocktype = SIMLOCK_NETWORK; | |
| 1014 } | |
| 1015 | |
| 1016 /* | |
| 1017 * Check whether sim is inserted or not before trying to lock/Unlock | |
| 1018 */ | |
| 1019 | |
| 1020 if(simShrdPrm.SIMStat EQ SS_OK) | |
| 1021 { | |
| 1022 rlockstatus = (mode EQ CLCK_MOD_Lock)? | |
| 1023 aci_slock_lock(slocktype, passwd): | |
| 1024 aci_slock_unlock(slocktype, passwd); | |
| 1025 } | |
| 1026 else | |
| 1027 { | |
| 1028 /* | |
| 1029 * Sim is not present: unlocking is allowed if No_SIM_Unlock flag is OFF | |
| 1030 */ | |
| 1031 if(!aci_slock_set_CFG()) | |
| 1032 { | |
| 1033 ACI_ERR_DESC( ACI_ERR_CLASS_Ext,EXT_ERR_NoMEPD); | |
| 1034 return( AT_FAIL ); | |
| 1035 } | |
| 1036 | |
| 1037 if( (mode EQ CLCK_MOD_Unlock) AND !(cfg_data->Flags & SEC_DRV_HDR_FLAG_No_SIM_Unlock)) | |
| 1038 { | |
| 1039 MFREE(cfg_data); | |
| 1040 rlockstatus = aci_slock_unlock(slocktype, passwd); | |
| 1041 } | |
| 1042 else | |
| 1043 { | |
| 1044 MFREE(cfg_data); | |
| 1045 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_SimNotIns); | |
| 1046 return( AT_FAIL ); | |
| 1047 } | |
| 1048 } | |
| 1049 cmdBuf = AT_CMD_CLCK ; | |
| 1050 if ( ( (mode EQ CLCK_MOD_Lock) AND (rlockstatus EQ SIMLOCK_ENABLED) ) OR | |
| 1051 ( (mode EQ CLCK_MOD_Unlock) AND (rlockstatus EQ SIMLOCK_DISABLED) ) ) | |
| 1052 { | |
| 1053 return (AT_CMPL); | |
| 1054 } | |
| 1055 else | |
| 1056 { | |
| 1057 if (rlockstatus EQ SIMLOCK_BLOCKED) /* Special error description on blocked personalisation */ | |
| 1058 { | |
| 1059 if(!aci_slock_set_CFG()) | |
| 1060 { | |
| 1061 ACI_ERR_DESC( ACI_ERR_CLASS_Ext,EXT_ERR_NoMEPD); | |
| 1062 return( AT_FAIL ); | |
| 1063 } | |
| 1064 aci_set_cme_error(slocktype); | |
| 1065 MFREE(cfg_data); | |
| 1066 } | |
| 1067 else if(rlockstatus EQ SIMLOCK_WAIT) | |
| 1068 { | |
| 1069 simEntStat.curCmd = AT_CMD_CLCK; | |
| 1070 simShrdPrm.owner = (T_OWN)srcId; | |
| 1071 simEntStat.entOwn = srcId; | |
| 1072 AciSLockShrd.check_lock = SIMLOCK_CHECK_LOCK; | |
| 1073 AciSLockShrd.lock_type = slocktype; | |
| 1074 AciSLockShrd.lock_passwd = passwd; | |
| 1075 | |
| 1076 return( AT_EXCT); | |
| 1077 } | |
| 1078 else if(rlockstatus EQ SIMLOCK_BUSY) | |
| 1079 { | |
| 1080 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Busy ); | |
| 1081 } | |
| 1082 else | |
| 1083 { | |
| 1084 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_WrongPasswd ); | |
| 1085 } | |
| 1086 return( AT_FAIL ); | |
| 1087 } | |
| 1088 | |
| 1089 /* | |
| 1090 *--------------------------------------------------------------- | |
| 1091 * FC RESET Handling | |
| 1092 Added on 11/03/2005 | |
| 1093 *--------------------------------------------------------------- | |
| 1094 */ | |
| 1095 case FAC_Fc: | |
| 1096 { | |
| 1097 fcResetStat=aci_slock_reset_fc(passwd); | |
| 1098 simEntStat.curCmd = AT_CMD_CLCK; | |
| 1099 if (fcResetStat EQ OPER_SUCCESS) | |
| 1100 { | |
| 1101 if( !aci_slock_set_CFG()) | |
| 1102 { | |
| 1103 ACI_ERR_DESC( ACI_ERR_CLASS_Ext,EXT_ERR_NoMEPD); | |
| 1104 return( AT_FAIL ); | |
| 1105 } | |
| 1106 aci_slock_init(); | |
| 1107 AciSLockShrd.check_lock = SIMLOCK_CHECK_RESET_FC; | |
| 1108 retSlStatus = aci_slock_checkpersonalisation(AciSLockShrd.current_lock); | |
| 1109 switch(retSlStatus) | |
| 1110 { | |
| 1111 case SIMLOCK_ENABLED : | |
| 1112 return( AT_CMPL); | |
| 1113 case SIMLOCK_WAIT : | |
| 1114 return (AT_EXCT); | |
| 1115 default : | |
| 1116 return( AT_FAIL); | |
| 1117 } | |
| 1118 } | |
| 1119 else | |
| 1120 { | |
| 1121 cmdBuf = simEntStat.curCmd; | |
| 1122 simEntStat.curCmd = AT_CMD_NONE; | |
| 1123 | |
| 1124 if (fcResetStat EQ OPER_WRONG_PASSWORD) | |
| 1125 { | |
| 1126 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_WrongPasswd ); | |
| 1127 aci_slock_send_RAT(cmdBuf,CME_ERR_WrongPasswd); | |
| 1128 } | |
| 1129 else if (fcResetStat EQ OPER_BUSY) | |
| 1130 { | |
| 1131 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Busy ); | |
| 1132 aci_slock_send_RAT(cmdBuf,err_code); | |
| 1133 } | |
| 1134 else | |
| 1135 { | |
| 1136 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_Unknown ); | |
| 1137 aci_slock_send_RAT(cmdBuf,CME_ERR_Unknown); | |
| 1138 } | |
| 1139 return( AT_FAIL ); | |
| 1140 } | |
| 1141 } | |
| 1142 case FAC_Fcm: | |
| 1143 { | |
| 1144 fcResetStat=aci_slock_reset_fc(passwd); | |
| 1145 return(cmhSS_check_oper_result(fcResetStat)); | |
| 1146 } | |
| 1147 case( FAC_Mu ): | |
| 1148 { | |
| 1149 masterunlockStat = aci_slock_master_unlock(passwd); | |
| 1150 simEntStat.curCmd = AT_CMD_CLCK; | |
| 1151 if( masterunlockStat EQ OPER_SUCCESS ) | |
| 1152 { | |
| 1153 if(!aci_slock_set_CFG()) | |
| 1154 { | |
| 1155 ACI_ERR_DESC( ACI_ERR_CLASS_Ext,EXT_ERR_NoMEPD); | |
| 1156 return( AT_FAIL ); | |
| 1157 } | |
| 1158 aci_slock_init(); | |
| 1159 AciSLockShrd.check_lock = SIMLOCK_CHECK_MASTER_UNLOCK; | |
| 1160 retSlStatus = aci_slock_checkpersonalisation(AciSLockShrd.current_lock); | |
| 1161 switch(retSlStatus) | |
| 1162 { | |
| 1163 case SIMLOCK_ENABLED : | |
| 1164 return( AT_CMPL); | |
| 1165 case SIMLOCK_WAIT : | |
| 1166 return (AT_EXCT); | |
| 1167 default : | |
| 1168 return( AT_FAIL); | |
| 1169 } | |
| 1170 } | |
| 1171 else | |
| 1172 { | |
| 1173 cmdBuf = simEntStat.curCmd; | |
| 1174 simEntStat.curCmd = AT_CMD_NONE; | |
| 1175 if( masterunlockStat EQ OPER_WRONG_PASSWORD ) | |
| 1176 { | |
| 1177 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_WrongPasswd ); | |
| 1178 aci_slock_send_RAT(cmdBuf,CME_ERR_WrongPasswd); | |
| 1179 } | |
| 1180 else | |
| 1181 { | |
| 1182 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_Unknown ); | |
| 1183 aci_slock_send_RAT(cmdBuf,CME_ERR_Unknown); | |
| 1184 } | |
| 1185 return( AT_FAIL ); | |
| 1186 } | |
| 1187 } | |
| 1188 case( FAC_Mum ): | |
| 1189 { | |
| 1190 masterunlockStat = aci_slock_master_unlock(passwd); | |
| 1191 return(cmhSS_check_oper_result(masterunlockStat)); | |
| 1192 } | |
| 1193 #endif /* SIM_PERS */ | |
| 1194 #ifdef FF_PHONE_LOCK | |
| 1195 case ( FAC_Pl ): | |
| 1196 { | |
| 1197 phone_lock_oper_ret_stat = aci_ext_set_phone_lock_satus(PHONE_LOCK,(T_SEC_DRV_EXT_PHONE_LOCK_STATUS)mode,passwd); | |
| 1198 return(cmhSS_check_oper_result(phone_lock_oper_ret_stat)); | |
| 1199 } | |
| 1200 | |
| 1201 case ( FAC_Apl ): | |
| 1202 { | |
| 1203 phone_lock_oper_ret_stat = aci_ext_set_phone_lock_satus(AUTO_LOCK,(T_SEC_DRV_EXT_PHONE_LOCK_STATUS)mode,passwd); | |
| 1204 return(cmhSS_check_oper_result(phone_lock_oper_ret_stat)); | |
| 1205 | |
| 1206 } | |
| 1207 #endif | |
| 1208 /* | |
| 1209 *--------------------------------------------------------------- | |
| 1210 * Error handling | |
| 1211 *--------------------------------------------------------------- | |
| 1212 */ | |
| 1213 default: | |
| 1214 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_Unknown ); | |
| 1215 return( AT_FAIL ); | |
| 1216 } | |
| 1217 } | |
| 1218 | |
| 1219 /* | |
| 1220 *------------------------------------------------------------------- | |
| 1221 * log command execution | |
| 1222 *------------------------------------------------------------------- | |
| 1223 */ | |
| 1224 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
| 1225 { | |
| 1226 T_ACI_CLOG cmdLog; /* holds logging info */ | |
| 1227 | |
| 1228 cmdLog.atCmd = AT_CMD_CLCK; | |
| 1229 cmdLog.cmdType = CLOG_TYPE_Set; | |
| 1230 cmdLog.retCode = AT_EXCT; | |
| 1231 cmdLog.cId = ACI_NumParmNotPresent; | |
| 1232 cmdLog.sId = (ssCd EQ NOT_PRESENT_8BIT)? | |
| 1233 ACI_NumParmNotPresent:/*lint -e(644)*/sId1+1; | |
| 1234 cmdLog.cmdPrm.sCLCK.srcId = srcId; | |
| 1235 cmdLog.cmdPrm.sCLCK.fac = fac; | |
| 1236 cmdLog.cmdPrm.sCLCK.mode = mode; | |
| 1237 cmdLog.cmdPrm.sCLCK.passwd = passwd; | |
| 1238 cmdLog.cmdPrm.sCLCK.class_type = class_type; | |
| 1239 rAT_PercentCLOG( &cmdLog ); | |
| 1240 } | |
| 1241 #endif | |
| 1242 return( AT_EXCT ); | |
| 1243 } | |
| 1244 | |
| 1245 /* | |
| 1246 +--------------------------------------------------------------------+ | |
| 1247 | PROJECT : GSM-PS (6147) MODULE : CMH_SSS | | |
| 1248 | STATE : code ROUTINE : sAT_PlusCPWD | | |
| 1249 +--------------------------------------------------------------------+ | |
| 1250 | |
| 1251 PURPOSE : This is the functional counterpart to the +CPWD AT command | |
| 1252 which is responsible to change the password for call | |
| 1253 barring supplementary services. | |
| 1254 | |
| 1255 <fac> : CB facility. | |
| 1256 <oldpwd> : current password. | |
| 1257 <newpwd> : new password. | |
| 1258 */ | |
| 1259 | |
| 1260 GLOBAL T_ACI_RETURN sAT_PlusCPWD ( T_ACI_CMD_SRC srcId, | |
| 1261 T_ACI_FAC fac, | |
| 1262 CHAR * oldpwd, | |
| 1263 CHAR * newpwd) | |
| 1264 { | |
| 1265 T_ACI_RETURN retCd = AT_FAIL; /* holds return code */ | |
| 1266 UBYTE ssCd; /* holds ss code */ | |
| 1267 SHORT sId; /* holds service id */ | |
| 1268 T_OPER_RET_STATUS phone_lock_oper_ret_stat; | |
| 1269 | |
| 1270 TRACE_FUNCTION ("sAT_PlusCPWD"); | |
| 1271 | |
| 1272 /* | |
| 1273 *------------------------------------------------------------------- | |
| 1274 * check password parameter | |
| 1275 *------------------------------------------------------------------- | |
| 1276 */ | |
| 1277 if( !newpwd OR !oldpwd ) | |
| 1278 { | |
| 1279 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
| 1280 return( AT_FAIL ); | |
| 1281 } | |
| 1282 | |
| 1283 /* | |
| 1284 *------------------------------------------------------------------- | |
| 1285 * check parameter <fac> | |
| 1286 *------------------------------------------------------------------- | |
| 1287 */ | |
| 1288 switch( fac ) | |
| 1289 { | |
| 1290 /* All Baring Services share the same password so only SS_CD_ALL_CBSS is valid, | |
| 1291 everything else will be rejected by the network! */ | |
| 1292 case( FAC_Ao ): | |
| 1293 case( FAC_Oi ): | |
| 1294 case( FAC_Ox ): | |
| 1295 case( FAC_Ai ): | |
| 1296 case( FAC_Ir ): | |
| 1297 case( FAC_Ab ): | |
| 1298 case( FAC_Ag ): | |
| 1299 case( FAC_Ac ): ssCd = SS_CD_ALL_CBSS; break; | |
| 1300 | |
| 1301 case( FAC_Sc ): | |
| 1302 case( FAC_P2 ): | |
| 1303 #ifdef SIM_PERS | |
| 1304 case( FAC_Pn ): | |
| 1305 case( FAC_Pu ): | |
| 1306 case( FAC_Pc ): | |
| 1307 case( FAC_Pp ): | |
| 1308 case( FAC_Pf ): | |
| 1309 case( FAC_Ps ): | |
| 1310 case( FAC_Bl ): | |
| 1311 #endif | |
| 1312 #ifdef FF_PHONE_LOCK | |
| 1313 case(FAC_Pl): | |
| 1314 case(FAC_Apl): | |
| 1315 #endif | |
| 1316 | |
| 1317 ssCd = NOT_PRESENT_8BIT; break; | |
| 1318 | |
| 1319 case( FAC_NotPresent ): | |
| 1320 default: | |
| 1321 | |
| 1322 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
| 1323 return( AT_FAIL ); | |
| 1324 } | |
| 1325 | |
| 1326 /* | |
| 1327 *------------------------------------------------------------------- | |
| 1328 * if password relates to SS | |
| 1329 *------------------------------------------------------------------- | |
| 1330 */ | |
| 1331 if( ssCd NEQ NOT_PRESENT_8BIT ) | |
| 1332 { | |
| 1333 /* | |
| 1334 *------------------------------------------------------------------- | |
| 1335 * check parameter <oldpwd> | |
| 1336 *------------------------------------------------------------------- | |
| 1337 */ | |
| 1338 if( strlen( newpwd ) > MAX_PWD_NUM OR | |
| 1339 strlen( oldpwd ) > MAX_PWD_NUM ) | |
| 1340 { | |
| 1341 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
| 1342 return( AT_FAIL ); | |
| 1343 } | |
| 1344 | |
| 1345 /* | |
| 1346 *----------------------------------------------------------------- | |
| 1347 * get a new service table entry to interrogate SS | |
| 1348 *----------------------------------------------------------------- | |
| 1349 */ | |
| 1350 sId = psaSS_stbNewEntry(); | |
| 1351 | |
| 1352 if( sId EQ NO_ENTRY ) | |
| 1353 { | |
| 1354 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_SrvTabFull ); | |
| 1355 return( AT_FAIL ); | |
| 1356 } | |
| 1357 | |
| 1358 /* | |
| 1359 *----------------------------------------------------------------- | |
| 1360 * set up facility information element | |
| 1361 *----------------------------------------------------------------- | |
| 1362 */ | |
| 1363 CCD_START; | |
| 1364 | |
| 1365 psaSS_asmRegisterPWD( ssCd ); | |
| 1366 /* | |
| 1367 *--------------------------------------------------------------- | |
| 1368 * declare service table entry as used and the owner of the service | |
| 1369 *--------------------------------------------------------------- | |
| 1370 */ | |
| 1371 ssShrdPrm.stb[sId].ntryUsdFlg = TRUE; | |
| 1372 ssShrdPrm.stb[sId].ssCode = ssCd; | |
| 1373 ssShrdPrm.stb[sId].srvOwn = (T_OWN)srcId; | |
| 1374 | |
| 1375 /* | |
| 1376 *----------------------------------------------------------------- | |
| 1377 * start a new transaction | |
| 1378 *----------------------------------------------------------------- | |
| 1379 */ | |
| 1380 ssShrdPrm.stb[sId].curCmd = AT_CMD_CPWD; | |
| 1381 psaSS_NewTrns(sId); | |
| 1382 | |
| 1383 CCD_END; | |
| 1384 | |
| 1385 /* | |
| 1386 *----------------------------------------------------------------- | |
| 1387 * store passwords for later use | |
| 1388 *----------------------------------------------------------------- | |
| 1389 */ | |
| 1390 strncpy | |
| 1391 ( | |
| 1392 (char *) cmhPrm[srcId].ssCmdPrm.CXXXpwd, | |
| 1393 (char *) oldpwd, | |
| 1394 MAX_PWD_NUM | |
| 1395 ); | |
| 1396 cmhPrm[srcId].ssCmdPrm.CXXXpwd[MAX_PWD_NUM] = '\0'; | |
| 1397 | |
| 1398 strncpy | |
| 1399 ( | |
| 1400 (char *) cmhPrm[srcId].ssCmdPrm.CXXXnewPwd, | |
| 1401 (char *) newpwd, | |
| 1402 MAX_PWD_NUM | |
| 1403 ); | |
| 1404 cmhPrm[srcId].ssCmdPrm.CXXXnewPwd[MAX_PWD_NUM] = '\0'; | |
| 1405 | |
| 1406 strncpy | |
| 1407 ( | |
| 1408 (char *) cmhPrm[srcId].ssCmdPrm.CXXXnewPwd2, | |
| 1409 (char *) newpwd, | |
| 1410 MAX_PWD_NUM | |
| 1411 ); | |
| 1412 cmhPrm[srcId].ssCmdPrm.CXXXnewPwd2[MAX_PWD_NUM] = '\0'; | |
| 1413 retCd = AT_EXCT; | |
| 1414 } | |
| 1415 else | |
| 1416 { | |
| 1417 /* | |
| 1418 *------------------------------------------------------------------- | |
| 1419 * if password relates to SIM | |
| 1420 *------------------------------------------------------------------- | |
| 1421 */ | |
| 1422 switch (fac) | |
| 1423 { | |
| 1424 /* | |
| 1425 *--------------------------------------------------------------- | |
| 1426 * change PIN 1 / PIN 2 | |
| 1427 *--------------------------------------------------------------- | |
| 1428 */ | |
| 1429 case( FAC_Sc ): | |
| 1430 case( FAC_P2 ): | |
| 1431 if( simEntStat.curCmd NEQ AT_CMD_NONE ) | |
| 1432 return( AT_BUSY ); | |
| 1433 | |
| 1434 if( strlen( newpwd ) > PIN_LEN OR | |
| 1435 strlen( newpwd ) < MIN_PIN_LEN OR | |
| 1436 strlen( oldpwd ) > PIN_LEN OR | |
| 1437 strlen( oldpwd ) < MIN_PIN_LEN ) | |
| 1438 { | |
| 1439 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
| 1440 return( AT_FAIL ); | |
| 1441 } | |
| 1442 | |
| 1443 if( simEntStat.curCmd NEQ AT_CMD_NONE ) | |
| 1444 return( AT_BUSY ); | |
| 1445 | |
| 1446 cmhSIM_FillInPIN ( oldpwd, simShrdPrm.setPrm[srcId].curPIN, PIN_LEN ); | |
| 1447 cmhSIM_FillInPIN ( newpwd, simShrdPrm.setPrm[srcId].newPIN, PIN_LEN ); | |
| 1448 | |
| 1449 simShrdPrm.setPrm[srcId].PINType = (fac EQ FAC_Sc)? | |
| 1450 PHASE_2_PIN_1:PHASE_2_PIN_2; | |
| 1451 | |
| 1452 simEntStat.curCmd = AT_CMD_CPWD; | |
| 1453 simShrdPrm.owner = (T_OWN)srcId; | |
| 1454 simEntStat.entOwn = srcId; | |
| 1455 | |
| 1456 if( psaSIM_ChangePIN() < 0 ) /* change PIN */ | |
| 1457 { | |
| 1458 TRACE_EVENT( "FATAL RETURN psaSIM in +CPWD" ); | |
| 1459 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Internal ); | |
| 1460 return( AT_FAIL ); | |
| 1461 } | |
| 1462 retCd = AT_EXCT; | |
| 1463 break; | |
| 1464 | |
| 1465 #ifdef SIM_PERS | |
| 1466 case( FAC_Pn ): | |
| 1467 case( FAC_Pu ): | |
| 1468 case( FAC_Pc ): | |
| 1469 case( FAC_Pp ): | |
| 1470 case( FAC_Pf ): | |
| 1471 case( FAC_Ps ): | |
| 1472 case( FAC_Bl): | |
| 1473 { | |
| 1474 T_SIMLOCK_TYPE slocktype; | |
| 1475 T_OPER_RET_STATUS status; | |
| 1476 | |
| 1477 switch (fac) | |
| 1478 { | |
| 1479 case FAC_Pn: slocktype = SIMLOCK_NETWORK; break; | |
| 1480 case FAC_Pu: slocktype = SIMLOCK_NETWORK_SUBSET; break; | |
| 1481 case FAC_Pp: slocktype = SIMLOCK_SERVICE_PROVIDER; break; | |
| 1482 case FAC_Pc: slocktype = SIMLOCK_CORPORATE; break; | |
| 1483 case FAC_Ps: slocktype = SIMLOCK_SIM; break; | |
| 1484 case FAC_Pf: slocktype = SIMLOCK_FIRST_SIM; break; | |
| 1485 case FAC_Bl: slocktype = SIMLOCK_BLOCKED_NETWORK; break; | |
| 1486 default: slocktype = SIMLOCK_NETWORK; break; | |
| 1487 | |
| 1488 } | |
| 1489 | |
| 1490 status = aci_slock_change_password( slocktype, oldpwd, newpwd ); | |
| 1491 if (status EQ OPER_SUCCESS) | |
| 1492 return(AT_CMPL); | |
| 1493 else if(status EQ OPER_FAIL ) | |
| 1494 { | |
| 1495 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_WrongPasswd ); | |
| 1496 return( AT_FAIL ); | |
| 1497 } | |
| 1498 else if (status EQ OPER_BLOCKED) | |
| 1499 { | |
| 1500 if(!aci_slock_set_CFG()) | |
| 1501 { | |
| 1502 ACI_ERR_DESC( ACI_ERR_CLASS_Ext,EXT_ERR_NoMEPD); | |
| 1503 return( AT_FAIL ); | |
| 1504 } | |
| 1505 aci_set_cme_error(slocktype); | |
| 1506 MFREE(cfg_data); | |
| 1507 return( AT_FAIL ); | |
| 1508 } | |
| 1509 } | |
| 1510 retCd = AT_CMPL; | |
| 1511 break; | |
| 1512 #endif | |
| 1513 | |
| 1514 #ifdef FF_PHONE_LOCK | |
| 1515 case FAC_Pl: | |
| 1516 case FAC_Apl: | |
| 1517 { | |
| 1518 phone_lock_oper_ret_stat = aci_ext_set_phone_lock_key(oldpwd,newpwd); | |
| 1519 return(cmhSS_check_oper_result(phone_lock_oper_ret_stat)); | |
| 1520 } | |
| 1521 #endif | |
| 1522 } | |
| 1523 } | |
| 1524 | |
| 1525 /* | |
| 1526 *------------------------------------------------------------------- | |
| 1527 * log command execution | |
| 1528 *------------------------------------------------------------------- | |
| 1529 */ | |
| 1530 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
| 1531 { | |
| 1532 T_ACI_CLOG cmdLog; /* holds logging info */ | |
| 1533 | |
| 1534 cmdLog.atCmd = AT_CMD_CPWD; | |
| 1535 cmdLog.cmdType = CLOG_TYPE_Set; | |
| 1536 cmdLog.retCode = retCd; | |
| 1537 cmdLog.cId = ACI_NumParmNotPresent; | |
| 1538 cmdLog.sId = (ssCd EQ NOT_PRESENT_8BIT)? | |
| 1539 ACI_NumParmNotPresent:/*lint -e(644)*/sId+1; | |
| 1540 cmdLog.cmdPrm.sCPWD.srcId = srcId; | |
| 1541 cmdLog.cmdPrm.sCPWD.fac = fac; | |
| 1542 cmdLog.cmdPrm.sCPWD.oldpwd = oldpwd; | |
| 1543 cmdLog.cmdPrm.sCPWD.newpwd = newpwd; | |
| 1544 | |
| 1545 rAT_PercentCLOG( &cmdLog ); | |
| 1546 } | |
| 1547 #endif | |
| 1548 | |
| 1549 return( retCd ); | |
| 1550 } | |
| 1551 | |
| 1552 /* | |
| 1553 +--------------------------------------------------------------------+ | |
| 1554 | PROJECT : GSM-PS (6147) MODULE : CMH_SSS | | |
| 1555 | STATE : code ROUTINE : sAT_PlusCCWA | | |
| 1556 +--------------------------------------------------------------------+ | |
| 1557 | |
| 1558 PURPOSE : This is the functional counterpart to the +CCWA AT command | |
| 1559 which is responsible to set the parameters for call | |
| 1560 waiting supplementary services. | |
| 1561 | |
| 1562 <mode> : CW mode. | |
| 1563 <class_type>: class of call. | |
| 1564 */ | |
| 1565 | |
| 1566 GLOBAL T_ACI_RETURN sAT_PlusCCWA ( T_ACI_CMD_SRC srcId, | |
| 1567 T_ACI_CCWA_MOD mode, | |
| 1568 T_ACI_CLASS class_type) | |
| 1569 { | |
| 1570 SHORT sId1, sId2; /* holds service id */ | |
| 1571 UBYTE bst1, bst2; /* holds basic service type */ | |
| 1572 UBYTE bs1, bs2; /* holds basic service */ | |
| 1573 BOOL mltyTrnFlg = FALSE; /* flags for multi transaction */ | |
| 1574 | |
| 1575 T_ACI_RETURN retVal; | |
| 1576 | |
| 1577 TRACE_FUNCTION ("sAT_PlusCCWA ()"); | |
| 1578 | |
| 1579 /* | |
| 1580 *------------------------------------------------------------------- | |
| 1581 * check command source | |
| 1582 *------------------------------------------------------------------- | |
| 1583 */ | |
| 1584 if(!cmh_IsVldCmdSrc (srcId)) | |
| 1585 { | |
| 1586 return( AT_FAIL ); | |
| 1587 } | |
| 1588 | |
| 1589 if( cmhPrm[srcId].ssCmdPrm.mltyTrnFlg NEQ 0 ) | |
| 1590 | |
| 1591 return( AT_BUSY ); | |
| 1592 | |
| 1593 /* | |
| 1594 *------------------------------------------------------------------- | |
| 1595 * check parameter <class> | |
| 1596 *------------------------------------------------------------------- | |
| 1597 */ | |
| 1598 if( !cmhSS_CheckClass( class_type, &bs1, &bst1, &bs2, &bst2, &mltyTrnFlg )) | |
| 1599 { | |
| 1600 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
| 1601 return( AT_FAIL ); | |
| 1602 } | |
| 1603 | |
| 1604 /* SIM TOOLKIT & FDN HANDLING */ | |
| 1605 if (mode NEQ CCWA_MOD_NotInterrogate) /* mode should be valid */ | |
| 1606 { | |
| 1607 retVal = cmhSS_CW_SAT_Handle( srcId, (T_ACI_CCFC_MOD)mode, class_type); | |
| 1608 | |
| 1609 if( retVal NEQ AT_CMPL ) | |
| 1610 return( retVal ); | |
| 1611 } | |
| 1612 | |
| 1613 | |
| 1614 /* | |
| 1615 *------------------------------------------------------------------- | |
| 1616 * get a new service table entry to interrogate SS | |
| 1617 *------------------------------------------------------------------- | |
| 1618 */ | |
| 1619 sId1 = psaSS_stbNewEntry(); | |
| 1620 | |
| 1621 if( sId1 EQ NO_ENTRY ) | |
| 1622 { | |
| 1623 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_SrvTabFull ); | |
| 1624 return( AT_FAIL ); | |
| 1625 } | |
| 1626 | |
| 1627 sId2 = NO_ENTRY; | |
| 1628 | |
| 1629 if( mltyTrnFlg ) | |
| 1630 { | |
| 1631 ssShrdPrm.stb[sId1].ntryUsdFlg = TRUE; | |
| 1632 | |
| 1633 sId2 = psaSS_stbNewEntry(); | |
| 1634 | |
| 1635 if( sId2 EQ NO_ENTRY ) | |
| 1636 { | |
| 1637 ssShrdPrm.stb[sId1].ntryUsdFlg = FALSE; | |
| 1638 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_SrvTabFull ); | |
| 1639 return( AT_FAIL ); | |
| 1640 } | |
| 1641 } | |
| 1642 | |
| 1643 /* | |
| 1644 *------------------------------------------------------------------- | |
| 1645 * check parameter <mode> | |
| 1646 *------------------------------------------------------------------- | |
| 1647 */ | |
| 1648 switch( mode ) | |
| 1649 { | |
| 1650 /* | |
| 1651 *--------------------------------------------------------------- | |
| 1652 * lock and unlock call barring service | |
| 1653 *--------------------------------------------------------------- | |
| 1654 */ | |
| 1655 case( CCWA_MOD_Disable ): | |
| 1656 case( CCWA_MOD_Enable ): | |
| 1657 | |
| 1658 CCD_START; | |
| 1659 | |
| 1660 if( mode EQ CCWA_MOD_Disable ) | |
| 1661 psaSS_asmDeactivateSS( SS_CD_CW, bst1, bs1 ); | |
| 1662 | |
| 1663 else if( mode EQ CCWA_MOD_Enable ) | |
| 1664 psaSS_asmActivateSS( SS_CD_CW, bst1, bs1 ); | |
| 1665 | |
| 1666 ssShrdPrm.stb[sId1].ntryUsdFlg = TRUE; | |
| 1667 ssShrdPrm.stb[sId1].ssCode = SS_CD_CW; | |
| 1668 ssShrdPrm.stb[sId1].srvOwn = (T_OWN)srcId; | |
| 1669 | |
| 1670 /* start first transaction */ | |
| 1671 ssShrdPrm.stb[sId1].curCmd = AT_CMD_CCWA; | |
| 1672 cmhSS_flagTrn( sId1, &(cmhPrm[srcId].ssCmdPrm.mltyTrnFlg)); | |
| 1673 psaSS_NewTrns(sId1); | |
| 1674 | |
| 1675 if( mltyTrnFlg ) | |
| 1676 { | |
| 1677 if( mode EQ CCWA_MOD_Disable ) | |
| 1678 psaSS_asmDeactivateSS( SS_CD_CW, bst2, bs2 ); | |
| 1679 | |
| 1680 else if( mode EQ CCWA_MOD_Enable ) | |
| 1681 psaSS_asmActivateSS( SS_CD_CW, bst2, bs2 ); | |
| 1682 | |
| 1683 ssShrdPrm.stb[sId2].ntryUsdFlg = TRUE; | |
| 1684 ssShrdPrm.stb[sId2].ssCode = SS_CD_CW; | |
| 1685 ssShrdPrm.stb[sId2].srvOwn = (T_OWN)srcId; | |
| 1686 | |
| 1687 /* start second transaction */ | |
| 1688 ssShrdPrm.stb[sId2].curCmd = AT_CMD_CCWA; | |
| 1689 cmhSS_flagTrn( sId2, &(ssShrdPrm.mltyTrnFlg)); /* only for the second one */ | |
| 1690 cmhSS_flagTrn( sId2, &(cmhPrm[srcId].ssCmdPrm.mltyTrnFlg)); | |
| 1691 psaSS_NewTrns(sId2); | |
| 1692 } | |
| 1693 CCD_END; | |
| 1694 break; | |
| 1695 | |
| 1696 /* | |
| 1697 *--------------------------------------------------------------- | |
| 1698 * unexpected mode | |
| 1699 *--------------------------------------------------------------- | |
| 1700 */ | |
| 1701 case( CCWA_MOD_NotInterrogate ): | |
| 1702 | |
| 1703 ssShrdPrm.stb[sId1].ntryUsdFlg = FALSE; | |
| 1704 return( AT_CMPL ); | |
| 1705 | |
| 1706 default: | |
| 1707 | |
| 1708 ssShrdPrm.stb[sId1].ntryUsdFlg = FALSE; | |
| 1709 if( sId2 NEQ NO_ENTRY ) ssShrdPrm.stb[sId2].ntryUsdFlg = FALSE; | |
| 1710 | |
| 1711 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
| 1712 return( AT_FAIL ); | |
| 1713 } | |
| 1714 | |
| 1715 /* | |
| 1716 *------------------------------------------------------------------- | |
| 1717 * log command execution | |
| 1718 *------------------------------------------------------------------- | |
| 1719 */ | |
| 1720 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
| 1721 { | |
| 1722 T_ACI_CLOG cmdLog; /* holds logging info */ | |
| 1723 | |
| 1724 cmdLog.atCmd = AT_CMD_CCWA; | |
| 1725 cmdLog.cmdType = CLOG_TYPE_Set; | |
| 1726 cmdLog.retCode = AT_EXCT; | |
| 1727 cmdLog.cId = ACI_NumParmNotPresent; | |
| 1728 cmdLog.sId = sId1+1; | |
| 1729 cmdLog.cmdPrm.sCCWA.srcId = srcId; | |
| 1730 cmdLog.cmdPrm.sCCWA.mode = mode; | |
| 1731 cmdLog.cmdPrm.sCCWA.class_type = class_type; | |
| 1732 | |
| 1733 rAT_PercentCLOG( &cmdLog ); | |
| 1734 } | |
| 1735 #endif | |
| 1736 | |
| 1737 return( AT_EXCT ); | |
| 1738 } | |
| 1739 | |
| 1740 | |
| 1741 /* | |
| 1742 +--------------------------------------------------------------------+ | |
| 1743 | PROJECT : GSM-PS (6147) MODULE : CMH_SSS | | |
| 1744 | STATE : code ROUTINE : sAT_PlusCUSD | | |
| 1745 +--------------------------------------------------------------------+ | |
| 1746 | |
| 1747 PURPOSE : This is the functional counterpart to the +CUSD AT command | |
| 1748 which is responsible to invoke an unstructured | |
| 1749 supplementary services. | |
| 1750 | |
| 1751 <str> : USSD string. | |
| 1752 <dcs> : data coding scheme. | |
| 1753 */ | |
| 1754 LOCAL T_ACI_RETURN ussd_call_control_by_sim(T_ACI_CMD_SRC srcId, | |
| 1755 T_ACI_USSD_DATA *str, | |
| 1756 SHORT dcs) | |
| 1757 { | |
| 1758 T_ACI_RETURN retCd = AT_CMPL; /* holds return code */ | |
| 1759 | |
| 1760 #ifdef SIM_TOOLKIT | |
| 1761 T_sat_ussd SATussd; /* to hold USSD string in case of SAT Control */ | |
| 1762 T_CLPTY_PRM *sat_ss_cldPty; | |
| 1763 | |
| 1764 if(!psaSIM_ChkSIMSrvSup( SRV_CalCntrl )) /* call control by SAT enabled */ | |
| 1765 { | |
| 1766 return(AT_CMPL); | |
| 1767 } | |
| 1768 | |
| 1769 if (psaSIM_ChkSIMSrvSup(SRV_USSDsupportInCC)) | |
| 1770 { | |
| 1771 SATussd.dcs = (UBYTE)dcs; | |
| 1772 SATussd.c_ussd_str = str->len; | |
| 1773 SATussd.ussd_str = str->data; | |
| 1774 | |
| 1775 retCd = cmhSAT_USSDCntrlBySIM( &SATussd, (UBYTE)srcId ); | |
| 1776 } | |
| 1777 else /* USSD structure not known by SAT */ | |
| 1778 { | |
| 1779 MALLOC(sat_ss_cldPty, sizeof(T_CLPTY_PRM)); | |
| 1780 cmhCC_init_cldPty( sat_ss_cldPty ); | |
| 1781 | |
| 1782 if( !utl_cvtGsmIra ( str -> data, | |
| 1783 str->len, | |
| 1784 (UBYTE *)sat_ss_cldPty->num, | |
| 1785 MAX_USSD_DATA, | |
| 1786 CSCS_DIR_IraToGsm ) ) | |
| 1787 { | |
| 1788 TRACE_EVENT("utl_cvtGsmIra( ) returned FALSE"); | |
| 1789 MFREE(sat_ss_cldPty); | |
| 1790 return( AT_FAIL ); | |
| 1791 } | |
| 1792 retCd = cmhSAT_SSCntrlBySIM( sat_ss_cldPty, (UBYTE)srcId ); | |
| 1793 MFREE(sat_ss_cldPty); | |
| 1794 } | |
| 1795 return( retCd ); | |
| 1796 #else | |
| 1797 return( AT_CMPL); | |
| 1798 #endif /* of SIM_TOOLKIT */ | |
| 1799 } | |
| 1800 | |
| 1801 GLOBAL T_ACI_RETURN sAT_PlusCUSD ( T_ACI_CMD_SRC srcId, | |
| 1802 T_ACI_USSD_DATA *str, | |
| 1803 SHORT dcs) | |
| 1804 { | |
| 1805 SHORT sId; /* holds service id */ | |
| 1806 T_ACI_RETURN retCd = AT_CMPL; /* holds return code */ | |
| 1807 UBYTE ussdLen; | |
| 1808 UBYTE *ussdString; | |
| 1809 UBYTE src_len; | |
| 1810 | |
| 1811 TRACE_FUNCTION ("sAT_PlusCUSD ()"); | |
| 1812 | |
| 1813 /* | |
| 1814 *------------------------------------------------------------------- | |
| 1815 * check command source | |
| 1816 *------------------------------------------------------------------- | |
| 1817 */ | |
| 1818 if(!cmh_IsVldCmdSrc (srcId)) | |
| 1819 { | |
| 1820 TRACE_EVENT_P1("Wrong source: %d", srcId); | |
| 1821 return( AT_FAIL ); | |
| 1822 } | |
| 1823 | |
| 1824 /* | |
| 1825 *------------------------------------------------------------------- | |
| 1826 * check parameter str | |
| 1827 *------------------------------------------------------------------- | |
| 1828 */ | |
| 1829 if( !str ) | |
| 1830 { | |
| 1831 TRACE_EVENT("Empty string"); | |
| 1832 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
| 1833 return( AT_FAIL ); | |
| 1834 } | |
| 1835 | |
| 1836 /* | |
| 1837 *------------------------------------------------------------------- | |
| 1838 * check parameter dcs | |
| 1839 *------------------------------------------------------------------- | |
| 1840 */ | |
| 1841 if( dcs EQ ACI_NumParmNotPresent ) | |
| 1842 | |
| 1843 dcs = 0; | |
| 1844 | |
| 1845 /* | |
| 1846 *------------------------------------------------------------------- | |
| 1847 * check if there is a USSD request pending | |
| 1848 *------------------------------------------------------------------- | |
| 1849 */ | |
| 1850 sId = psaSS_stbFindUssdReq(); | |
| 1851 | |
| 1852 if( sId EQ NO_ENTRY ) | |
| 1853 { | |
| 1854 /* check if there is another service in progress */ | |
| 1855 if( psaSS_stbFindActSrv( sId ) NEQ NO_ENTRY ) | |
| 1856 { | |
| 1857 TRACE_EVENT("Parallel USSD Transaction not allowed"); | |
| 1858 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_ParallelUSSD ); | |
| 1859 return( AT_FAIL ); | |
| 1860 } | |
| 1861 | |
| 1862 /* get new service table entry */ | |
| 1863 sId = psaSS_stbNewEntry(); | |
| 1864 if( sId EQ NO_ENTRY ) | |
| 1865 { | |
| 1866 TRACE_EVENT("Service table is full"); | |
| 1867 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_SrvTabFull ); | |
| 1868 return( AT_FAIL ); | |
| 1869 } | |
| 1870 | |
| 1871 /* check ussd call control by sim */ | |
| 1872 retCd = ussd_call_control_by_sim(srcId, str, dcs); | |
| 1873 if(retCd NEQ AT_CMPL) | |
| 1874 { | |
| 1875 TRACE_EVENT_P1("ussd_call_control_by_sim() returned with %d", retCd); | |
| 1876 | |
| 1877 return( retCd ); | |
| 1878 } | |
| 1879 | |
| 1880 CCD_START; | |
| 1881 | |
| 1882 MALLOC(ussdString, MAX_USSD_STRING); | |
| 1883 | |
| 1884 /* Implements Measure 25 */ | |
| 1885 /* This function is more correct than utl_getAlphabetCb as it takes care | |
| 1886 of reserved codings */ | |
| 1887 if( cmh_getAlphabetCb( (UBYTE)dcs ) EQ 0 ) /* 7bit alphabet */ | |
| 1888 { | |
| 1889 src_len = (UBYTE)MINIMUM( MAX_USSD_STRING, str->len); | |
| 1890 ussdLen = utl_cvt8To7( str->data, | |
| 1891 src_len, | |
| 1892 ussdString, 0 ); | |
| 1893 /* According to spec 23.038 section 6.1.2.3 for USSD packing, for bytes end with | |
| 1894 * (8*n)-1 i.e where n is 1,2,3....i.e byte 7, 15, 23 ... to be padded | |
| 1895 * with carriage return <CR>(0xD) | |
| 1896 */ | |
| 1897 if ((src_len+1)%8 EQ 0) | |
| 1898 { | |
| 1899 ussdString[ussdLen-1] |= (0xD << 1); | |
| 1900 } | |
| 1901 } | |
| 1902 else | |
| 1903 { | |
| 1904 ussdLen = str->len; | |
| 1905 memcpy(ussdString, str->data, MAX_USSD_STRING); | |
| 1906 } | |
| 1907 | |
| 1908 psaSS_asmProcUSSDReq( (UBYTE)dcs, ussdString, ussdLen ); | |
| 1909 | |
| 1910 MFREE(ussdString); | |
| 1911 | |
| 1912 /* start new transaction */ | |
| 1913 ssShrdPrm.stb[sId].ntryUsdFlg = TRUE; | |
| 1914 ssShrdPrm.stb[sId].curCmd = AT_CMD_CUSD; | |
| 1915 ssShrdPrm.stb[sId].srvOwn = (T_OWN)srcId; | |
| 1916 psaSS_NewTrns(sId); | |
| 1917 | |
| 1918 CCD_END; | |
| 1919 | |
| 1920 retCd = AT_CMPL; | |
| 1921 | |
| 1922 | |
| 1923 } | |
| 1924 else | |
| 1925 { | |
| 1926 CCD_START; | |
| 1927 | |
| 1928 psaSS_asmCnfUSSDReq( (UBYTE)dcs, str->data, str->len ); | |
| 1929 | |
| 1930 ssShrdPrm.stb[sId].ussdReqFlg = FALSE; | |
| 1931 | |
| 1932 /* continue existing transaction */ | |
| 1933 psaSS_CntTrns(sId); | |
| 1934 | |
| 1935 CCD_END; | |
| 1936 | |
| 1937 retCd = AT_CMPL; | |
| 1938 } | |
| 1939 | |
| 1940 ssShrdPrm.ussdLen = 0; | |
| 1941 | |
| 1942 /* save ussd string for possible version 1 retry */ | |
| 1943 if( cmh_getAlphabetCb( (UBYTE)dcs ) EQ 0 ) /* 7bit alphabet */ | |
| 1944 { | |
| 1945 if( str->len <= MAX_USSD_STRING ) | |
| 1946 { | |
| 1947 ssShrdPrm.ussdLen = str->len; | |
| 1948 memcpy( ssShrdPrm.ussdBuf, str->data, str->len ); | |
| 1949 } | |
| 1950 } | |
| 1951 | |
| 1952 /* | |
| 1953 *------------------------------------------------------------------- | |
| 1954 * log command execution | |
| 1955 *------------------------------------------------------------------- | |
| 1956 */ | |
| 1957 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
| 1958 { | |
| 1959 T_ACI_CLOG cmdLog; /* holds logging info */ | |
| 1960 | |
| 1961 cmdLog.atCmd = AT_CMD_CUSD; | |
| 1962 cmdLog.cmdType = CLOG_TYPE_Set; | |
| 1963 cmdLog.retCode = retCd; | |
| 1964 cmdLog.cId = ACI_NumParmNotPresent; | |
| 1965 cmdLog.sId = sId+1; | |
| 1966 cmdLog.cmdPrm.sCUSD.srcId = srcId; | |
| 1967 cmdLog.cmdPrm.sCUSD.dcs = dcs; | |
| 1968 cmdLog.cmdPrm.sCUSD.str = str; | |
| 1969 | |
| 1970 rAT_PercentCLOG( &cmdLog ); | |
| 1971 } | |
| 1972 #endif | |
| 1973 | |
| 1974 return( retCd ); | |
| 1975 } | |
| 1976 | |
| 1977 /* | |
| 1978 +--------------------------------------------------------------------+ | |
| 1979 | PROJECT : GSM-PS (6147) MODULE : CMH_SSS | | |
| 1980 | STATE : code ROUTINE : sAT_PercentCCBS | | |
| 1981 +--------------------------------------------------------------------+ | |
| 1982 | |
| 1983 PURPOSE : This is the functional counterpart to the %CCBS AT command | |
| 1984 which is responsible to clear CCBS entries. Index value set | |
| 1985 to 0 indicates clear all entries. | |
| 1986 | |
| 1987 <idx> : ccbs index | |
| 1988 */ | |
| 1989 | |
| 1990 GLOBAL T_ACI_RETURN sAT_PercentCCBS( T_ACI_CMD_SRC srcId, | |
| 1991 SHORT idx ) | |
| 1992 { | |
| 1993 SHORT sId; /* holds service id */ | |
| 1994 | |
| 1995 T_ACI_RETURN retVal; | |
| 1996 | |
| 1997 TRACE_FUNCTION ("sAT_PercentCCBS ()"); | |
| 1998 | |
| 1999 /* | |
| 2000 *------------------------------------------------------------------- | |
| 2001 * check command source | |
| 2002 *------------------------------------------------------------------- | |
| 2003 */ | |
| 2004 if(!cmh_IsVldCmdSrc (srcId)) | |
| 2005 { | |
| 2006 return( AT_FAIL ); | |
| 2007 } | |
| 2008 | |
| 2009 /* | |
| 2010 *------------------------------------------------------------------- | |
| 2011 * check parameter idx | |
| 2012 *------------------------------------------------------------------- | |
| 2013 */ | |
| 2014 if( idx EQ ACI_NumParmNotPresent OR idx > 5 OR idx < 0 ) | |
| 2015 { | |
| 2016 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
| 2017 return( AT_FAIL ); | |
| 2018 } | |
| 2019 | |
| 2020 /* SIM TOOLKIT & FDN HANDLING */ | |
| 2021 retVal = cmhSS_CCBS_SAT_Handle( srcId, CCBS_MOD_Erasure, idx); | |
| 2022 | |
| 2023 if( retVal NEQ AT_CMPL ) | |
| 2024 return( retVal ); | |
| 2025 | |
| 2026 | |
| 2027 /* | |
| 2028 *------------------------------------------------------------------- | |
| 2029 * get a new service table entry to interrogate SS | |
| 2030 *------------------------------------------------------------------- | |
| 2031 */ | |
| 2032 sId = psaSS_stbNewEntry(); | |
| 2033 | |
| 2034 if( sId EQ NO_ENTRY ) | |
| 2035 { | |
| 2036 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_SrvTabFull ); | |
| 2037 return( AT_FAIL ); | |
| 2038 } | |
| 2039 | |
| 2040 /* | |
| 2041 *------------------------------------------------------------------- | |
| 2042 * check parameter <mode> | |
| 2043 *------------------------------------------------------------------- | |
| 2044 */ | |
| 2045 CCD_START; | |
| 2046 | |
| 2047 if( idx EQ 0 ) idx = KSD_IDX_NONE; | |
| 2048 | |
| 2049 psaSS_asmDeactivateCCBS((UBYTE)idx); | |
| 2050 | |
| 2051 ssShrdPrm.stb[sId].ntryUsdFlg = TRUE; | |
| 2052 ssShrdPrm.stb[sId].ssCode = SS_CD_CCBS; | |
| 2053 ssShrdPrm.stb[sId].SSver = MNCC_SS_VERSION_3; | |
| 2054 | |
| 2055 ssShrdPrm.stb[sId].srvOwn = (T_OWN)srcId; | |
| 2056 | |
| 2057 ssShrdPrm.stb[sId].curCmd = AT_CMD_CCBS; | |
| 2058 | |
| 2059 psaSS_NewTrns(sId); | |
| 2060 | |
| 2061 CCD_END; | |
| 2062 | |
| 2063 /* | |
| 2064 *------------------------------------------------------------------- | |
| 2065 * log command execution | |
| 2066 *------------------------------------------------------------------- | |
| 2067 */ | |
| 2068 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
| 2069 { | |
| 2070 T_ACI_CLOG cmdLog; /* holds logging info */ | |
| 2071 | |
| 2072 cmdLog.atCmd = AT_CMD_CCBS; | |
| 2073 cmdLog.cmdType = CLOG_TYPE_Set; | |
| 2074 cmdLog.retCode = AT_EXCT; | |
| 2075 cmdLog.cId = ACI_NumParmNotPresent; | |
| 2076 cmdLog.sId = sId+1; | |
| 2077 cmdLog.cmdPrm.sCCBS.srcId = srcId; | |
| 2078 cmdLog.cmdPrm.sCCBS.idx = idx; | |
| 2079 | |
| 2080 rAT_PercentCLOG( &cmdLog ); | |
| 2081 } | |
| 2082 #endif | |
| 2083 | |
| 2084 return( AT_EXCT ); | |
| 2085 } | |
| 2086 | |
| 2087 #ifdef TI_PS_FF_AT_P_CMD_CSCN | |
| 2088 /* | |
| 2089 +--------------------------------------------------------------------+ | |
| 2090 | PROJECT : GSM-PS (6147) MODULE : CMH_SSS | | |
| 2091 | STATE : code ROUTINE : sAT_PercentCSCN | | |
| 2092 +--------------------------------------------------------------------+ | |
| 2093 | |
| 2094 PURPOSE : This is the functional counterpart to the %CSCN AT command | |
| 2095 which is responsible to set the switches for debugging | |
| 2096 mode at terminal interface. | |
| 2097 */ | |
| 2098 GLOBAL T_ACI_RETURN sAT_PercentCSCN ( T_ACI_CMD_SRC srcId, | |
| 2099 T_ACI_SS_CSCN_MOD_STATE ss_switch, | |
| 2100 T_ACI_SS_CSCN_MOD_DIRECTION ss_direction, | |
| 2101 T_ACI_CC_CSCN_MOD_STATE cc_switch, | |
| 2102 T_ACI_CC_CSCN_MOD_DIRECTION cc_direction ) | |
| 2103 { | |
| 2104 TRACE_FUNCTION ("sAT_PercentCSCN ()"); | |
| 2105 | |
| 2106 if(!cmh_IsVldCmdSrc (srcId)) /* check command source */ | |
| 2107 { | |
| 2108 return( AT_FAIL ); | |
| 2109 } | |
| 2110 | |
| 2111 if (ss_switch NEQ SS_CSCN_MOD_STATE_INVALID) | |
| 2112 cmhPrm[srcId].ssCmdPrm.CSCNss_mode.SsCSCNModeState = ss_switch; | |
| 2113 | |
| 2114 if (ss_direction NEQ SS_CSCN_MOD_DIR_INVALID) | |
| 2115 cmhPrm[srcId].ssCmdPrm.CSCNss_mode.SsCSCNModeDirection = ss_direction; | |
| 2116 | |
| 2117 if (cc_switch NEQ CC_CSCN_MOD_STATE_INVALID) | |
| 2118 cmhPrm[srcId].ccCmdPrm.CSCNcc_mode.CcCSCNModeState = cc_switch; | |
| 2119 | |
| 2120 if (cc_direction NEQ CC_CSCN_MOD_DIR_INVALID) | |
| 2121 cmhPrm[srcId].ccCmdPrm.CSCNcc_mode.CcCSCNModeDirection = cc_direction; | |
| 2122 | |
| 2123 return( AT_CMPL ); | |
| 2124 } | |
| 2125 #endif /* TI_PS_FF_AT_P_CMD_CSCN */ | |
| 2126 | |
| 2127 #ifdef TI_PS_FF_AT_P_CMD_CUSDR | |
| 2128 /* | |
| 2129 +--------------------------------------------------------------------+ | |
| 2130 | PROJECT : GSM-PS (6147) MODULE : CMH_SSS | | |
| 2131 | STATE : code ROUTINE : sAT_PercentCUSDR | | |
| 2132 +--------------------------------------------------------------------+ | |
| 2133 | |
| 2134 PURPOSE : This is the functional counterpart to the %CUSDR AT command | |
| 2135 which is responsible for extended user/MMI response to n/w | |
| 2136 initaiated USSD. | |
| 2137 */ | |
| 2138 GLOBAL T_ACI_RETURN sAT_PercentCUSDR(T_ACI_CMD_SRC srcId, T_ACI_CUSDR_RES response) | |
| 2139 { | |
| 2140 TRACE_FUNCTION ("sAT_PercentCUSDR()"); | |
| 2141 | |
| 2142 if(!cmh_IsVldCmdSrc (srcId)) /* check command source */ | |
| 2143 { | |
| 2144 return( AT_FAIL ); | |
| 2145 } | |
| 2146 | |
| 2147 if(cuscfgParams.Ext_USSD_Response EQ CUSCFG_STAT_Disabled) | |
| 2148 { | |
| 2149 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow ); | |
| 2150 return( AT_FAIL ); | |
| 2151 } | |
| 2152 | |
| 2153 if(Ext_USSD_Res_Pending EQ CUSDR_EXT_USSD_RES_Not_Pending OR Ext_USSD_Res_Pending_sId EQ (SHORT)NOT_PRESENT_8BIT) | |
| 2154 { | |
| 2155 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow ); | |
| 2156 return( AT_FAIL ); | |
| 2157 } | |
| 2158 | |
| 2159 switch(response) | |
| 2160 { | |
| 2161 case CUSDR_RES_Ok: | |
| 2162 if(Ext_USSD_Res_Pending NEQ CUSDR_EXT_USSD_RES_Request) | |
| 2163 { | |
| 2164 psaSS_asmEmptyRslt(); | |
| 2165 psaSS_CntTrns(Ext_USSD_Res_Pending_sId); | |
| 2166 } | |
| 2167 Ext_USSD_Res_Pending = CUSDR_EXT_USSD_RES_Not_Pending; | |
| 2168 Ext_USSD_Res_Pending_sId = NOT_PRESENT_8BIT; | |
| 2169 return(AT_CMPL); | |
| 2170 | |
| 2171 case CUSDR_RES_Unknown_Alphabet: | |
| 2172 psaSS_asmErrorRslt( Ext_USSD_Res_Pending_sId, ERR_UNKNOWN_ALPHA ); | |
| 2173 psaSS_CntTrns(Ext_USSD_Res_Pending_sId); | |
| 2174 ssShrdPrm.stb[Ext_USSD_Res_Pending_sId].ntryUsdFlg = FALSE; | |
| 2175 Ext_USSD_Res_Pending = CUSDR_EXT_USSD_RES_Not_Pending; | |
| 2176 Ext_USSD_Res_Pending_sId = NOT_PRESENT_8BIT; | |
| 2177 return(AT_CMPL); | |
| 2178 | |
| 2179 case CUSDR_RES_Busy: | |
| 2180 psaSS_asmErrorRslt( Ext_USSD_Res_Pending_sId, ERR_USSD_BUSY ); | |
| 2181 psaSS_EndTrns(Ext_USSD_Res_Pending_sId); | |
| 2182 ssShrdPrm.stb[Ext_USSD_Res_Pending_sId].ntryUsdFlg = FALSE; | |
| 2183 Ext_USSD_Res_Pending = CUSDR_EXT_USSD_RES_Not_Pending; | |
| 2184 Ext_USSD_Res_Pending_sId = NOT_PRESENT_8BIT; | |
| 2185 return(AT_CMPL); | |
| 2186 | |
| 2187 default: | |
| 2188 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
| 2189 return( AT_FAIL ); | |
| 2190 | |
| 2191 } | |
| 2192 | |
| 2193 } | |
| 2194 #endif /* TI_PS_FF_AT_P_CMD_CUSDR */ | |
| 2195 | |
| 2196 /*==== EOF ========================================================*/ |
