o
    »åž_œ
  ã                   @   s(   d Z G dd„ deƒZG dd„ deƒZdS )zÜImplement base classes for hid package.

This module provides the base classes implemented by the
platform-specific modules.  It includes a base class for
all implementations built on interacting with file-like objects.
c                   @   sD   e Zd ZdZedd„ ƒZdd„ Zdd„ Zdd	„ Zd
d„ Z	dd„ Z
dS )Ú	HidDevicez/Base class for all HID devices in this package.c                   C   ó   dS )aP  Enumerates all the hid devices.

    This function enumerates all the hid device and provides metadata
    for helping the client select one.

    Returns:
      A list of dictionaries of metadata.  Each implementation is required
      to provide at least: vendor_id, product_id, product_string, usage,
      usage_page, and path.
    N© r   r   r   ú.lib/python3.10/site-packages/pyu2f/hid/base.pyÚ	Enumerate   s   zHidDevice.Enumeratec                 C   r   )zInitialize the device at path.Nr   )ÚselfÚpathr   r   r   Ú__init__(   s   zHidDevice.__init__c                 C   r   )z‘Returns the max input report data length in bytes.

    Returns the max input report data length in bytes.  This excludes the
    report id.
    Nr   ©r   r   r   r   ÚGetInReportDataLength,   ó   zHidDevice.GetInReportDataLengthc                 C   r   )z“Returns the max output report data length in bytes.

    Returns the max output report data length in bytes.  This excludes the
    report id.
    Nr   r	   r   r   r   ÚGetOutReportDataLength4   r   z HidDevice.GetOutReportDataLengthc                 C   r   )zÏWrites packet to device.

    Writes the packet to the device.

    Args:
      packet: An array of integers to write to the device.  Excludes the report
      ID. Must be equal to GetOutReportLength().
    Nr   )r   Zpacketr   r   r   ÚWrite<   ó   	zHidDevice.Writec                 C   r   )zÓReads packet from device.

    Reads the packet from the device.

    Returns:
      An array of integers read from the device.  Excludes the report ID.
      The length is equal to GetInReportDataLength().
    Nr   r	   r   r   r   ÚReadG   r   zHidDevice.ReadN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ústaticmethodr   r   r
   r   r   r   r   r   r   r   r      s    
r   c                   @   s8   e Zd ZdZdZdZdZdZdZdZ	dZ
dZdd„ ZdS )ÚDeviceDescriptorz.Descriptor for basic attributes of the device.Né    c                 C   s2   i }t | j ¡ ƒD ]\}}| d¡s|||< q	|S )NZ	internal_)ÚlistÚ__dict__ÚitemsÚ
startswith)r   ÚoutÚkÚvr   r   r   ÚToPublicDict`   s   
€zDeviceDescriptor.ToPublicDict)r   r   r   r   Z
usage_pageÚusageZ	vendor_idZ
product_idZproduct_stringr   Zinternal_max_in_report_lenZinternal_max_out_report_lenr   r   r   r   r   r   S   s    r   N)r   Úobjectr   r   r   r   r   r   Ú<module>   s   <