*gX !dZddlmZddlmZddlmZmZmZmZm Z ddlm Z m Z m Z m Z ddlmZmZmZmZddlmZmZmZmZddlmZmZmZmZmZmZdd lmZdd l m!Z!Gd d ed Z"GddedZ#GddedZ$GddedZ%GddedZ&e efidddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrZ'GdsdteduZ(GdvdwedxZ)Gdydzed{Z*Gd|d}ed~Z+GddedZ,GddedZ-GddedZ.GddedZ/GddedZ0GddedZ1GddedZ2GddedZ3GddedZ4GddedZ5GddedZ6GddedZ7GddedZ8GddedZ9GddedZ:GddedZ;GddedZ<GddedZ=GddedZ>GddedZ?GddedZ@GddedZAGddedìZBGdĄdedƬZCGdDŽdedɬZDGdʄded̬ZEGd̈́dedϬZFGdЄdedҬZGGdӄdedլZHGdքdedجZIGdلded۬ZJGd܄dedެZKGd߄dedZLGddedZMGddedZNGddedZOGddedZPGddedZQGddedZRGddedZSGddedZTGddedZUGddedZVGddedZWGddedZXGddedZYGd d ed ZZGd d edZ[GddedZ\GddedZ]GddedZ^GddedZ_GddedZ`Gdded ZaGd!d"ed#ZbGd$d%ed&ZcGd'd(ed)ZdGd*d+ed,ZeGd-d.ed/ZfGd0d1ed2ZgGd3d4ed5ZhGd6d7ed8ZiGd9d:ed;ZjGd<d=ed>ZkGd?d@edAZlGdBdCedDZmGdEdFedGZnGdHdIedJZoGdKdLedZpGdMdNedOZqGdPdQedRZrGdSdTedUZsGdVdWedXZtGdYdZedZuGd[d\ed]ZvGd^d_edجZwGd`daedbZxGdcddedeZyGdfdgedhZzGdidjedkZ{Gdldmed#e)e"e/gnZ|Gdodpede)e&gnZ}Gdqdredse)e,e7gnZ~GdtduedvZGdwdxed8e)e"e%e$e5egnZGdydzed{ZGd|d}ed~ZGddedHZGddedrZGddedZGddedZGddedZGddedZGddedZGddedZGddedZGddedZGddedZGddedZGdded@ZGddedZGddedZGddedZGddedZGddedge;e)eee"e$eexee5ejeeUekeleeeeeeeQeOeeeeyeze{ee=e[enZGddedZGddede)e3gnZGddedZGddedZGddedZGddede)eegnZGdded¬ZGdÄdedŬZGdƄdeZGdȄdee|e}eeeeeegʦZGd˄dede(e)e4eTe#e>e\eceseveheng nZGd̈́dede(e)gnZGdτded e(e)e*gnZGdфded"e(e)gnZGdӄded$e(e)e;gnZGdՄded&e(e)e#e"ewe%e$e*e>e#e\ecexg nZGdׄded(e(e)e#e0e>e\ecgnZGdلded*e(e)e#e3e>e\ecgnZGdۄded,e(e)e#e"e/e>e\ecgnZGd݄ded.e(e)e#eEe>e\ecgnZGd߄ded0e(e)eHeIeJeKe1e#e>e\ece[g nZGdded2e(gnZGdded4e(e)e#e2e*e>e\ecgnZGdded6e(e)e1e>eDe*e\ecgnZGdded8e(e)e1e>e*e\ecgnZGdded:e(e)e1e-e9e>e\ece*g nZGddede?e\ebecg nZGdded>e(e)e#e:e>e?e\ebgnZGdded@e(e)gnZGddedBe(e)eAeBgnZGddedDe(e)e1e>e\ecgnZGddedFe(e)e@gnZGddedHe(e)gnZGddedJe(e)gnZGddedLe(e)gnZGddedNe(e)e#eCe>e\ecgnZGddedPe(e)eFgnZGddedRe(e)e#e>e"e$e*eMePe[eRe1eSeZe\ecgnZGddedTe(e)e#e>e\ecgnZGddedVe(e)e#e>eOe\ecgnZGddedXe(e)e#e>eNe\ecgnZGd d edZe(e)gnZGd d ed\e(e)e#e>eXeWe\ecgnZGd ded^e(e)e#e>eYe\ecgnZGdded`e(e)eVeSgnZGddedbe(e)eceagnZGddedde(e)gnZGddedfe(e)e#ede4efeee\ecg nZGddedhe(e)e#e>e4eee\ecgnZGddedje(e)e4eeeDecgnZGddedle(e)eggnZGddedne(e)eignZGdd edpe(e)eoeqepgnZGd!d"edre(e)ergnZGd#d$ede(gnZGd%d&egeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee‘eÑeđeőeƑeǑeȑeɑeʑʦZGd'd(ee(e)e.e*e1e,eNeOeQePeMg ʦZidd)dd*d d+d"d,d$d*d-d.d/d0d1d2dd3d4d2dd2d5d6d7d2d8d9d:d;d&d<d(d=id*d>d,d?d.d@d0dAd2dBdCdDdEdFdGdHdIdJdKdLd~dMdNdOdPdQdRdSd4dTd6dUd8dVid:dWd<dXd>dYd@dZdBd[dDd\d]d^dvd_d`dadbdcdddedfdgdhdidFdjdHdkdJdldLdmidNdndPdodpdqdrdsdtdudvdwdxdydzd{d|d}dRd2dTd~dVddXdTdZdd\dd^dd`didddddddddddddddddddddfddhddjddddddddudddddddZΐdS(zCode related to the Card Application Toolkit (CAT) as described in mainly) ETSI TS 102 223, ETSI TS 101 220 and USIM Application Toolkit (SAT) as described in 3GPP TS 31.111.)List)bidict)Int8ubInt16ubByteBytes BitsInteger)StructEnum BitStructthis) GreedyBytesSwitch GreedyRange FlagsEnum)TLV_IE COMPR_TLV_IE BER_TLV_IETLV_IE_Collection) PlmnAdapter BcdAdapter HexAdapterGsmStringAdapterTonNpi GsmString)b2h)dec_xplmn_w_actcDeZdZedez deez ZdS)Addresston_npi call_numberN)__name__ __module__ __qualname__r rrr _construct7/home/jenkins/workspace/simtester-sanitize/pySim/cat.pyrr"s8 &(%jj&=&==??JJJr'r)tagceZdZdS)AlphaIdentifierNr"r#r$r&r'r(r,r,'Dr'r,ceZdZdS) SubaddressNr-r&r'r(r1r1,Dr'r1ceZdZdS)CapabilityConfigParamsNr-r&r'r(r5r50r2r'r5ceZdZdS)CBSPageNr-r&r'r(r8r84r2r'r8refresh more_time poll_interval polling_offset_up_event_list set_up_callsend_ss send_ussdsend_short_message send_dtmflaunch_browsergeo_location_req play_tone display_text! get_inkey" get_input# select_item$ set_up_menu%provide_local_info&timer_management'set_up_idle_mode_text(perform_card_apdu0 power_on_card1power_off_card2get_reader_status3run_at_command4language_notification5 open_channel@ close_channelA receive_dataB send_dataCget_channel_statusDservice_searchEget_service_infoFdeclare_serviceG set_framesPget_frames_statusQ retrieve_mms` submit_mmsa display_mmsbactivatepcontactless_state_changedqcommand_containerrencapsulated_session_controlsc:eZdZedez dez dez ZdS)CommandDetailscommand_numbertype_of_commandcommand_qualifierN)r"r#r$r r TypeOfCommandr%r&r'r(rrFs7(/)-7+F244JJJr'rceZdZeiddddddddd d d d d ddddddddddddddddddd d!d"id#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGZdHefdIZdJZdKS)LDeviceIdentitiesr;keypadr=displayr?earpiecerEaddl_card_reader_0rGaddl_card_reader_1rIaddl_card_reader_2rKaddl_card_reader_3rMaddl_card_reader_4rOaddl_card_reader_5rQaddl_card_reader_6addl_card_reader_7rU channel_1rW channel_2rY channel_3r[ channel_4r] channel_5r_ channel_6ra channel_7rg ecat_client_1ri ecat_client_2rk ecat_client_3rm ecat_client_4ro ecat_client_56 ecat_client_67 ecat_client_78 ecat_client_89 ecat_client_9: ecat_client_a; ecat_client_b< ecat_client_c= ecat_client_d> ecat_client_e? ecat_client_fruiccterminalnetwork)docP|j|d|j|ddS)Nrr;) source_dev_id dest_dev_id)DEV_IDS)selfrs r( _from_byteszDeviceIdentities._from_bytests)!%be!4T\RTUVRWEXYYYr'c|jj|jd}|jj|jd}t||gS)Nrr)rinversedecodedbytes)rsrcdsts r( _to_byteszDeviceIdentities._to_bytesws@l"4<#@Al"4< #>?c3Z   r'N)r"r#r$rrrrrr&r'r(rrLsf% h% i% j% " % " % " % "% "% "% "% "% k% k% k% k% k!%" k#%%$ k%%& o'%( o)%* o+%, o-%. o/%0 o1%2 o3%4 o5%6 o7%8 o9%: o;%< o=%> o?%@ oA%B oC%D fE%%FI%%%%%GNZeZZZZ!!!!!r'rrc LeZdZedeedddz dez ZdS)Duration time_unitrr;r=)minutessecondstenths_of_seconds time_intervalNr"r#r$r r rr%r&r'r(rr}sB DDAYZ$[$[$[['.00JJJr'rcDeZdZedez deez ZdS)Item identifier text_stringN)r"r#r$r rrrr%r&r'r(rrs< V+%&6&6{&C&CCEEJJJr'rc*eZdZedez ZdS)ItemIdentifierrNr"r#r$r rr%r&r'r(rr" V+,,JJJr'rc2eZdZedez dez ZdS)ResponseLengthminimum_lengthmaximum_lengthNrr&r'r(rrs/(/(/11JJJr'rcPeZdZeefiddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJZeedddd d ddddddK ZeedddLZeeddddd d ddddM Zeeddddd NZ eeddddd d dddddddOZ eeddddd d PZ e dQez dRe ejeeee e e dSeeTz ZdUS)VResultperformed_successfullyr$performed_with_partial_comprehensionr;"performed_with_missing_informationr=$refresh_performed_with_addl_efs_readr?2porformed_successfully_but_reqd_item_not_displayedrA-performed_but_modified_by_call_control_by_naarC&performed_successfully_limited_serviceperformed_with_modification2refresh_performed_but_indicated_naa_was_not_active&performed_successfully_tone_not_played )proactive_uicc_session_terminated_by_userrE9backward_move_in_proactive_uicc_session_requested_by_userrGno_response_from_userrI!help_information_required_by_userrK$terminal_currently_unable_to_processrS#network_currently_unable_to_processrU!user_did_not_accept_proactive_cmdrW%user_cleared_down_call_before_releaserY0action_in_contradiction_with_current_timer_stater[.interaction_with_call_control_by_naa_temporaryr]launch_browser_generic_errorr_mms_temporary_problemra"command_beyond_terminal_capabilityre'command_type_not_understood_by_terminalrg'command_data_not_understood_by_terminalri$command_number_not_known_by_terminalrkerror_required_values_missingrmultiple_card_commands_errorr!bearer_independent_protocol_errorr+access_technology_unable_to_process_commandr frames_errorr mms_errorr)ussd_or_ss_transaction_terminated_by_userrMss_return_errorrm sms_rp_errorroussd_return_errorr6interaction_with_cc_by_usim_or_mo_sm_by_usim_permanentr) no_specific_causescreen_is_busyterminal_currently_busy_on_call no_serviceaccess_control_class_barradio_resource_not_grantednot_in_speech_call$terminal_currently_busy_on_send_dtmf no_naa_active#me_currently_busy_on_ss_transaction%me_currently_busy_on_ussd_transaction)raction_not_allowedthe_type_of_request_has_changed) r"card_reader_removed_or_not_presentcard_removed_or_not_presentcard_reader_busycard_powered_offcapdu_format_error mute_cardtransmission_errorprotocol_not_supportedspecified_reader_not_valid)rbearer_unavailablebrowser_unavailable)terminal_unable_to_read_provisioning_datadefault_url_unavailable) rno_channel_availabilechannel_closedchannel_id_not_valid#requested_buffer_size_not_availablesecurity_error,requested_uicc_if_transp_level_not_availableremote_device_not_reachable service_errorservice_identifer_unknownport_not_available&launch_parameters_missing_or_incorrectapplication_launch_failed)rframe_identifier_not_valid*num_of_frames_beyond_terminal_capabilitiesno_frame_definedrequested_size_not_supporteddefault_active_frame_not_validgeneral_resultadditional_information)rrrr rrdefaultN)r"r#r$r r GeneralResultAddlInfoTermProblemAddlInfoCallControlAddlInfoMultipleCardAddlInfoLaunchBrowser AddlInfoBipAddlInfoFramesr rr rHrrr%r&r'r(rrsD*V*V*V01*V?@a*V=>A *V ?@a *V MNA *VHIq*VAB*V67Q*VMNA*VAB*VDH4*VTXSW*V04t*V<@4*V"?Cd#*V$>BT%*V&<@4'*V(@Dt)*V*KO$+*V,IM-*V.7;d/*V004t1*V4=AD5*V6BF7*V8BF9*V:?Cd;*V<87;d?*VB<@4C*VDFJTE*VF'+dG*VH$(4I*VLDH4M*VN*.O*VP'+dQ*VR,04S*VTQUPTU*VMX$v26/3@D+/9=;?37EI.2DHFJ L L Lf2637@DFFF  426CG<@151537*.377;;? A A A!D263748JN8< >>>$v$6:/359DH/3MQ<@.2:>37GK:> @ @ @KT&26;?KO15=A?C EEEN(608KDWViP$Q$QSOf %jj&=&==??JJJr'r]c eZdZedeefidddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9z Zd:S);Tonetone dial_toner;called_subscriber_busyr= congestionr?radio_path_acknowledgerAradio_path_not_availablerCerror_special_inforcall_waiting_toner ringing_toner general_beeprEpositive_ack_tonerGnegative_ack_or_error_tonerIringing_tone_speechrKalert_tone_smsrMcritical_alertrO vibrate_onlyrS happy_toneresad_tonergurgent_action_toneri question_tonerkmessage_received_tonermmelody_1rqmelody_2rsmelody_3rumelody_4rwmelody_5rymelody_6r{melody_7r}melody_8rNrr&r'r(rdrdsttF ; ; ;dd ;CG4 ;7;t ;DH4 ;FJT  ; @Dt  ; ?Cd  ;:> ;:> ;?Cd ;HLt ;AE ;<@4 ;<@4 ;:> ;8+>>@@JJJr'rc$eZdZeeZdS)CApduNr"r#r$rrr%r&r'r(rrrr'rceZdZeZdS)TimerIdentifierNr"r#r$rr%r&r'r(rrJJJr'rc:eZdZedez dez dez ZdS) TimerValuehourminutesecondNrr&r'r(rrs-v xHHJJJr'rc$eZdZeeZdS) AtCommandNrr&r'r(rrrr'rceZdZdS)ImmediateResponseNr-r&r'r(rrr2r'rc$eZdZeeZdS) DtmfStringNrr&r'r(rrrr'rc$eZdZeeZdS)LanguageNrr&r'r(rrrr'rcJeZdZedeeddz dez ZdS) TimingAdvance me_statusrr;) in_idle_statenot_in_idle_statetiming_advanceNrr&r'r(rrs@ DDqTU$V$V$VV(/11JJJr'rc0eZdZeedddddZdS)BrowserIdentityrr;r=r?rA)rKwmlhtmlxhtmlchtmlNrr&r'r(r r s*faQQaqIIIJJJr'r c$eZdZeeZdS)UrlN)r"r#r$rrr%r&r'r(rrs;''JJJr'rcDeZdZeeddddZeeZdS)Bearerrr;r=r?)smscsdussdpacket_ServiceN)r"r#r$r r SingleBearerrr%r&r'r(rrs74A11QGGGL\**JJJr'rc$eZdZeeZdS)ProvisioningFileReferenceNrr&r'r(rrrr'rc*eZdZeeddZdS)BrowserTerminationCauserr;)user_terminationerror_terminationNrr&r'r(rrs$fqAFFFJJJr'rceZdZddddfgZedez dez dez Zedez d ez d ez d ez d ez d eeddz Zedez de z de z de z de z dez dez dez dez dez dez dez d eeddz Z edez Z edeeddd d!d"d#d$d%d&d'dd(d!)z d*e e jeee e d+ee,z Zd-S).BearerDescriptionb50103rK)bearer_parameters bearer_type data_ratebearer_serviceconnection_elementprecendence_classdelay reliabilitypeak_throughputmean_throughputpdp_typer=r)ipnon_ip traffic_classmax_bitrate_ulmax_bitrate_dlguaranteed_bitrate_ulguaranteed_bitrate_dldelivery_order max_sdu_size sdu_err_ratio residual_berdelivery_of_erroneous_sdutransfer_delaytraffic_handling_prioritypdu_session_typer'r;rrrrr?rArCrr) rpacket_grps_utran_eutranpacket_with_extd_paramswlanpacket_eutran_mapped_utranng_ranrK local_link bluetoothirdars232cdma2000usbr&)rr@rArDrJN)r"r#r$rar r BearerParsCsr BearerParsPacketrBearerParsPacketExtBearerParsNgRanrr r'rrr%r&r'r(r#r#s "YGGIO6+f,*61.v577Lv1&8%fn+F2/6/6(fd)K)K)KK MM!&!7!1'!9!1'!9!8!@!8!@!1&!8!/!6!0!7!/!6!VWCDUV)X)X)XX&g-//JJJr'rgc<eZdZedeez ZdS)AidaidNrVr&r'r(rsrss,jj55566JJJr'rscReZdZeeddddddddd d d ZeeZd S)AccessTechnologyrr;r=r?rArCrrrrr) gsm tia_eia_533tia_eia_136_270utrantetra tia_eia_95_b cdma1000_1x cdma2000_hrpdeutranehrpdnrN)r"r#r$r rSingleAccessTechrr%r&r'r(rwrwsUtFq!ST\]12QR[\*+666-..JJJr'rwcneZdZeedddddZedez dez d eez Z d S) ServiceRecordrr;r=r?rA)technology_independentrFrGrHrJlocal_bearer_technologyservice_identifierservice_recordN) r"r#r$r r BearerTechIdr rrr%r&r'r(rr!sa4qAAUV\]^^^L1,>,V3(K)@)@@BBJJJr'rcNeZdZedejz deez ZdS) DeviceFilterr device_filterN r"r#r$r rrrrr%r&r'r(rr(s>1-2LL' ;(?(??AAJJJr'rcNeZdZedejz deez ZdS)ServiceSearchIErrzNrr&r'r(rr-s>1-2LL(K)@)@@BBJJJr'rcNeZdZedejz deez ZdS)AttributeInformationrattribute_informationNrr&r'r(rr2s>1-2LL/ ;0G0GGIIJJJr'rc\eZdZedeeddz deez ZdS)RemoteEntityAddress coding_typerr;) ieee802_16rGraN) r"r#r$r r rrrr%r&r'r(rr8sI dd6aa&H&H&HH!**["9"99;;JJJr'rc*eZdZdgZeeZdS)NetworkAccessName) c704036e6161036e6161N)r"r#r$rarrr%r&r'r(rr=s)&OK((JJJr'rceZdZdS) TextAttributeNr-r&r'r(rrDr2r'rceZdZdS)PdpContextActivationParamsNr-r&r'r(rrHr2r'rc 8eZdZeeddddddddd Zd S) UtranEutranMeasurementQualifierr;r=r?rArCrrrr) utran_intra_frequtran_inter_frequtran_inter_rat_geranutran_inter_rat_eutraneutran_intra_freqeutran_inter_freqeutran_inter_rat_geraneutran_inter_rat_utraneutran_inter_rat_nrNrr&r'r(rrLs@f156:7;26267;7;48:::JJJr'rc*eZdZeeddZdS)NetworkSearchModerr;)manual automaticNrr&r'r(rrXs$fQ!444JJJr'rc0eZdZeedddddZdS) BatteryStaterr;r=r?rC)very_lowlowaveragegoodfullNrr&r'r(rr\s*fqaKKKJJJr'rc\eZdZedeeddz deez ZdS) FrameLayoutlayoutr;r=) horizontalverticalrelative_sized_frameN)r"r#r$r r rrr%r&r'r(rr`sKfQ!G!G!GG.{{6/B/BBDDJJJr'rc$eZdZeeZdS)ItemTextAttributeListNrr&r'r(rrdrr'rc*eZdZedez ZdS)FrameIdentifierrNrr&r'r(rrhrr'rc$eZdZeeZdS)MultimediaMessageReferenceNrr&r'r(rrlrr'rc$eZdZeeZdS)MultimediaMessageIdentifierNrr&r'r(rrprr'rc$eZdZeeZdS)MmContentIdentifierNrr&r'r(rrtrr'rc*eZdZedez ZdS)ActivateDescriptortargetNrr&r'r(rrxs!((JJJr'rceZdZdefdZdS) PlmnWactListrc g}d}|t|krR|tt|||dz|dz }|t|kR|S)NrrC)lenappendrr)rrris r(rzPlmnWactList._from_bytes}sh  #b''kk HH_SAacE^^44 5 5 5 FA#b''kkr'N)r"r#r$rrr&r'r(rr|s/er'rc*eZdZeeddZdS)ContactlessFunctionalityStaterr;)enableddisabledNrr&r'r(rrs$fa!444JJJr'rc eZdZedeedz deedz dez ZdS)RoutingAreaIdentificationmcc_mncr?lacr=racN) r"r#r$r rrrrr%r&r'r(rrsY ++eeAhh"7"77jjq222f &&JJJr'rceZdZeefiddddddddd d d d d ddddddddddddddddddd d!d"d#d$Zd%S)&UpdateAttachRegistrationTypenormal_location_updating_lurperiodic_updating_lur;imsi_attach_lur= gprs_attachr?combined_gprs_imsi_attachrAra_updating_raurCcombined_ra_la_updting_raur+combined_ra_la_updting_with_imsi_attach_raurperiodic_updating_raureps_attach_emmrcombined_eps_imsi_attach_emmrta_updating_taurcombined_ta_la_updating_taur,combined_ta_la_updating_with_imsi_attach_taurperiodic_updating_taurinitial_registration_5grrr#mobility_registration_updating_5grrrE#periodic_registration_updating_5grrrGNrr&r'r(rrsfJJJDDJ59TJ/3tJ-1DJ;?$ J 15 J <@4 JMQDJ7;dJ04tJ>BTJ15J=ADJNRTJ7;dJ;?$J EID!J"EID#JJJJr'rceZdZeZdS)RejectionCauseCodeNrr&r'r(rrrr'rceZdZedez dez deeddddz d eedddd dd d z deedddd z dez ZdS)GeographicalLocationParametershorizontal_accuracyvertical_coordinatevelocityrr;r=rA)horizontal_requestedvertical_requested horizontal_uncertainty_requestedvertical_uncertainty_requestedpreferred_gad_shapesr?rCr)ellipsoid_point'ellipsoid_point_with_uncertainty_circle(ellipsoid_point_with_uncertainty_ellipseellipsoid_point_with_altitudepolygon7ellipsoid_point_with_altitude_and_uncertainty_ellipsoid ellipsoid_arcpreferred_nmea_sentences)rmcggagllgnspreferred_maximum_response_timeN)r"r#r$r rrr%r&r'r(rrs-f4-f4"99V!`aNOLM$O$O$OO/yyQRabbcWXABqrGH 0J0J0JJ399VPQWX^_3`3`3``9&@ B BJJJr'rcNeZdZedeedz ZdS)PlmnListrr?N)r"r#r$rrrr%r&r'r(r r s4Y{{5588'<'<<==JJJr'r cveZdZeedddddZedez dedz Zd S) EcatSequenceNumberr=rr;r?)rterminal_response envelope_profile_container_event#envelope_profile_container_responsecommand_type_indicatorcounterrQN)r"r#r$r r CmdTypeIndicatorr r%r&r'r(r#r#sitKKNNa>?MNPQSSS34DD$[[__466JJJr'r#c$eZdZeeZdS)EncryptedTlvListNrr&r'r(r,r,rr'r,c$eZdZeeZdS)MacNrr&r'r(r.r.rr'r.c$eZdZeeZdS) SaTemplateNrr&r'r(r1r1rr'r1c,eZdZeedddZdS)RefreshEnforcementPolicyrr;r=)even_if_navigating_menuseven_if_data_calleven_if_voice_callN)r"r#r$rrr%r&r'r(r4r4s'4!qefgggJJJr'r4c$eZdZeeZdS)DnsServerAddressNrr&r'r(r:r:rr'r:cheZdZedejz deedz Ze eZ dS) SupportedRadioAccessTechnologies technologystater)rN) r"r#r$r rwrrrAccessTechTuplerr%r&r'r(r=r=sRf\*:*KK$YYvq%A%A%AACCO_--JJJr'r=ceZdZdS)ApplicationSpecificRefreshDataNr-r&r'r(rBrBr2r'rBceZdZdS)ImsUriNr-r&r'r(rErEr2r'rEc*eZdZeeddZdS) MediaTyperr;)voicevideoN)r"r#r$rrr%r&r'r(rGrGs$6!444JJJr'rGc,eZdZeedddZdS)DataConnectionStatusrr;r=) successfulrejecteddropped_or_deactivatedNrr&r'r(rLrLs&fQqQQQJJJr'rLc,eZdZeedddZdS)DataConnectionTyperr;r=)pdppdnpduNrr&r'r(rRrRs&f!222JJJr'rRceZdZeZdS)SmCauseNrr&r'r(rXrXrr'rXceZdZdS) SMSPPDownloadNr-r&r'r(r[r[r.r'r[)r*nestedceZdZdS) SMSCBDownloadNr-r&r'r(r^r^r.r'r^ceZdZdS) MenuSelectionNr-r&r'r(r`r`r.r'r`ceZdZdS)BcRepeatIndicatorNr-r&r'r(rcrcr2r'rc*ceZdZdS) CallControlNr-r&r'r(rfrf  Dr'rfceZdZdS)MoShortMessageControlNr-r&r'r(ririr2r'riceZdZdS)TransactionIdentifierNr-r&r'r(rlrlr2r'rlrceZdZdS)ImsURINr-r&r'r(rnrnr2r'rnceZdZdS) UriTruncatedNr-r&r'r(rprpr2r'rpceZdZdS)TrackingAreaIdentificationNr-r&r'r(rrrr#r2r'rr}ceZdZdS)ExtendedRejectionCauseCodeNr-r&r'r(ruru'r2r'rurcceZdZdS)CsgCellSelectionStatusNr-r&r'r(rwrw+r2r'rwUceZdZdS)CsgIdNr-r&r'r(rzrz/r2r'rzVceZdZdS)HnbNameNr-r&r'r(r}r}3r2r'r}ceZdZdS)PlmnIdNr-r&r'r(rr7r2r'rrceZdZdS)ImsCallDisconnectionStatusNr-r&r'r(rr;r2r'rceZdZdS)IariNr-r&r'r(rr?r2r'rvceZdZdS)ImpuListNr-r&r'r(rrCr2r'rwceZdZdS) ImsStatusCodeNr-r&r'r(rrGr2r'rceZdZdS)DateTimeAndTimezoneNr-r&r'r(rrKr2r'rceZdZdS) PdpPdnPduTypeNr-r&r'r(rrOr2r'rrceZdZdS)GadShapeNr-r&r'r(rrSr2r'rceZdZdS) NmeaSentenceNr-r&r'r(rrWr2r'rxceZdZdS)WlanAccessStatusNr-r&r'r(rr[r2r'rKceZdZdS) EventDownloadNr-r&r'r(rr_s^ Dr'rceZdZdS)TimerExpirationNr-r&r'r(rrr2r'rceZdZdS) USSDDownloadNr-r&r'r(rrr.r'rceZdZdS)MmsTransferStatusNr-r&r'r(rrr2r'rceZdZdS)MmsNotificationDownloadNr-r&r'r(rrr2r'rceZdZdS)TerminalApplicationNr-r&r'r(rrr2r'rceZdZdS)GeographicalLocationNr-r&r'r(rrr.r'rceZdZdS)EnvelopeContainerNr-r&r'r(rrr2r'rceZdZdS) ProSeReportNr-r&r'r(rrr2r'rceZdZdefdZdS) ProactiveCmdreturncdS)Nrr&rs r( _compute_tagzProactiveCmd._compute_tagstr'N)r"r#r$intrr&r'r(rrs/cr'rceZdZdS)EventCollectionNr-r&r'r(rr Dr'r)r\ceZdZdS)RefreshNr-r&r'r(rrrr'rceZdZdS)MoreTimeNr-r&r'r(rrr.r'rceZdZdS) PollIntervalNr-r&r'r(rrr.r'rceZdZdS) PollingOffNr-r&r'r(rrr.r'rceZdZdS)SetUpEventListNr-r&r'r(rrr.r'rceZdZdS) SetUpCallNr-r&r'r(rrrr'rceZdZdS)SendSSNr-r&r'r(rrrgr'rceZdZdS)SendUSSDNr-r&r'r(rrrgr'rceZdZdS)SendShortMessageNr-r&r'r(rrrgr'rceZdZdS)SendDTMFNr-r&r'r(rrrgr'rceZdZdS) LaunchBrowserNr-r&r'r(rrrr'rceZdZdS)GeographicalLocationRequestNr-r&r'r(rrr.r'rceZdZdS)PlayToneNr-r&r'r(rrrgr'rceZdZdS) DisplayTextNr-r&r'r(rr rgr'rceZdZdS)GetInkeyNr-r&r'r(rrrgr'rceZdZdS)GetInputNr-r&r'r(rrrgr'rceZdZdS) SelectItemNr-r&r'r(rrrr'rceZdZdS) SetUpMenuNr-r&r'r(rr$rr'rceZdZdS)ProvideLocalInformationNr-r&r'r(rr+r.r'rceZdZdS)TimerManagementNr-r&r'r(rr0r.r'rceZdZdS)SetUpIdleModeTextNr-r&r'r(rr5rgr'rceZdZdS)PerformCardApduNr-r&r'r(rr;r.r'rceZdZdS) PowerOnCardNr-r&r'r(rr@r.r'rceZdZdS) PowerOffCardNr-r&r'r(rrEr.r'rceZdZdS)GetReaderStatusNr-r&r'r(rrJr.r'rceZdZdS) RunAtCommandNr-r&r'r(rrOrgr'rceZdZdS)LanguageNotificationNr-r&r'r(rrUr.r'rceZdZdS) OpenChannelNr-r&r'r(rrZs  Dr'rceZdZdS) CloseChannelNr-r&r'r(rrbrgr'rceZdZdS) ReceiveDataNr-r&r'r(rrhrgr'rceZdZdS)SendDataNr-r&r'r(rrnrgr'rceZdZdS)GetChannelStatusNr-r&r'r(rrtr.r'rceZdZdS) ServiceSearchNr-r&r'r(rryrgr'rceZdZdS)GetServiceInformationNr-r&r'r(rrrgr'rceZdZdS)DeclareServiceNr-r&r'r(rrr.r'rceZdZdS) SetFramesNr-r&r'r(rrr.r'rceZdZdS)GetFramesStatusNr-r&r'r(rrr.r'rceZdZdS)RetrieveMultimediaMessageNr-r&r'r(rrrr'rceZdZdS)SubmitMultimediaMessageNr-r&r'r(rrrgr'rceZdZdS)DisplayMultimediaMessageNr-r&r'r(r r rgr'r ceZdZdS)ActivateNr-r&r'r(r r r.r'r ceZdZdS)ContactlessStateChangedNr-r&r'r(rrr.r'rceZdZdS)CommandContainerNr-r&r'r(rrr.r'rceZdZdS)EncapsulatedSessionControlNr-r&r'r(rrr.r'rceZdZdZdS)ProactiveCommandBasecV|jD] }t|jdkr|cSdSdS)Nr)childrentyper")rcs r(find_cmd_detailsz%ProactiveCommandBase.find_cmd_detailssB  AAww#333tt   r'N)r"r#r$rr&r'r(rrs#r'rcLeZdZdZifdededeefdZdZ ifdefdZ dS) ProactiveCommandaoClass representing a CAT proactive command, as (for example) sent via a FETCH response. Parsing this is more difficult than any normal TLV IE Collection, because the content of one of the IEs defines the definitions of all the other IEs. So we first need to find the CommandDetails, and then parse according to the command type indicated in that IE data.binarycontextrcFt}|||}tj|jd}||jvr7|j|}|}||\}} ||_n||_|jS)Nr)rfrom_tlvrr encmappingrmembers_by_tag) rrrpcmd cmd_detailscmd_typeclsinst_dec remainders r( from_byteszProactiveCommand.from_bytess#%% f++--  +K,?@Q,RS t* * *%h/C355D"mmF33OD)DLLDL|r'c4|jSN)rto_dictrs r(r,zProactiveCommand.to_dicts|##%%%r'c4|jSr+)rto_tlv)rrs r(to_byteszProactiveCommand.to_bytess|""$$$r'N) r"r#r$__doc__rdictrrr)r,r/r&r'r(rrs669;tF|&&&&(*%%%%%%%%r'rceZdZdS)TerminalResponseNr-r&r'r(r3r3s Dr'r3zProfile downloadzSMS-PP data downloadzCell Broadcast data downloadzMenu selectionrzTimer expirationrz$USSD string DO support in CC by USIMrzCall Control by NAAzCommand resultrrz MO short message control supportrrzUCS2 Entry supportedrzUCS2 Display supportedz Display TextzProactive UICC: DISPLAY TEXTzProactive UICC: GET INKEYzProactive UICC: GET INPUTzProactive UICC: MORE TIMEzProactive UICC: PLAY TONEzProactive UICC: POLL INTERVALrzProactive UICC: POLLING OFFrzProactive UICC: REFRESHrzProactive UICC: SELECT ITEMz5Proactive UICC: SEND SHORT MESSAGE with 3GPP-SMS-TPDUrzProactive UICC: SEND SSzProactive UICC: SEND USSDrzProactive UICC: SET UP CALLzProactive UICC: SET UP MENUzIProactive UICC: PROVIDE LOCAL INFORMATION (MCC, MNC, LAC, Cell ID & IMEI)z/Proactive UICC: PROVIDE LOCAL INFORMATION (NMR)z!Proactive UICC: SET UP EVENT LISTzEvent: MT callzEvent: Call connectedzEvent: Call disconnectedzEvent: Location statuszEvent: User activityzEvent: Idle screen availablezEvent: Card reader status)zEvent: Language selectionzEvent: Browser Termination+zEvent: Data aailable,zEvent: Channel status-zEvent: Access Technology Change.z!Event: Display parameters changed/zEvent: Local Connectionz!Event: Network Search Mode ChangezProactive UICC: POWER ON CARDzProactive UICC: POWER OFF CARDz"Proactive UICC: PERFORM CARD RESETz6Proactive UICC: GET READER STATUS (Card reader status)z:Proactive UICC: GET READER STATUS (Card reader identifier)rz.Proactive UICC: TIMER MANAGEMENT (start, stop)rz4Proactive UICC: TIMER MANAGEMENT (get current value)rzDProactive UICC: PROVIDE LOCAL INFORMATION (date, time and time zone)rz GET INKEYrzSET UP IDLE MODE TEXTrzRUN AT COMMANDrz SETUP CALLz DISPLAY TEXTzSEND DTMF commandz4Proactive UICC: PROVIDE LOCAL INFORMATION (language)z:Proactive UICC: PROVIDE LOCAL INFORMATION (Timing Advance)z%Proactive UICC: LANGUAGE NOTIFICATIONzProactive UICC: LAUNCH BROWSERHz=Proactive UICC: PROVIDE LOCAL INFORMATION (Access Technology)Iz!Soft keys support for SELECT ITEMJz&Soft keys support for SET UP MENU ITEMYzProactive UICC: OPEN CHANNELZzProactive UICC: CLOSE CHANNEL[zProactive UICC: RECEIVE DATA\zProactive UICC: SEND DATA]z"Proactive UICC: GET CHANNEL STATUS^zProactive UICC: SERVICE SEARCH_z'Proactive UICC: GET SERVICE INFORMATIONzProactive UICC: DECLARE SERVICEzBIP supported Bearer: CSDzBIP supported Bearer: GPRSczBIP supported Bearer: BluetoothdzBIP supported Bearer: IrDAezBIP supported Bearer: RS232z0BIP: TCP, UICC in client mode, remote connectionz0BIP: UDP, UICC in client mode, remote connectionzBIP: TCP, UICC in server modez/BIP: TCP, UICC in client mode, local connectionz/BIP: UDP, UICC in client mode, local connectionz!BIP: direct communication channel)rrrr/r)N)r0typingrr constructrrrrr r r r r rrrr osmocom.tlvrrrrosmocom.constructrrrrrr osmocom.utilsr pySim.utilsrrr,r1r5r8rrrrrrrrrTrYr]rdrrrrrrrrrrrrrrrrrrrrrr rrrrr#rQrTrWrZr]rgrsrwrrrrrrrrrrrrrrrrrrrrrrrrr r#r,r.r1r4r:r=rBrErGrLrRrXr[r^r`rcrfrirlrnrprrrurwrzr}rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r rrrrrr3term_prof_bitsr&r'r(rQsc1##(??????????????333333333333AAAAAAAAAAAAKKKKKKKKKKKKffffffffffffffff'''''' ?????l????      l         4         \t         l    V P P PTT PTT P P[_[_ P'+t P9= PGKt PW[W[ P(, P8< PMQT Pdhdh P $t P37$ PCG$ PSWRV Peidh P"& P;?$ PRVQU P ,04 P DH4 P X\W[ P %)D P =AD P RVQU P,04 P?Cd PSWRV Pfjei P $t P9= PNRT Peidh P&*T P7;d POSd Pbfae P!% P37$ PBF Pbfae P(,t PKO$ P 44444\t4444 .!.!.!.!.!|.!.!.!.!b00000|0000 EEEEE?????4???? 55555|5555      ,D    )))))>>>>|>>>>6666646666)))))|))))))))),D)))))))))4))))hhhhh|hhhh)))))|)))).....|....      \t         \t    55555 $5555RRRRRSZ\f+Z9JL.0C]!         S`!         ,D 0/>Sd0         | 0/>S^0         | 01         Ld 0/>Sbm_>         Ld 0/>Sg0         \t 0-AST         $ 0/;O         l 01         $ 0/C]-/JM!         l 0/>S[+]OM         | 0(OPNQR STUVWX YZ[`abcd9ef>ghDij/kl(mnGot+uv0wB&CD'EF&GH#IJ,KL(MN1OP)QV#WX$YZ)[\ %]^ &_l ;mn < ( : : ,wr'