
    >qa!                     8    d Z ddlZddlmZ  G d d          ZdS )a  
*******************************************************************
  Copyright (c) 2017, 2019 IBM Corp.

  All rights reserved. This program and the accompanying materials
  are made available under the terms of the Eclipse Public License v2.0
  and Eclipse Distribution License v1.0 which accompany this distribution.

  The Eclipse Public License is available at
     http://www.eclipse.org/legal/epl-v10.html
  and the Eclipse Distribution License is available at
    http://www.eclipse.org/org/documents/edl-v10.php.

  Contributors:
     Ian Craggs - initial implementation and/or documentation
*******************************************************************
    N   )PacketTypesc                   P    e Zd ZdZddZd Zd Zd Zd Zd	 Z	d
 Z
d Zd Zd ZdS )ReasonCodeszMQTT version 5.0 reason codes class.

    See ReasonCodes.names for a list of possible numeric values along with their
    names and the packets to which they apply.

    Successc                 
   || _         i dt          j        t          j        t          j        t          j        t          j        t          j        t          j        gt          j	        gt          j
        gdddt          j
        giddt          j
        giddt          j	        gid	d
t          j        t          j        giddt          j        giddt          j        giddt          j        giddt          j        t          j        t          j        t          j
        t          j        t          j	        giddt          j        t          j	        giddt          j        t          j	        giddt          j        t          j        t          j        t          j
        t          j        t          j	        giddt          j        giddt          j        giddt          j        gidd t          j        t          j        t          j        t          j
        t          j        t          j	        gid!d"t          j        gii d#d$t          j        t          j	        gid%d&t          j        gid'd(t          j	        gid)d*t          j        t          j	        gid+d,t          j	        gid-d.t          j	        gid/d0t          j
        t          j        t          j	        gid1d2t          j        t          j        t          j        t          j	        gid3d4t          j        t          j        t          j
        t          j        gid5d6t          j        t          j        gid7d8t          j	        gid9d:t          j	        gid;d<t          j        t          j	        gid=d>t          j	        gid?d@t          j        t          j        t          j        t          j
        t          j	        gidAdBt          j	        gidCdDt          j        t          j        t          j	        gidEt          j        t          j	        gidFt          j        t          j	        gidGt          j        t          j	        gidHt          j        t          j	        gidIt          j
        t          j	        gidJt          j        t          j	        gidKt          j	        gidLt          j
        t          j	        gidMt          j
        t          j	        gidN	| _        |dOk    r/|t          j	        k    r|dPk    rdQ}|                     |           dRS || _        |                                  dRS )Sa  
        packetType: the type of the packet, such as PacketTypes.CONNECT that
            this reason code will be used with.  Some reason codes have different
            names for the same identifier when used a different packet type.

        aName: the String name of the reason code to be created.  Ignored
            if the identifier is set.

        identifier: an integer value of the reason code to be created.

        r   )r   Normal disconnectionzGranted QoS 0r   zGranted QoS 1   zGranted QoS 2   zDisconnect with will message   zNo matching subscribers   zNo subscription found   zContinue authentication   zRe-authenticate   zUnspecified error   zMalformed packet   zProtocol error   zImplementation specific error   zUnsupported protocol version   zClient identifier not valid   zBad user name or password   zNot authorized   zServer unavailable   zServer busy   Banned   zServer shutting down   zBad authentication method   zKeep alive timeout   zSession taken over   zTopic filter invalid   zTopic name invalid   zPacket identifier in use   zPacket identifier not found   zReceive maximum exceeded   zTopic alias invalid   zPacket too large   zMessage rate too high   zQuota exceeded   zAdministrative action   zPayload format invalidzRetain not supportedzQoS not supportedzUse another serverzServer movedz!Shared subscription not supportedzConnection rate exceededzMaximum connect timez&Subscription identifiers not supportedz#Wildcard subscription not supported)	                           r   r   r
   N)
