
    >fhH                    N   d dl mZ ddlmZmZ d dlmZ d dlZd dlZ G d dej                        Z
 G d d	ej                        Z G d
 dej                        Z G d dej                        Z G d dej                        Ze G d d             Ze G d d             Ze G d d             Ze G d d             Z	 	 	 	 	 	 d0dZ	 	 	 	 d1dZd2dZ	 	 	 	 	 	 	 	 	 	 d3dZ	 	 	 	 d4dZ	 	 	 	 	 	 	 	 d5dZ	 d6	 	 	 	 	 	 	 	 	 d7dZ	 d6	 	 	 	 	 	 	 	 	 d8dZ	 	 	 	 	 	 d9d Z	 	 	 	 d:d!Z	 	 	 	 	 	 	 	 d;d"Z	 	 	 	 d<d#Z	 	 	 	 	 	 d=d$Z	 	 	 	 d>d%Z 	 	 	 	 d?d&Z! ed'      e G d( d)                    Z" ed*      e G d+ d,                    Z# ed-      e G d. d/                    Z$y)@    )annotations   )event_classT_JSON_DICT)	dataclassNc                  2    e Zd ZdZdZdZdZd Zed        Z	y)CentralStatez2
    Indicates the various states of Central.
    absentzpowered-offz
powered-onc                    | j                   S Nvalueselfs    n/var/www/zara/venv/lib/python3.12/site-packages/selenium/webdriver/common/devtools/v138/bluetooth_emulation.pyto_jsonzCentralState.to_json       zz    c                     | |      S r    clsjsons     r   	from_jsonzCentralState.from_json       4yr   N)
__name__
__module____qualname____doc__ABSENTPOWERED_OFF
POWERED_ONr   classmethodr   r   r   r   r	   r	      s1     FKJ  r   r	   c                  .    e Zd ZdZdZdZd Zed        Zy)GATTOperationTypez4
    Indicates the various types of GATT event.
    
connection	discoveryc                    | j                   S r   r   r   s    r   r   zGATTOperationType.to_json$   r   r   c                     | |      S r   r   r   s     r   r   zGATTOperationType.from_json'   r   r   N)	r   r   r   r   
CONNECTION	DISCOVERYr   r#   r   r   r   r   r%   r%      s,     JI  r   r%   c                  2    e Zd ZdZdZdZdZd Zed        Z	y)CharacteristicWriteTypez>
    Indicates the various types of characteristic write.
    zwrite-default-deprecatedzwrite-with-responsezwrite-without-responsec                    | j                   S r   r   r   s    r   r   zCharacteristicWriteType.to_json4   r   r   c                     | |      S r   r   r   s     r   r   z!CharacteristicWriteType.from_json7   r   r   N)
r   r   r   r   WRITE_DEFAULT_DEPRECATEDWRITE_WITH_RESPONSEWRITE_WITHOUT_RESPONSEr   r#   r   r   r   r   r-   r-   ,   s4      :/5  r   r-   c                  6    e Zd ZdZdZdZdZdZd Ze	d        Z
y)	CharacteristicOperationTypezB
    Indicates the various types of characteristic operation.
    readwritezsubscribe-to-notificationszunsubscribe-from-notificationsc                    | j                   S r   r   r   s    r   r   z#CharacteristicOperationType.to_jsonE   r   r   c                     | |      S r   r   r   s     r   r   z%CharacteristicOperationType.from_jsonH   r   r   N)r   r   r   r   READWRITESUBSCRIBE_TO_NOTIFICATIONSUNSUBSCRIBE_FROM_NOTIFICATIONSr   r#   r   r   r   r   r4   r4   <   s8     DE!=%E"  r   r4   c                  .    e Zd ZdZdZdZd Zed        Zy)DescriptorOperationTypez>
    Indicates the various types of descriptor operation.
    r5   r6   c                    | j                   S r   r   r   s    r   r   zDescriptorOperationType.to_jsonT   r   r   c                     | |      S r   r   r   s     r   r   z!DescriptorOperationType.from_jsonW   r   r   N)	r   r   r   r   r9   r:   r   r#   r   r   r   r   r>   r>   M   s,     DE  r   r>   c                  <    e Zd ZU dZded<   ded<   d Zed        Zy)	ManufacturerDataz&
    Stores the manufacturer data
    intkeystrdatac                V    t               }| j                  |d<   | j                  |d<   |S )NrD   rF   )dictrD   rF   r   r   s     r   r   zManufacturerData.to_jsoni   s(    vhhUyyVr   c                F     | t        |d         t        |d               S )NrD   rF   )rD   rF   )rC   rE   r   s     r   r   zManufacturerData.from_jsono   s'    DK T&\"
 	
