FreeCalypso > hg > fc-magnetite
comparison src/g23m-aci/aci/ati_bas.c @ 246:a33da2d26a31
aci3: FreeCalypso +CGSN logic ported over
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 24 Jul 2017 06:18:10 +0000 |
parents | 557041e392a9 |
children | 0da72ce64c86 |
comparison
equal
deleted
inserted
replaced
245:3b8d291ed45a | 246:a33da2d26a31 |
---|---|
70 #include "bat.h" | 70 #include "bat.h" |
71 | 71 |
72 #include "ati_bat.h" | 72 #include "ati_bat.h" |
73 | 73 |
74 #endif /*FF_ATI_BAT*/ | 74 #endif /*FF_ATI_BAT*/ |
75 | |
76 #include "cl_imei.h" | |
77 #include "ksd.h" | |
78 #include "cmh_ss.h" | |
75 | 79 |
76 #include "fc-target.cfg" | 80 #include "fc-target.cfg" |
77 | 81 |
78 LOCAL T_ATI_RSLT aciPrcsPlusCG (UBYTE srcId, CHAR* cl, CHAR* ef); | 82 LOCAL T_ATI_RSLT aciPrcsPlusCG (UBYTE srcId, CHAR* cl, CHAR* ef); |
79 LOCAL T_ATI_RSLT setaciPrcsVolLevel ( CHAR* cl, UBYTE device ); | 83 LOCAL T_ATI_RSLT setaciPrcsVolLevel ( CHAR* cl, UBYTE device ); |
2134 | 2138 |
2135 PURPOSE : +CGSN, show serial number | 2139 PURPOSE : +CGSN, show serial number |
2136 */ | 2140 */ |
2137 GLOBAL T_ATI_RSLT atPlusCGSN ( char *cl, UBYTE srcId ) | 2141 GLOBAL T_ATI_RSLT atPlusCGSN ( char *cl, UBYTE srcId ) |
2138 { | 2142 { |
2143 int i; | |
2144 UBYTE IMEIBuf[CL_IMEI_SIZE]; /* IMEI buffer */ | |
2145 T_ACI_IMEI imei; | |
2146 | |
2139 TRACE_FUNCTION("atPlusCGSN()"); | 2147 TRACE_FUNCTION("atPlusCGSN()"); |
2140 | 2148 |
2141 return aciPrcsPlusCG (srcId, cl, EF_CGSN_ID); | 2149 /* |
2150 * New FreeCalypso logic: | |
2151 * | |
2152 * look for /pcm/CGSN first, using direct FFS API rather than PCM; | |
2153 * if /pcm/CGSN is present, return the string stored in there; | |
2154 * if no /pcm/CGSN, return 15-digit IMEI with computed check digit. | |
2155 */ | |
2156 | |
2157 i = ffs_file_read("/pcm/CGSN", (UBYTE *)g_sa, SIZE_EF_CGSN); | |
2158 if (i > 0) | |
2159 g_sa[i] = '\0'; | |
2160 else { | |
2161 cl_get_imeisv(CL_IMEI_SIZE, IMEIBuf, CL_IMEI_GET_STORED_IMEI); | |
2162 imei.tac1 = IMEIBuf[0]; | |
2163 imei.tac2 = IMEIBuf[1]; | |
2164 imei.tac3 = IMEIBuf[2]; | |
2165 imei.fac = IMEIBuf[3]; | |
2166 imei.snr1 = IMEIBuf[4]; | |
2167 imei.snr2 = IMEIBuf[5]; | |
2168 imei.snr3 = IMEIBuf[6]; | |
2169 imei.svn = IMEIBuf[7]; | |
2170 imei.cd = cmhSS_getCdFromImei ( &imei ); | |
2171 sprintf(g_sa, "%02x%02x%02x%02x%02x%02x%02x%d", | |
2172 imei.tac1, imei.tac2, imei.tac3, imei.fac, | |
2173 imei.snr1, imei.snr2, imei.snr3, imei.cd); | |
2174 } | |
2175 | |
2176 io_sendMessage (srcId, g_sa, ATI_NORMAL_OUTPUT); | |
2177 | |
2178 return ATI_CMPL; | |
2142 } | 2179 } |
2143 | 2180 |
2144 /* | 2181 /* |
2145 +--------------------------------------------------------------------+ | 2182 +--------------------------------------------------------------------+ |
2146 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | 2183 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | |