+
   Gd                   f    ^ RI t ^ RIHt ^ RIHt  ! R R]4      t ! R R]4      t ! R R	4      tR# )
    N)Enum)Tuplec                   "    ] tR t^t^ t^t^tRtR# )	ValueType N)__name__
__module____qualname____firstlineno__INTARRAYSEQUENCE__static_attributes__r       3/usr/lib/python3.14/site-packages/ssc_server/qmi.pyr   r      s    
CEHr   r   c                   :    ] tR t^t^ t^t^t]P                  t	Rt
R# )MessageTyper   N)r   r	   r
   r   REQUESTRESPONSE
INDICATIONsysmaxsizeUNKNOWNr   r   r   r   r   r      s    GHJkkGr   r   c                      a  ] tR t^%t o Rt]V 3R lR l4       t]V 3R lR l4       t]V 3R lR l4       t]V 3R lR	 l4       t	R
t
V tR# )QMIz-QMI messages encoding and decoding functions.c                D   < V ^8  d   QhRS[ RS[S[S[S[S[ 3,          /# )   messagereturn)bytesr   r   int)format__classdict__s   "r   __annotate__QMI.__annotate__)   s-     -H -He -Hk3U.J(K -Hr   c                r   V ^ ,          \         P                  P                  8X  d   \         P                  pMV ^ ,          \         P                  P                  8X  d   \         P                  pMlV ^ ,          \         P                  P                  8X  d   \         P                  pM5\        RV ^ ,           2\        P                  R7       \         P                  p\        P                  V R,          RR7      p\        P                  V R,          RR7      p\        P                  V R,          RR7      pWW43# )a  
Parse a QMI header to extract:
  - Type of message (uint8)
  - Transaction ID (uint16)
  - Message ID (uint16)
  - Message length (uint16)

Parameters
----------
message : bytes
    Raw QMI message as bytes (little endian).

Returns
-------
message_type : MessageType
    Type of message e.g., REQUEST, RESPONSE, or INDICATION.
transaction_id : int
    ID of the transaction for concurrent messages.
message_id : int
    ID of the message, specific for the QMI service.
message_length : int
    Length of the message in bytes.
zUnknown message type: file:      Nlittle	byteorder:r*      Nr.      N)r   r   valuer   r   printr   stderrr   r!   
from_bytes)r   message_typetransaction_id
message_idmessage_lengths   &    r   parse_headerQMI.parse_header(   s    6 1:,,222&..LQZ;//555&//LQZ;11777&11L*71:,7cjjI&..L I ^^GCLH^E
 IZGGr   c                2   < V ^8  d   QhRS[ RS[RS[RS[/# )r   r5   r6   r7   r   )r   r!   r    )r"   r#   s   "r   r$   r%   Y   s+      k 3 TW \a r   c                   \        4       pW0P                  P                  ^RR7      ,          pW1P                  ^RR7      ,          pW2P                  ^RR7      ,          pV\        V4      ^,           P                  ^RR7      ,          pV# )aE  
Generate a QMI message with no TLVs and a QMI header.

Parameters
----------
message_type : MessageType
    Type of QMI message
transaction_id : int
    ID of the transaction.
message_id : int
    ID of the message for the specific QMI service.

Returns
-------
message : bytes
    Raw QMI message as bytes (little endian).
r+   r,   )r    r1   to_byteslen)r5   r6   r7   r   s   &&& r   generate_headerQMI.generate_headerX   s    ( '%%..qH.EE**1*AA&&qH&==CL1$..qH.EEr   c                L   < V ^8  d   QhRS[ RS[RS[RS[S[S[S[ 3,          /# )r   r   tlv
value_typer   )r    r!   r   r   )r"   r#   s   "r   r$   r%   u   s6     +3 +35 +3s +3	 +3eCQTV[OF\ +3r   c                N   \         P                  V 4      w  r4rVV R,          p^ p^ p	V\        V4      8  d   \        P	                  V^ V,           ^V,            RR7      p
\        P	                  V^V,           ^V,            RR7      pV^V,           ^V,           V,            pV^V,           ,          pV	^,          p	V\
        P                  8X  g   V\
        P                  8X  d   \        P	                  VRR7      pMV\
        P                  8X  d
   VR,          pW8w  d   K  WV3# R# )aL  
Parse QMI TLV in a QMI message to extract:
  - Type (uint8)
  - Length (uint16)
  - Value (bytes)

Parameters
----------
message : bytes
    Raw QMI message as bytes (little endian).

Returns
-------
tlvs : dict
    Dictionary of TLVs extracted with Type as dictionary's key
    and Value as dictionary's value. Length is implied.
r0   NNr+   r,   :r   NNN)	r   r9   r>   r!   r4   r   r   r   r   )r   rB   rC   r5   r6   r7   r8   tlvsoffsettlv_idtlv_type
tlv_length	tlv_values   &&&          r   	parse_tlvQMI.parse_tlvt   s   & DGCSCST[C\@j r{ s4y ~~d1V8AfH&=~RHQvXah(?8TJQvXa
l6&9:Iej((FaKF Y]]*jI<N<N.NNN9NI	y.%bM	 22# !r   c          
      8   < V ^8  d   QhRS[ RS[RS[ RS[RS[ /# )r   r   rH   rK   rC   r   )r    r!   r   )r"   r#   s   "r   r$   r%      s2     * *e *S *U *PY *^c *r   c                   WP                  ^RR7      ,          p V\        P                  8X  d,   V \        V4      ^,           P                  ^RR7      ,          p MlV\        P                  8X  g   V\        P
                  8X  d%   V \        V4      P                  ^RR7      ,          p M\        RV 2\        P                  R7       V\        P                  8X  d%   \        V4      pWP                  ^RR7      ,          p W,          p \        P                  V R,          RR7      pV R,          \        V 4      ^,
          P                  ^RR7      ,           V R,          ,           p V # )aA  
Generate a QMI TLV and add it to the message.

Parameters
----------
message : bytes
    Raw QMI message as bytes (little endian).
tlv_id : int
    TLV Type.
tlv_value : bytes
    TLV Value.
value_type : ValueType
    Type of the TLV Value.

Returns
-------
message : bytes
    Raw QMI message as bytes (little endian).
r+   r,   zUnknown value type: r'   r/   :Nr.   NrE   )r=   r   r   r>   r   r   r2   r   r3   r!   r4   )r   rH   rK   rC   value_array_length
qmi_lengths   &&&&  r   generate_tlvQMI.generate_tlv   s!   , 	??1?99(I*44Q(4KKG9==(J):L:L,Ls9~..qH.EEG(5CJJG(!$Y2212IIG ^^GCLH^E
"+w<!#--a8-DE"+ r   r   N)r   r	   r
   r   __doc__staticmethodr9   r?   rL   rR   r   __classdictcell__)r#   s   @r   r   r   %   sZ     7-H -H^  6 +3 +3Z * *r   r   )r   enumr   typingr   r   r   r   r   r   r   <module>rY      s4   &    $ h hr   