r   Nr   r   r   r   __annotations__r   r#   r   r   r   r   rB   rB   \   s.     
H I 
 
r   rB   c                  n    e Zd ZU dZdZded<   dZded<   dZded<   dZded	<   dZ	d
ed<   d Z
ed        Zy)
ScanRecordzV
    Stores the byte data of the advertisement packet sent by a Bluetooth device.
    Ntyping.Optional[str]namez!typing.Optional[typing.List[str]]uuidsztyping.Optional[int]
appearancetx_powerz.typing.Optional[typing.List[ManufacturerData]]manufacturer_datac                   t               }| j                  | j                  |d<   | j                  | j                  D cg c]  }| c}|d<   | j                  | j                  |d<   | j                  | j                  |d<   | j
                  +| j
                  D cg c]  }|j                          c}|d<   |S c c}w c c}w )NrP   rQ   rR   txPowermanufacturerData)rH   rP   rQ   rR   rS   rT   r   )r   r   is      r   r   zScanRecord.to_json   s    v99 99DL::!(,

31Q3DM??&!%D==$"mmDO!!-=A=S=S'T		'TD#$ 4 (Us    	B>Cc                :    | d|v rt        |d         nd d|v r|d   D cg c]  }t        |       c}nd d|v rt        |d         nd d|v rt        |d         nd d|v r+|d   D cg c]  }t        j                  |       c}      S d       S c c}w c c}w )NrP   rQ   rR   rV   rW   )rP   rQ   rR   rS   rT   )rE   rC   rB   r   )r   r   rX   s      r   r   zScanRecord.from_json   s    &,nT&\"$5<_4=1a3q61$2>$2Fs4-.D-6$->Si)Dcuy}c}dK]F^_/99!<_
 	

 DH
 	
1 `s   B
(B)r   r   r   r   rP   rL   rQ   rR   rS   rT   r   r#   r   r   r   r   rN   rN   w   sb     "&D
%/3E,3 (,J$+ &*H") IMEL 
 
r   rN   c                  F    e Zd ZU dZded<   ded<   ded<   d Zed	        Zy
)	ScanEntryzY
    Stores the advertisement packet information that is sent by a Bluetooth device.
    rE   device_addressrC   rssirN   scan_recordc                    t               }| j                  |d<   | j                  |d<   | j                  j	                         |d<   |S )NdeviceAddressr]   
scanRecord)rH   r\   r]   r^   r   rI   s     r   r   zScanEntry.to_json   sD    v $ 3 3_yyV!--557\r   c                t     | t        |d         t        |d         t        j                  |d               S )Nr`   r]   ra   )r\   r]   r^   )rE   rC   rN   r   r   s     r   r   zScanEntry.from_json   s;    tO45T&\"",,T,-?@
 	
r   NrK   r   r   r   r[   r[      s3     
I 
 
r   r[   c                      e Zd ZU dZdZded<   dZded<   dZded<   dZded<   dZ	ded<   dZ
ded	<   dZded
<   dZded<   d Zed        Zy)CharacteristicPropertiesz
    Describes the properties of a characteristic. This follows Bluetooth Core
    Specification BT 4.2 Vol 3 Part G 3.3.1. Characteristic Properties.
    Nztyping.Optional[bool]	broadcastr5   write_without_responser6   notifyindicateauthenticated_signed_writesextended_propertiesc                   t               }| j                  | j                  |d<   | j                  | j                  |d<   | j                  | j                  |d<   | j                  | j                  |d<   | j
                  | j
                  |d<   | j                  | j                  |d<   | j                  | j                  |d<   | j                  | j                  |d<   |S )	Nre   r5   writeWithoutResponser6   rg   rh   authenticatedSignedWritesextendedProperties)	rH   re   r5   rf   r6   rg   rh   ri   rj   rI   s     r   r   z CharacteristicProperties.to_json   s    v>>% $D99 99DL&&2+/+F+FD'(::! JJDM;;"![[DN==$#}}D++7040P0PD,-##/)-)A)AD%&r   c                L    | d|v rt        |d         nd d|v rt        |d         nd d|v rt        |d         nd d|v rt        |d         nd d|v rt        |d         nd d|v rt        |d         nd d|v rt        |d         nd d|v rt        |d         	      S d 	      S )