packetTyper   CONNACKPUBACKPUBRECPUBRELPUBCOMPUNSUBACKAUTH
DISCONNECTSUBACKnamessetvaluegetName)selfr5   aName
identifiers       I/opt/windhager/venv/lib/python3.11/site-packages/paho/mqtt/reasoncodes.py__init__zReasonCodes.__init__    s    %K
K/1C'.0BKDW'0+2BD *5)?(@"-"4!5	7 7K
 +"4!56K
 +"4!56K
 .1G0HIK
 *$k&89;K
 (;+?*@AK
 *[-=,>?K
 "[%5$67K
 %(;[=O(3(:K<NP[Pd(3(>(@ CK
" $&(>?A#K
& "&(>?A'K
* 1K4G4?4FHZ\g\n4?4H+J`4b e+K
0 0;3F2GH1K
2 /+2E1FG3K
4 -0C/DE5K
6 "[%8+:L%0%79K[Ma%0%;%= @7K
< &)<(=>=K
 K
> -+"5{7M!NO?K
@ ([012AK
B (;+A*BCCK
D -&(>?AEK
H &)?(@AIK
J &)?(@AKK
L (%{';[=STVMK
P &&(:%{'=?@QK
V ,%{'9%{';=>WK
\ /%{':;=]K
` ,{/E.FGaK
b '+*@)ABcK
d ${':K<R&STeK
f )K,B+CDgK
h "[%8+:L%0%79K[Mc%e hiK
l )K,B+CDmK
n *%{'9;;QRToK
 K
r )&(>?A%&(>?A&&(>?A &(>?A5%{'=>@,&(>?A()*,:%{'=>@7%{'=>@SK
 K
 K

X [3338J8J.HHUOOOOO#DJLLNNNNN    c                     || j                                         v s
J |            | j         |         fd                                D             }t          |          dk    sJ |d         S )z
        Get the reason code string name for a specific identifier.
        The name can vary by packet type for the same identifier, which
        is why the packet type is also required.

        Used when displaying the reason code.
        c                 (    g | ]}|         v |S  rK   ).0namer?   r5   s     rF   
<listcomp>z+ReasonCodes.__getName__.<locals>.<listcomp>   s'    OOOTZ5;5N5ND5N5N5NrH   r   r   )r?   keyslen)rC   r5   rE   namelistr?   s    `  @rF   __getName__zReasonCodes.__getName__   s|     TZ__.....
...
:&OOOOOUZZ\\OOO8}}!!!!{rH   c                     d}| j                                         D ]A}|| j         |                                         v r| j        | j         |         |         v r|} nB|
J |            |S )z
        Get the numeric id corresponding to a reason code name.

        Used when setting the reason code for a packetType
        check that only valid codes for the packet are set.
        N)r?   rO   r5   )rC   rM   rE   codes       rF   getIdzReasonCodes.getId   s     
JOO%% 	 	Dtz$',,....?dj&6t&<<<!%J / %%t%%%rH   c                 :    |                      |          | _        d S N)rU   rA   )rC   rM   s     rF   r@   zReasonCodes.set   s    ZZ%%


rH   c                     |d         }t           j        d         dk     rt          |          }|                     | j        |          }|                     |          | _        dS )Nr      r   )sysversion_infoordrR   r5   rU   rA   )rC   buffercrM   s       rF   unpackzReasonCodes.unpack   sX    1IA""AA33ZZ%%
qrH   c                 B    |                      | j        | j                  S )zVReturns the reason code name corresponding to the numeric value which is set.
        )rR   r5   rA   rC   s    rF   rB   zReasonCodes.getName   s     <<<rH   c                     t          |t                    r| j        |k    S t          |t                    r| j        t          |           k    S t          |t                    r| j        |j        k    S dS )NF)
isinstanceintrA   strr   )rC   others     rF   __eq__zReasonCodes.__eq__   sl    eS!! 	':&&eS!! 	+:T**e[)) 	-:,,urH   c                 *    |                                  S rW   rB   ra   s    rF   __str__zReasonCodes.__str__       ||~~rH   c                 *    |                                  S rW   ri   ra   s    rF   jsonzReasonCodes.json   rk   rH   c                 ,    t          | j        g          S rW   )	bytearrayrA   ra   s    rF   packzReasonCodes.pack   s    $*&&&rH   N)r   r   )__name__
__module____qualname____doc__rG   rR   rU   r@   r_   rB   rg   rj   rm   rp   rK   rH   rF   r   r      s         ` ` ` `D     & & &  = = =
      ' ' ' ' 'rH   r   )rt   rZ   packettypesr   r   rK   rH   rF   <module>rv      sh    $ 


 $ $ $ $ $ $h' h' h' h' h' h' h' h' h' h'rH   