g;4dZddlTddlmZmZddlmZmZmZm Z m Z m Z m Z ddlm ZddlTddlmZddlTGddeZGd d eZGd d eZGd deZeedddddZGddeZGddeZGddeZGddeZ GddeZ!Gdd eZ"Gd!d"eZ#Gd#d$eZ$Gd%d&eZ%Gd'd(e&Z'Gd)d*eZ(d+S),z The File (and its derived classes) uses the classes of pySim.filesystem in order to describe the files specified in UIC Reference P38 T 9001 5.0 "FFFIS for GSM-R SIM Cards" )*)packunpack)StructBytesInt8ubInt16ubInt24ubInt32ub FlagsEnum)Optional)CardProfileAddonceZdZdZdZdS)FuncNTypeAdapterctt|}t|dd}|ddt|dzt|dzdS)Nfunctional_numberpresentation_of_only_this_fn permanent_fn) swap_nibblesb2hintbool)selfobjcontextpathbcd last_digits 9/home/jenkins/workspace/simtester-sanitize/pySim/gsm_r.py_decodezFuncNTypeAdapter._decode*s`3s88$$R"%% %("X04Z!^0D0D $Z!^ 4 466 6cdS)NFIXMErrr r!s r$_encodezFuncNTypeAdapter._encode1swr&N)__name__ __module__ __qualname__r%r+r)r&r$rr)s2666r&rc:eZdZdZdddddddfgZfdZxZS) EF_FNz Section 7.240315801000010ff0104138510000001fTr)functional_number_and_type list_numberctdddddtdtt dz dt z |_dS) N6ff1zEF.FNzFunctional numbers r9fidsfidnamedescrec_lenr4rr5)super__init__rrrr _constructr __class__s r$rAzEF_FN.__init__<sg V$W2F  D D D !=>NuUVxx>X>X!X!.v!577r&)r,r-r.__doc__ _test_decoderA __classcell__rDs@r$r0r05sq AR04d+M+M]^ a a cL 777777777r&r0ceZdZdZdZdZdS) PlConfAdapterz Section 7.4.3ct|dz}|dkrdS|dkrdS|dkrdS|dkrdS|dkrdS|dkrdSdS) NrNoner3rrrrr r!nums r$r%zPlConfAdapter._decodeFsl#hhn !886 !881 !881 !881 !881 !881 8r&c|dkrdSt|}|dkrdS|dkrdS|dkrdS|dkrdS|dkrdSdS)NrMrrr3rOrNrPrQr*s r$r+zPlConfAdapter._encodeUsh &==1#hh !881 !881 !881 !881 !881 8r&Nr,r-r.rEr%r+r)r&r$rJrJCs8        r&rJceZdZdZdZdZdS) PlCallAdapterzSection 7.4.12ct|dz}|dkrdS|dkrdS|dkrdS|dkrdS|dkrdS|dkrdS|d krd S|dkrd SdS) NrLrrMr3rrNrOrPBArQrRs r$r%zPlCallAdapter._decodehs#hhn !886 !881 !881 !881 !881 !881 !883 !883 8r&c|dkrdS|dkrdS|dkrdS|dkrdS|dkrdS|dkrdS|dkrd S|d krd SdS) NrMrrr3rOrNrPrZrYr[rLr)r*s r$r+zPlCallAdapter._encode{sy &==1 !881 !881 !881 !881 !881 #::1 #::1 :r&NrUr)r&r$rWrWes8&r&rW)decision predefinednum_dial_digitsicemptyc @eZdZdZdddddddddd d fgZfd ZxZS) EF_CallconfCz Section 7.30026121ffffffffffff1e000a040a010253600795792426f0rO1612ffffffffffff r3rN350670599742620f) pl_confconf_nrmax_rand n_ack_maxpl_ack n_nested_maxtrain_emergency_gidshunting_emergency_gidimeictdddddtdttz dt t dz d tz d tz d ttz d tz d tz dtz dt t dz |_ dS)N6ff2z EF.CallconfC)ryz3Call Configuration of emergency calls Configuration)r;r<r=sizer>rnrorrprqrrrsrtrurv) r@rArrJr BcdAdapterrr rWrBrCs r$rAzEF_CallconfC.__init__s V$^(S  U U U =+@+@!@!*:eAhh+?+?!?!+F!2!,W!4!)-*?*?!?!/!6!6v!=!9&!@!' 588(<(>r&r,r-r.rE_test_de_encoderArGrHs@r$rhrhso <%7RVXAab% ( ( *O > > > > > > > > >r&rhc"eZdZdZfdZxZS) EF_CallconfIz Section 7.5c vtdddddtdtz dtz dt t z d tt d d d z dttdz dttdz |_ dS)N6ff3z EF.CallconfI)rz1Call Configuration of emergency calls Information)r;r<r=r?r>t_dur t_relcalcpl_callcauser3rNrP) powered_offradio_link_error user_commandgcrrfnrr) r@rArr r rWrr r{rrBrCs r$rAzEF_CallconfI.__init__s V$^XQ  S S S !,W!4!*=+@+@!@!(!*6q<=A"O"O"O"O"'z%((';';!;!&z%((';';!;==r&)r,r-r.rErArGrHs@r$rrs> = = = = = = = = =r&rc2eZdZdZddddfgZfdZxZS) EF_Shuntingz Section 7.603f8ffffff000000rOf8ffffff000000) common_gid shunting_gidc tdddddtdtz dt t dz |_dS) N6ff4z EF.ShuntingShuntingrrr;r<r=r>rzrrrL)r@rArr HexAdapterrrBrCs r$rAzEF_Shunting.__init__sf V$+*6  K K K f!4!/ 5880D0D!DFFr&r|rHs@r$rrs_ aAQSSUOFFFFFFFFFr&rc neZdZdZdddddddddddd d d fd d dddddddddd dd fgZfdZxZS) EF_GsmrPLMNz Section 7.722f860f86f8d6f8e01z228-06Tvbsvgcsemlppfneirener) supported preference6f8d6f8e01)plmnclass_of_networkic_incoming_ref_tbloutgoing_ref_tbl ic_table_ref22f810416f8d6f8e02z228-01Fr302ctdddddtdtt dz dt d t td d d d ddz dtdz z dtt d z dtt d z dtt d z |_ dS)N6ff5z EF.GsmrPLMNzGSM-R network selectionr8r:rrOrrrPr3rNrrrrrrrr) r@rAr PlmnAdapterr BitStructr BitsIntegerrrBrCs r$rAzEF_GsmrPLMN.__init__s V$]7  I I I  E!HH(=(=!=!3Ik)T_`aTbTbhipqyz@AJLKMKMKM?M>J;WX>>>Y5[5["[!6z%((7K7K!K!3JuQxx4H4H!H!/ 5880D0D!D FFr&r|rHs@r$rrs (:>W[*.$2A2APQITIT:@U[26 !9!9 ; (:?Y^*.%2B2BQRIUIU:@U[26 !9!9 ; OFFFFFFFFFr&rcFeZdZdZddddddfdd d d d dfgZfd ZxZS) EF_ICz Section 7.8f06f8e40f10001rbr041fr3)next_table_typeid_of_next_tableic_decision_valuenetwork_string_table_indexffffffffffffffrfffffic tdddddtdtz dt t dz d t t dz d tz |_dS) NrzEF.ICzInternational Code)rLrLr:rrrNrr) r@rAr NextTableTyperrr{r rBrCs r$rAzEF_IC.__init__s V$W2F  D D D !2=!@!3JuQxx4H4H!H!4Za5I5I!I!=g!EGGr&r|rHs@r$rrs QW39YZ]] _ f39Y^aa cO GGGGGGGGGr&rc*eZdZdZgdZfdZxZS)EF_NWz Section 7.9))47534d2d52204348zGSM-R CH)537769737347534dSwissGSM)47534d2d52204442zGSM-R DB)47534d2d52524649zGSM-RRFIc|tdddddtd|_dS)N6f80zEF.NWz Network Namerr:r)r@rA GsmStringrBrCs r$rAzEF_NW.__init__s@ V$W,f  > > >#A,,r&r|rHs@r$rrsOO '''''''''r&rcXeZdZdZddddddfdd d d d dfd dddddfgZdfd ZxZS) EF_Switchingz Section 8.4 f26f87f0ff00rd6f870fffr)rrdecision_valuestring_table_index f06f8ff1ff01rb6f8f1fffr3 f16f89f5ff05rc6f895fffrP1234 SwitchingNc t|d||dtdtz dt t dz dt t dz dtz |_dS)N)rYrYr:rrrNrr) r@rArrrrr{rrBrr;r=r>rDs r$rAzEF_Switching.__init__s St"v  ? ? ? !2=!@!3JuQxx4H4H!H!1*U1XX2F2F!F!5f!<>>r&)rrNr|rHs@r$rrs /@V\.4APP R zv.4APP R |QW.4APP R O>>>>>>>>>>r&rc eZdZdZdddddfddd d d fgZed ez d eedz Z ede edz de z Z dfd Z dededefdZdededefdZxZS) EF_Predefinedz Section 8.5f26f85r3rd6f85)rrf0ffc8rNr)predefined_value1string_table_index1rrrrr PredefinedNcTt|d||ddS)N)rOrOr:)r@rArs r$rAzEF_Predefined.__init__s9 St"v  ? ? ? ? ?r& raw_bin_data record_nrreturncb|dkrt|j|St|j|SNr3)parse_constructconstruct_firstconstruct_others)rrrs r$_decode_record_binz EF_Predefined._decode_record_bins1 >>"4#7FF F"4#8,GG Gr& abstract_datac d}|dkr|j|}n|j|}t|Sr)rbuildr filter_dict)rrrkwargsrs r$_encode_record_binz EF_Predefined._encode_record_bin%sJ  >>$**=99AA%++M::A1~~r&)rrN)r,r-r.rEr}rrrrrr{rrrAbytesrdictr bytearrayrrGrHs@r$rrs5 A,=SY[[] AfSRRTO f.}</ 55880D0DDFFOv1**UU1XX2F2FF3F:<<??????HH3H4HHHH 3U^r&rcDeZdZdZdddddfddd d dfgZdfd ZxZS)EF_DialledValsz Section 8.6ffffff22rfr22)rr dialed_digitsf16f8885rc6f8858r DialledValsNc t|d||dtdtz dt t dz dt t dz |_dS)N)rrrrrrNrr3)r@rArrrrr{rBrs r$rAzEF_DialledVals.__init__3sq St$TOOO !2=!@!3JuQxx4H4H!H!0E!HH1E1E!EGGr&)rrNr|rHs@r$rr-sz 7aeggi rzEF.CTz Call TyperzEF.SCz Short CoderzEF.FCz Function Coderz EF.ServicezVGCS/VBS Service Code6f8azEF.CallzFirst digit of the group ID6f8bz EF.FctTeamz,Call Type 6 Team Type + Team member function6f92z EF.Controllerz$Call Type 7 Controller function code6f8cz EF.GatewayzAccess to external networks6f81z EF.5to8digitsz'Call Type 2 User Identity Number length6f82z EF.2digitsz2 digits input6f83z EF.8digitsz8 digits input6f84z EF.9digitsz9 digits inputrzEF.SSSSSzGroup call area input6f86zEF.LLLLLzLocation number Call Type 66f91z EF.LocationzLocation number Call Type 7rz EF.FreeNumberzFree Number Call Type 0 and 8) r@rAr0rhrrrrrrrr add_files)rr;r=r>filesrDs r$rAzDF_EIRENE.__init__;s St$777 GG NN NN MM MM GG GG V' D D D V' E E E f7 I I I f<6 8 8 8 f9< > > > f<M O O O f?E G G G f<< > > > vO I K K K vL 0 2 2 2 vL 0 2 2 2 vL 0 2 2 2 vJ 7 9 9 9 vJ = ? ? ? vM = ? ? ? vO ? A A AM( R ur&)rrr)r,r-r.rArGrHs@r$rr:s=++++++++++r&rc2eZdZdZfdZdddefdZxZS) AddonGSMRzQAn Addon that can be found on either classic GSM SIM or on UICC to support GSM-R.cntg}tdd|dS)NzGSM-Rz Railway GSM)r> files_in_mf)rr@rA)rrrDs r$rAzAddonGSMR.__init__ks8 KK  }%HHHHHr&cardCardBasercL||jdjS)Nr) file_existsrr;)rrs r$probezAddonGSMR.probeqs! 0 3 7888r&)r,r-r.rErArrrGrHs@r$rrise[[IIIII 9*999999999r&rN))rE pySim.utilsstructrr constructrrrr r r r r COptionalosmocom.construct pySim.profilerpySim.filesystemAdapterr LinFixedEFr0rJrWEnumByter TransparentEFrhrrrrrrrrCardDFrrr)r&r$r(ss4QQQQQQQQQQQQQQQQQQ++++++******     w    7 7 7 7 7J 7 7 7GD&&&&&G&&&RTDT%)d$@@@ >>>>>=>>>, = = = = =: = = = F F F F F- F F FFFFFF*FFF2GGGGGJGGG" ' ' ' ' 'J ' ' '>>>>>:>>>&J< G G G G G] G G G,,,,,,,,^ 9 9 9 9 9 9 9 9 9 9r&