Nre   r5   rl   r6   rg   rh   rm   rn   )re   r5   rf   r6   rg   rh   ri   rj   )boolr   s     r   r   z"CharacteristicProperties.from_json   s    1<1Dd4,-$'-~d6l#4I_cgIg4-C(D#Emq)0D$tG}%d+3t+;4X'/9T/AT$z*+tSnrvSvT2M-N(O  }ADX\`D`T*>%? @	
 		
 gk	
 		
r   )r   r   r   r   re   rL   r5   rf   r6   rg   rh   ri   rj   r   r#   r   r   r   r   rd   rd      s}     (,I$+"&D
&4818#'E '$(F!(&*H#*9=!6=15.5( 

 

r   rd   c              #  b   K   t               }| j                         |d<   ||d<   d|d}|}yw)z
    Enable the BluetoothEmulation domain.

    :param state: State of the simulated central.
    :param le_supported: If the simulated central supports low-energy.
    stateleSupportedzBluetoothEmulation.enablemethodparamsNrH   r   )rr   le_supportedrv   cmd_dictr   s        r   enablerz      s>      &FmmoF7O(F=-H >Ds   -/c              #  X   K   t               }| j                         |d<   d|d}|}yw)zd
    Set the state of the simulated central.

    :param state: State of the simulated central.
    rr   z+BluetoothEmulation.setSimulatedCentralStatert   Nrw   )rr   rv   ry   r   s       r   set_simulated_central_stater|   
  s4      &FmmoF7O?H >D   (*c               #     K   ddi} | }yw)z0
    Disable the BluetoothEmulation domain.
    ru   zBluetoothEmulation.disableNr   )ry   r   s     r   disabler     s     
 	.H >Ds   
c              #     K   t               }| |d<   ||d<   |D cg c]  }|j                          c}|d<   |D cg c]  }| c}|d<   d|d}|}yc c}w c c}w w)z
    Simulates a peripheral with ``address``, ``name`` and ``knownServiceUuids``
    that has already been connected to the system.

    :param address:
    :param name:
    :param manufacturer_data:
    :param known_service_uuids:
    addressrP   rW   knownServiceUuidsz1BluetoothEmulation.simulatePreconnectedPeripheralrt   Nrw   )r   rP   rT   known_service_uuidsrv   rX   ry   r   s           r    simulate_preconnected_peripheralr   %  ss      &FF9F6N7H!I!!))+!IF.A"B1"BFEH >D "J"Bs   AA
A	AAc              #  X   K   t               }| j                         |d<   d|d}|}yw)zx
    Simulates an advertisement packet described in ``entry`` being received by
    the central.

    :param entry:
    entryz(BluetoothEmulation.simulateAdvertisementrt   Nrw   )r   rv   ry   r   s       r   simulate_advertisementr   @  s4      &FmmoF7O<H >Dr}   c              #  l   K   t               }| |d<   |j                         |d<   ||d<   d|d}|}yw)a#  
    Simulates the response code from the peripheral with ``address`` for a
    GATT operation of ``type``. The ``code`` value follows the HCI Error Codes from
    Bluetooth Core Specification Vol 2 Part D 1.3 List Of Error Codes.

    :param address:
    :param type_:
    :param code:
    r   typecodez0BluetoothEmulation.simulateGATTOperationResponsert   Nrw   )r   type_r   rv   ry   r   s         r    simulate_gatt_operation_responser   R  sG      &FF9]]_F6NF6NDH >Ds   24c              #  z   K   t               }| |d<   |j                         |d<   ||d<   |||d<   d|d}|}yw)a  
    Simulates the response from the characteristic with ``characteristicId`` for a
    characteristic operation of ``type``. The ``code`` value follows the Error
    Codes from Bluetooth Core Specification Vol 3 Part F 3.4.1.1 Error Response.
    The ``data`` is expected to exist when simulating a successful read operation
    response.

    :param characteristic_id:
    :param type_:
    :param code:
    :param data: *(Optional)*
    characteristicIdr   r   NrF   z:BluetoothEmulation.simulateCharacteristicOperationResponsert   rw   )characteristic_idr   r   rF   rv   ry   r   s          r   *simulate_characteristic_operation_responser   k  sW     $ &F!2F]]_F6NF6NvNH >D   9;c              #  z   K   t               }| |d<   |j                         |d<   ||d<   |||d<   d|d}|}yw)a  
    Simulates the response from the descriptor with ``descriptorId`` for a
    descriptor operation of ``type``. The ``code`` value follows the Error
    Codes from Bluetooth Core Specification Vol 3 Part F 3.4.1.1 Error Response.
    The ``data`` is expected to exist when simulating a successful read operation
    response.

    :param descriptor_id:
    :param type_:
    :param code:
    :param data: *(Optional)*
    descriptorIdr   r   NrF   z6BluetoothEmulation.simulateDescriptorOperationResponsert   rw   )descriptor_idr   r   rF   rv   ry   r   s          r   &simulate_descriptor_operation_responser     sV     $ &F*F>]]_F6NF6NvJH >Dr   c              #  `   K   t               }| |d<   ||d<   d|d}|}t        |d         S w)z
    Adds a service with ``serviceUuid`` to the peripheral with ``address``.

    :param address:
    :param service_uuid:
    :returns: An identifier that uniquely represents this service.
    r   serviceUuidzBluetoothEmulation.addServicert   	serviceIdrH   rE   )r   service_uuidrv   ry   r   s        r   add_servicer     sI      &FF9(F=1H >DtK !!   ,.c              #  <   K   t               }| |d<   d|d}|}yw)zo
    Removes the service respresented by ``serviceId`` from the simulated central.

    :param service_id:
    r   z BluetoothEmulation.removeServicert   NrH   )
service_idrv   ry   r   s       r   remove_servicer     s/      &F$F;4H >D   c              #     K   t               }| |d<   ||d<   |j                         |d<   d|d}|}t        |d         S w)a  
    Adds a characteristic with ``characteristicUuid`` and ``properties`` to the
    service represented by ``serviceId``.

    :param service_id:
    :param characteristic_uuid:
    :param properties:
    :returns: An identifier that uniquely represents this characteristic.
    r   characteristicUuid
propertiesz$BluetoothEmulation.addCharacteristicrt   r   )rH   r   rE   )r   characteristic_uuidr   rv   ry   r   s         r   add_characteristicr     s^      &F$F;#6F %--/F<8H >Dt&'((s   ?Ac              #  <   K   t               }| |d<   d|d}|}yw)z
    Removes the characteristic respresented by ``characteristicId`` from the
    simulated central.

    :param characteristic_id:
    r   z'BluetoothEmulation.removeCharacteristicrt   Nr   )r   rv   ry   r   s       r   remove_characteristicr     s0      &F!2F;H >Dr   c              #  `   K   t               }| |d<   ||d<   d|d}|}t        |d         S w)z
    Adds a descriptor with ``descriptorUuid`` to the characteristic respresented
    by ``characteristicId``.

    :param characteristic_id:
    :param descriptor_uuid:
    :returns: An identifier that uniquely represents this descriptor.
    r   descriptorUuidz BluetoothEmulation.addDescriptorrt   r   r   )r   descriptor_uuidrv   ry   r   s        r   add_descriptorr     sK      &F!2F.F4H >DtN#$$r   c              #  <   K   t               }| |d<   d|d}|}yw)zm
    Removes the descriptor with ``descriptorId`` from the simulated central.

    :param descriptor_id:
    r   z#BluetoothEmulation.removeDescriptorrt   Nr   )r   rv   ry   r   s       r   remove_descriptorr     s/      &F*F>7H >Dr   c              #  <   K   t               }| |d<   d|d}|}yw)zc
    Simulates a GATT disconnection from the peripheral with ``address``.

    :param address:
    r   z,BluetoothEmulation.simulateGATTDisconnectionrt   Nr   )r   rv   ry   r   s       r   simulate_gatt_disconnectionr   $  s/      &FF9@H >Dr   z(BluetoothEmulation.gattOperationReceivedc                  8    e Zd ZU dZded<   ded<   edd       Zy)	GattOperationReceivedzf
    Event for when a GATT operation of ``type`` to the peripheral with ``address``
    happened.
    rE   r   r%   r   c                Z     | t        |d         t        j                  |d               S )Nr   r   )r   r   )rE   r%   r   r   s     r   r   zGattOperationReceived.from_json?  s-    Y(#--d6l;
 	
r   N)r   r   returnr   r   r   r   r   rL   r#   r   r   r   r   r   r   5  s&     L
 
r   r   z2BluetoothEmulation.characteristicOperationReceivedc                  L    e Zd ZU dZded<   ded<   ded<   ded	<   edd
       Zy)CharacteristicOperationReceivedz
    Event for when a characteristic operation of ``type`` to the characteristic
    respresented by ``characteristicId`` happened. ``data`` and ``writeType`` is
    expected to exist when ``type`` is write.
    rE   r   r4   r   rO   rF   z(typing.Optional[CharacteristicWriteType]
write_typec           	          | t        |d         t        j                  |d         d|v rt        |d         nd d|v rt        j                  |d               S d       S )Nr   r   rF   	writeType)r   r   rF   r   )rE   r4   r   r-   r   s     r   r   z)CharacteristicOperationReceived.from_jsonT  sp    !$'9":;-77VE&,nT&\"$OZ^bOb.88k9JK	
 	
 im	
 	
r   N)r   r   r   r   r   r   r   r   r   r   G  s3    
 &&
88
 
r   r   z.BluetoothEmulation.descriptorOperationReceivedc                  B    e Zd ZU dZded<   ded<   ded<   ed
d       Zy	)DescriptorOperationReceivedz
    Event for when a descriptor operation of ``type`` to the descriptor
    respresented by ``descriptorId`` happened. ``data`` is expected to exist when
    ``type`` is write.
    rE   r   r>   r   rO   rF   c                     | t        |d         t        j                  |d         d|v rt        |d               S d       S )Nr   r   rF   )r   r   rF   )rE   r>   r   r   s     r   r   z%DescriptorOperationReceived.from_jsonj  sO    d>23)33DLA&,nT&\"
 	
 ;?
 	
r   N)r   r   r   r   r   r   r   r   r   r   ^  s-    
 ""

 
r   r   )rr   r	   rx   rp   r   0typing.Generator[T_JSON_DICT, T_JSON_DICT, None])rr   r	   r   r   )r   r   )
r   rE   rP   rE   rT   ztyping.List[ManufacturerData]r   ztyping.List[str]r   r   )r   r[   r   r   )r   rE   r   r%   r   rC   r   r   r   )
r   rE   r   r4   r   rC   rF   rO   r   r   )
r   rE   r   r>   r   rC   rF   rO   r   r   )r   rE   r   rE   r   /typing.Generator[T_JSON_DICT, T_JSON_DICT, str])r   rE   r   r   )r   rE   r   rE   r   rd   r   r   )r   rE   r   r   )r   rE   r   rE   r   r   )r   rE   r   r   )r   rE   r   r   )%
__future__r   utilr   r   dataclassesr   enumtypingEnumr	   r%   r-   r4   r>   rB   rN   r[   rd   rz   r|   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   <module>r      s   # * !  499  		 dii  $)) "dii  
 
 
4 (
 (
 (
V 
 
 
4 4
 4
 4
n 
8(	7" 9 .	
 
86	7$   
8	: &*	*  #	
 
8F &*	&  #	
 
8>""" 
7",	7")) ) -) 
7	)4	7$%%% 
7%.	7"	7" 78

 
  9
  AB

 
  C
* =>

 
  ?
r   