%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/positioning/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/positioning/__pycache__/base.cpython-312.pyc

�

Ϫ�fo��&�dZddlmZddlmZddlmZmZddlm	Z	ddl
mZmZddl
mZddlmZd	Zd
ZdZGd�d
e�ZGd�de�Ze	ej,�Gd�d��ZGd�de�ZGd�de�ZGd�de�ZGd�de�ZGd�de�ZGd�de�ZGd�de�ZGd �d!e�Z Gd"�d#e�Z!Gd$�d%e�Z"Gd&�d'�Z#e	ejH�Gd(�d)��Z%Gd*�d+e%�Z&gd,�Z'y-).z1
Generic positioning base classes.

@since: 14.0
�)�partial)�
attrgetter)�ClassVar�Sequence)�implementer)�
NamedConstant�Names)�ipositioning)�FancyEqMixing��2Tv�?gr�q��?g����ׁ�?c�H�eZdZdZe�Ze�Ze�Ze�Zy)�Anglesa�
    The types of angles.

    @cvar LATITUDE: Angle representing a latitude of an object.
    @type LATITUDE: L{NamedConstant}

    @cvar LONGITUDE: Angle representing the longitude of an object.
    @type LONGITUDE: L{NamedConstant}

    @cvar HEADING: Angle representing the heading of an object.
    @type HEADING: L{NamedConstant}

    @cvar VARIATION: Angle representing a magnetic variation.
    @type VARIATION: L{NamedConstant}

    N)	�__name__�
__module__�__qualname__�__doc__r�LATITUDE�	LONGITUDE�HEADING�	VARIATION���:/usr/lib/python3/dist-packages/twisted/positioning/base.pyr
r
s%���"��H���I��o�G���Irr
c�H�eZdZdZe�Ze�Ze�Ze�Zy)�
DirectionszB
    The four cardinal directions (north, east, south, west).
    N)	rrrrr�NORTH�EAST�SOUTH�WESTrrrrr3s%���
�O�E��?�D��O�E��?�Drrc�@�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zy
)�BasePositioningReceiveraS
    A base positioning receiver.

    This class would be a good base class for building positioning
    receivers. It implements the interface (so you don't have to) with stub
    methods.

    People who want to implement positioning receivers should subclass this
    class and override the specific callbacks they want to handle.
    c��y)zG
        Implements L{IPositioningReceiver.timeReceived} stub.
        Nr)�self�times  r�timeReceivedz$BasePositioningReceiver.timeReceivedK��rc��y)zJ
        Implements L{IPositioningReceiver.headingReceived} stub.
        Nr)r"�headings  r�headingReceivedz'BasePositioningReceiver.headingReceivedPr%rc��y)zH
        Implements L{IPositioningReceiver.speedReceived} stub.
        Nr�r"�speeds  r�
speedReceivedz%BasePositioningReceiver.speedReceivedUr%rc��y)zH
        Implements L{IPositioningReceiver.climbReceived} stub.
        Nr�r"�climbs  r�
climbReceivedz%BasePositioningReceiver.climbReceivedZr%rc��y)zK
        Implements L{IPositioningReceiver.positionReceived} stub.
        Nr)r"�latitude�	longitudes   r�positionReceivedz(BasePositioningReceiver.positionReceived_r%rc��y)zP
        Implements L{IPositioningReceiver.positionErrorReceived} stub.
        Nr)r"�
positionErrors  r�positionErrorReceivedz-BasePositioningReceiver.positionErrorReceiveddr%rc��y)zK
        Implements L{IPositioningReceiver.altitudeReceived} stub.
        Nr�r"�altitudes  r�altitudeReceivedz(BasePositioningReceiver.altitudeReceivedir%rc��y)zT
        Implements L{IPositioningReceiver.beaconInformationReceived} stub.
        Nr)r"�beaconInformations  r�beaconInformationReceivedz1BasePositioningReceiver.beaconInformationReceivednr%rN)rrrrr$r(r,r0r4r7r;r>rrrr r >s/��	��
�
�
�
�
�
�
rr c��eZdZdZy)�InvalidSentencez9
    An exception raised when a sentence is invalid.
    N�rrrrrrrr@r@t���rr@c��eZdZdZy)�InvalidChecksumzI
    An exception raised when the checksum of a sentence is invalid.
    NrArrrrDrDzrBrrDc�\�eZdZUdZej
d�ejd�ejd�ejd�iZ	ej
dejdejdejd	iZ
d
Zee
eed<dd
�Zed��Zed��Zd�Zd�Zdefd�Zed��Zed��Zy)�Anglea�
    An object representing an angle.

    @cvar _RANGE_EXPRESSIONS: A collection of expressions for the allowable
        range for the angular value of a particular coordinate value.
    @type _RANGE_EXPRESSIONS: C{dict} of L{Angles} constants to callables
    @cvar _ANGLE_TYPE_NAMES: English names for angle types.
    @type _ANGLE_TYPE_NAMES: C{dict} of L{Angles} constants to C{str}
    c�"�d|cxkxrdkScS)Ng�V�g�V@r)r2s r�<lambda>zAngle.<lambda>�s��%�(�*A�T�*A��*A�rc�"�d|cxkxrdkScS)Ng�f�g�f@r)r3s rrHzAngle.<lambda>�s��F�Y�,F��,F��,F�rc�"�d|cxkxrdkScS)Nr�hr)r's rrHzAngle.<lambda>�s���W�(:�s�(:��(:�rc�"�d|cxkxrdkScS)NiL����r)�	variations rrHzAngle.<lambda>�s��D�9�,C��,C��,C�r�Latitude�	Longitude�	Variation�Heading)�	angleType�inDecimalDegrees�compareAttributesNc���|�||jvrtd��|�6|�4|j|}||�sd}t|j||���||_||_y)aG
        Initializes an angle.

        @param angle: The value of the angle in decimal degrees. (L{None} if
            unknown).
        @type angle: C{float} or L{None}

        @param angleType: A symbolic constant describing the angle type. Should
            be one of L{Angles} or {None} if unknown.

        @raises ValueError: If the angle type is not the default argument,
            but it is an unknown type (not in  C{Angle._RANGE_EXPRESSIONS}),
            or it is a known type but the supplied value was out of the
            allowable range for said type.
        NzUnknown angle typez+Angle {0} not in allowed range for type {1})�_RANGE_EXPRESSIONS�
ValueError�formatrS�_angle)r"�anglerS�rangeExpression�templates     r�__init__zAngle.__init__�so�� � �Y�d�6M�6M�%M��1�2�2����!6�"�5�5�i�@�O�"�5�)�H�� �����	�!B�C�C�"�����rc��|jS)z�
        The value of this angle in decimal degrees. This value is immutable.

        @return: This angle expressed in decimal degrees, or L{None} if the
            angle is unknown.
        @rtype: C{float} (or L{None})
        �rZ�r"s rrTzAngle.inDecimalDegrees�����{�{�rc��|j�ytt|j��}t|jt|j�z
�}d|z}t|�}|t|�z
}d|z}||t|�fS)a
        The value of this angle as a degrees, minutes, seconds tuple. This
        value is immutable.

        @return: This angle expressed in degrees, minutes, seconds. L{None} if
            the angle is unknown.
        @rtype: 3-C{tuple} of C{int} (or L{None})
        N�<)rZ�abs�int)r"�degrees�fractionalDegrees�decimalMinutes�minutes�fractionalMinutes�decimalSecondss       r�inDegreesMinutesSecondszAngle.inDegreesMinutesSeconds�s����;�;����c�$�+�+�&�'������c�$�+�+�.>� >�?���/�/���n�%��*�S��-@�@���/�/�����^�!4�4�4rc�b�|dvrtd|z��|t|j�z|_y)a
        Sets the sign of this angle.

        @param sign: The new sign. C{1} for positive and C{-1} for negative
            signs, respectively.
        @type sign: C{int}

        @raise ValueError: If the C{sign} parameter is not C{-1} or C{1}.
        )����z#bad sign (got %s, expected -1 or 1)N)rXrerZ�r"�signs  r�setSignz
Angle.setSign�s2���w���B�T�I�J�J��S����-�-��rc��|jS)z�
        Returns this angle as a float.

        @return: The float value of this angle, expressed in degrees.
        @rtype: C{float}
        r`ras r�	__float__zAngle.__float__�s���{�{�r�returnc�&�dj|��S)��
        Returns a string representation of this angle.

        @return: The string representation.
        @rtype: C{str}
        z.<{s._angleTypeNameRepr} ({s._angleValueRepr})>��s�rYras r�__repr__zAngle.__repr__�s��@�F�F��F�N�Nrc�N�|j�dt|jd�zSy)z�
        Returns a string representation of the angular value of this angle.

        This is a helper function for the actual C{__repr__}.

        @return: The string representation.
        @rtype: C{str}
        z
%s degrees�z
unknown value)rT�roundras r�_angleValueReprzAngle._angleValueRepr�s+��� � �,��%��(=�(=�q�"A�A�A�"rc�T�	|j|jS#t$rYywxYw)z�
        Returns a string representation of the type of this angle.

        This is a helper function for the actual C{__repr__}.

        @return: The string representation.
        @rtype: C{str}
        zAngle of unknown type)�_ANGLE_TYPE_NAMESrS�KeyErrorras r�_angleTypeNameReprzAngle._angleTypeNameReprs.��	+��)�)�$�.�.�9�9���	+�*�	+�s��	'�'�NN)rrrrr
rrrrrWr�rUrr�str�__annotations__r^�propertyrTrmrsrur|r�r�rrrrFrF�s����	���A����F����:����C�	��	�������+����+����	�	��2��x���
�.��
�8�����5��5�,
.��O�#�O��#��#��+��+rrFc�x�eZdZdZd
d�Zed
d��Zed��Zd�Z	e
ej�dgzZde
fd	�Zy)rRa�
    The heading of a mobile object.

    @ivar variation: The (optional) magnetic variation.
        The sign of the variation is positive for variations towards the east
        (clockwise from north), and negative for variations towards the west
        (counterclockwise from north).
        If the variation is unknown or not applicable, this is L{None}.
    @type variation: C{Angle} or L{None}.
    @ivar correctedHeading: The heading, corrected for variation. If the
        variation is unknown (L{None}), is None. This attribute is read-only
        (its value is determined by the angle and variation attributes). The
        value is coerced to being between 0 (inclusive) and 360 (exclusive).
    Nc�\�tj||tj�||_y)zB
        Initializes an angle with an optional variation.
        N)rFr^r
rrN)r"r[rNs   rr^zHeading.__init__,s��	���t�U�F�N�N�3�"��rc�H�t|tj�}|||�S)a_
        Constructs a Heading from the float values of the angle and variation.

        @param angleValue: The angle value of this heading.
        @type angleValue: C{float}
        @param variationValue: The value of the variation of this heading.
        @type variationValue: C{float}
        @return: A L{Heading} with the given values.
        )rFr
r)�cls�
angleValue�variationValuerNs    r�
fromFloatszHeading.fromFloats3s#���.�&�*:�*:�;�	��:�y�)�)rc��|j�|j�y|j|jjz
dz}t|tj
�S)a
        Corrects the heading by the given variation. This is sometimes known as
        the true heading.

        @return: The heading, corrected by the variation. If the variation or
            the angle are unknown, returns L{None}.
        @rtype: C{float} or L{None}
        NrK)rZrNrTrFr
r)r"r[s  r�correctedHeadingzHeading.correctedHeadingAsJ���;�;��$�.�.�"8���&�&����)H�)H�H�C�O���U�F�N�N�+�+rc�|�|jj�td��|jj|�y)a
        Sets the sign of the variation of this heading.

        @param sign: The new sign. C{1} for positive and C{-1} for negative
            signs, respectively.
        @type sign: C{int}

        @raise ValueError: If the C{sign} parameter is not C{-1} or C{1}.
        Nz*can't set the sign of an unknown variation)rNrTrXrsrqs  rrszHeading.setSignQs2���>�>�*�*�2��I�J�J������t�$rrNrvc��|j�d}nt|j�}dj|j|j|�S)rxzunknown variationz
<{} ({}, {})>)rN�reprrYr�r�)r"�
variationReprs  rr|zHeading.__repr__bsI���>�>�!�/�M� ����0�M��%�%��#�#�� � ��
�	
rr�)rrrrr^�classmethodr�r�r�rs�listrFrUr�r|rrrrRrRs_��
�#��*��*��
,��
,�
%��U�4�4�5��
�E��
�#�
rrRc�(�eZdZdZdd�Zed��Zy)�
Coordinatea
    A coordinate.

    @ivar angle: The value of the coordinate in decimal degrees, with the usual
        rules for sign (northern and eastern hemispheres are positive, southern
        and western hemispheres are negative).
    @type angle: C{float}
    Nc��|tjtjdfvrtdj	|���t
j
|||�y)aM
        Initializes a coordinate.

        @param angle: The angle of this coordinate in decimal degrees. The
            hemisphere is determined by the sign (north and east are positive).
            If this coordinate describes a latitude, this value must be within
            -90.0 and +90.0 (exclusive). If this value describes a longitude,
            this value must be within -180.0 and +180.0 (exclusive).
        @type angle: C{float}
        @param coordinateType: The coordinate type. One of L{Angles.LATITUDE},
            L{Angles.LONGITUDE} or L{None} if unknown.
        NzQcoordinateType must be one of Angles.LATITUDE, Angles.LONGITUDE or None, was {!r})r
rrrXrYrFr^)r"r[�coordinateTypes   rr^zCoordinate.__init__sK���&�/�/�6�3C�3C�T�!J�J��5�5;�V�N�5K��
�
	���t�U�N�3rc�D�|jtjur/|jdkrtj
StjS|jtjur/|jdkrtjStjStd��)z�
        Gets the hemisphere of this coordinate.

        @return: A symbolic constant representing a hemisphere (one of
            L{Angles})
        rz.unknown coordinate type (cant find hemisphere))rSr
rrTrrrrrrrXras r�
hemispherezCoordinate.hemisphere�sz���>�>�V�_�_�,��$�$�q�(�!�'�'�'�!�'�'�'�
�^�^�v�/�/�
/��$�$�q�(�!���&�!���&��M�N�Nr�N)rrrrr^r�r�rrrr�r�us"���4�*�O��Orr�c�L�eZdZdZdZd�Zed��Zed��Zd�Z	de
fd�Zy	)
�Altitudez�
    An altitude.

    @ivar inMeters: The altitude represented by this object, in meters. This
        attribute is read-only.
    @type inMeters: C{float}

    @ivar inFeet: As above, but expressed in feet.
    @type inFeet: C{float}
    )�inMetersc��||_y)z}
        Initializes an altitude.

        @param altitude: The altitude in meters.
        @type altitude: C{float}
        N��	_altituder9s  rr^zAltitude.__init__�s��"��rc�(�|jtzS)z�
        Gets the altitude this object represents, in feet.

        @return: The altitude, expressed in feet.
        @rtype: C{float}
        )r��METERS_PER_FOOTras r�inFeetzAltitude.inFeet�s���~�~��/�/rc��|jS)z�
        Returns the altitude this object represents, in meters.

        @return: The altitude, expressed in feet.
        @rtype: C{float}
        r�ras rr�zAltitude.inMeters�s���~�~�rc��|jS)z�
        Returns the altitude represented by this object expressed in meters.

        @return: The altitude represented by this object, expressed in meters.
        @rtype: C{float}
        r�ras rruzAltitude.__float__�s���~�~�rrvc�"�d|j�d�S)z�
        Returns a string representation of this altitude.

        @return: The string representation.
        @rtype: C{str}
        z<Altitude (z m)>r�ras rr|zAltitude.__repr__�s���T�^�^�,�D�1�1rN)rrrrrUr^r�r�r�rur�r|rrrr�r��sM��	�&��"��0��0������2�#�2rr�c�L�eZdZdZdZd�Zed��Zed��Zd�Z	de
fd�Zy	)
�
_BaseSpeedz�
    An object representing the abstract concept of the speed (rate of
    movement) of a mobile object.

    This primarily has behavior for converting between units and comparison.
    )�inMetersPerSecondc��||_y)a2
        Initializes a speed.

        @param speed: The speed that this object represents, expressed in
            meters per second.
        @type speed: C{float}

        @raises ValueError: Raised if value was invalid for this particular
            kind of speed. Only happens in subclasses.
        N��_speedr*s  rr^z_BaseSpeed.__init__�s����rc��|jS)z�
        The speed that this object represents, expressed in meters per second.
        This attribute is immutable.

        @return: The speed this object represents, in meters per second.
        @rtype: C{float}
        r�ras rr�z_BaseSpeed.inMetersPerSecondrbrc�(�|jtzS)z�
        Returns the speed represented by this object, expressed in knots. This
        attribute is immutable.

        @return: The speed this object represents, in knots.
        @rtype: C{float}
        )r��MPS_PER_KNOTras r�inKnotsz_BaseSpeed.inKnotss���{�{�\�)�)rc��|jS)z�
        Returns the speed represented by this object expressed in meters per
        second.

        @return: The speed represented by this object, expressed in meters per
            second.
        @rtype: C{float}
        r�ras rruz_BaseSpeed.__float__rbrrvc�h�t|jd�}d|jj�d|�d�S)z�
        Returns a string representation of this speed object.

        @return: The string representation.
        @rtype: C{str}
        r~�<z (z m/s)>)rr��	__class__r)r"�
speedValues  rr|z_BaseSpeed.__repr__!s6���4�1�1�1�5�
��4�>�>�*�*�+�2�j�\��@�@rN)rrrrrUr^r�r�r�rur�r|rrrr�r��sO���/��������*��*�	�A�#�Arr�c��eZdZdZd�Zy)�Speedz:
    The speed (rate of movement) of a mobile object.
    c�V�|dkrtd|����tj||�y)z�
        Initializes a L{Speed} object.

        @param speed: The speed that this object represents, expressed in
            meters per second.
        @type speed: C{float}

        @raises ValueError: Raised if C{speed} is negative.
        rznegative speed: N)rXr�r^r*s  rr^zSpeed.__init__1s.���1�9��/��y�9�:�:����D�%�(rN�rrrrr^rrrr�r�,s���
)rr�c��eZdZdZd�Zy)�Climbz4
    The climb ("vertical speed") of an object.
    c�0�tj||�y)z�
        Initializes a L{Climb} object.

        @param climb: The climb that this object represents, expressed in
            meters per second.
        @type climb: C{float}
        N)r�r^r.s  rr^zClimb.__init__Fs��	���D�%�(rNr�rrrr�r�As���)rr�c��eZdZdZdZdd�ZdZd�Zd�d�gd	�d
�gd�d�gd�Zd
�Z	d�Z
ed��Zejd��Zed��Zejd��Zed��Zejd��ZdZdefd�Zy)�
PositionErrora#
    Position error information.

    @cvar _ALLOWABLE_THRESHOLD: The maximum allowable difference between PDOP
        and the geometric mean of VDOP and HDOP. That difference is supposed
        to be zero, but can be non-zero because of rounding error and limited
        reporting precision. You should never have to change this value.
    @type _ALLOWABLE_THRESHOLD: C{float}
    @cvar _DOP_EXPRESSIONS: A mapping of DOP types (C[hvp]dop) to a list of
        callables that take self and return that DOP type, or raise
        C{TypeError}. This allows a DOP value to either be returned directly
        if it's know, or computed from other DOP types if it isn't.
    @type _DOP_EXPRESSIONS: C{dict} of C{str} to callables
    @ivar pdop: The position dilution of precision. L{None} if unknown.
    @type pdop: C{float} or L{None}
    @ivar hdop: The horizontal dilution of precision. L{None} if unknown.
    @type hdop: C{float} or L{None}
    @ivar vdop: The vertical dilution of precision. L{None} if unknown.
    @type vdop: C{float} or L{None}
    )�pdop�hdop�vdopNc�\�||_||_||_||_|j	�y)a�
        Initializes a positioning error object.

        @param pdop: The position dilution of precision. L{None} if unknown.
        @type pdop: C{float} or L{None}
        @param hdop: The horizontal dilution of precision. L{None} if unknown.
        @type hdop: C{float} or L{None}
        @param vdop: The vertical dilution of precision. L{None} if unknown.
        @type vdop: C{float} or L{None}
        @param testInvariant: Flag to test if the DOP invariant is valid or
            not. If C{True}, the invariant (PDOP = (HDOP**2 + VDOP**2)*.5) is
            checked at every mutation. By default, this is false, because the
            vast majority of DOP-providing devices ignore this invariant.
        @type testInvariant: c{bool}
        N)�_pdop�_hdop�_vdop�_testInvariant� _testDilutionOfPositionInvariant)r"r�r�r��
testInvariants     rr^zPositionError.__init__is-�� ��
���
���
�+����-�-�/rg{�G�z�?c�h�|jsy|j|j|jfD]}|��yt	|j|jdz|jdzzdzz
�}||j
kDr2t
d|j�d|j�d|j����y)a�
        Tests if this positioning error object satisfies the dilution of
        position invariant (PDOP = (HDOP**2 + VDOP**2)*.5), unless the
        C{self._testInvariant} instance variable is C{False}.

        @return: L{None} if the invariant was not satisfied or not tested.
        @raises ValueError: Raised if the invariant was tested but not
            satisfied.
        Nr~��?z9invalid combination of dilutions of precision: position: z, horizontal: z, vertical: )r�r�r�r�re�_ALLOWABLE_TRESHOLDrX)r"�x�deltas   rr�z.PositionError._testDilutionOfPositionInvariant�s����"�"���)�)�T�Y�Y��	�	�2�	�A��y��	��D�I�I����A���	�	�1��!<�� D�D�E���4�+�+�+���9�9�d�i�i����4��
�,rc�,�t|j�Sr�)�floatr�ras rrHzPositionError.<lambda>�����t�z�z�*�rc�F�|jdz|jdzzdzS�Nr~r�)r�r�ras rrHzPositionError.<lambda>�� ��$�*�*�a�-�$�*�*�a�-�7�C�?�rc�,�t|j�Sr�)r�r�ras rrHzPositionError.<lambda>�r�rc�F�|jdz|jdzz
dzSr�)r�r�ras rrHzPositionError.<lambda>�r�rc�,�t|j�Sr�)r�r�ras rrHzPositionError.<lambda>�r�rc�F�|jdz|jdzz
dzSr�)r�r�ras rrHzPositionError.<lambda>�r�rc�^�|j|D]}	||�cSy#t$rY�wxYw)a,
        Gets a particular dilution of position value.

        @param dopType: The type of dilution of position to get. One of
            ('pdop', 'hdop', 'vdop').
        @type dopType: C{str}
        @return: The DOP if it is known, L{None} otherwise.
        @rtype: C{float} or L{None}
        N)�_DOP_EXPRESSIONS�	TypeError)r"�dopType�
dopExpressions   r�_getDOPzPositionError._getDOP�sB��"�2�2�7�;�	�M�
�$�T�*�*�	���
��
�s� �	,�,c��d|z}t||�}t||t|��	|j�y#t$rt|||��wxYw)a�
        Sets a particular dilution of position value.

        @param dopType: The type of dilution of position to set. One of
            ('pdop', 'hdop', 'vdop').
        @type dopType: C{str}

        @param value: The value to set the dilution of position type to.
        @type value: C{float}

        If this position error tests dilution of precision invariants,
        it will be checked. If the invariant is not satisfied, the
        assignment will be undone and C{ValueError} is raised.
        �_N)�getattr�setattrr�r�rX)r"r��value�
attributeName�oldValues     r�_setDOPzPositionError._setDOP�sX���g�
�
��4��/����m�U�5�\�2�	��1�1�3���	��D�-��2��	�s	�:�Ac�$�|jd�S�Nr��r�ras rr�zPositionError.pdop�����|�|�F�#�#rc�&�|jd|�Sr��r��r"r�s  rr�zPositionError.pdop�����|�|�F�E�*�*rc�$�|jd�S�Nr�r�ras rr�zPositionError.hdop�r�rc�&�|jd|�Sr�r�r�s  rr�zPositionError.hdop�r�rc�$�|jd�S�Nr�r�ras rr�zPositionError.vdop�r�rc�&�|jd|�Sr�r�r�s  rr�zPositionError.vdop�r�rz.<PositionError (pdop: %s, hdop: %s, vdop: %s)>rvc�b�|j|j|j|jfzS)z�
        Returns a string representation of positioning information object.

        @return: The string representation.
        @rtype: C{str}
        )�_REPR_TEMPLATEr�r�r�ras rr|zPositionError.__repr__�s(���"�"�d�i�i����D�I�I�%F�F�Fr)NNNF)rrrrrUr^r�r�r�r�r�r�r��setterr�r�r�r�r|rrrr�r�Qs����*/��0�.���6
+�?�
�

+�?�
�

+�?�
�
��� �4�$��$�
�[�[�+��+��$��$�
�[�[�+��+��$��$�
�[�[�+��+�F�N�G�#�Grr�c�$�eZdZdZdd�Zdefd�Zy)�BeaconInformationa�
    Information about positioning beacons (a generalized term for the reference
    objects that help you determine your position, such as satellites or cell
    towers).

    @ivar seenBeacons: A set of visible beacons. Note that visible beacons are not
        necessarily used in acquiring a positioning fix.
    @type seenBeacons: C{set} of L{IPositioningBeacon}
    @ivar usedBeacons: A set of the beacons that were used in obtaining a
        positioning fix. This only contains beacons that are actually used, not
        beacons for which it is unknown if they are used or not.
    @type usedBeacons: C{set} of L{IPositioningBeacon}
    c�B�t|�|_t�|_y)z�
        Initializes a beacon information object.

        @param seenBeacons: A collection of beacons that are currently seen.
        @type seenBeacons: iterable of L{IPositioningBeacon}s
        N)�set�seenBeacons�usedBeacons)r"r�s  rr^zBeaconInformation.__init__s���{�+����5��rrvc���tttd���}||j�}||j|jz
�}d}|jt
|j�||��}|S)z�
        Returns a string representation of this beacon information object.

        The beacons are sorted by their identifier.

        @return: The string representation.
        @rtype: C{str}
        �
identifier)�keyz^<BeaconInformation (used beacons ({numUsed}): {usedBeacons}, unused beacons: {unusedBeacons})>)�numUsedr�
unusedBeacons)r�sortedrrr�rY�len)r"�
sortedBeaconsrrr]�	formatteds      rr|zBeaconInformation.__repr__s{�� ��J�|�,D�E�
�#�D�$4�$4�5��%�d�&6�&6��9I�9I�&I�J�
�
0�	��O�O���(�(�)�#�'�$�
�	��rN)r�rrrrr^r�r|rrrr�r��s���!��#�rr�c�(�eZdZdZd�Zd�Zdefd�Zy)�PositioningBeacona$
    A positioning beacon.

    @ivar identifier: The unique identifier for this beacon. This is usually
        an integer. For GPS, this is also known as the PRN.
    @type identifier: Pretty much anything that can be used as a unique
        identifier. Depends on the implementation.
    c��||_y)z�
        Initializes a positioning beacon.

        @param identifier: The identifier for this beacon.
        @type identifier: Can be pretty much anything (see ivar documentation).
        N�r)r"rs  rr^zPositioningBeacon.__init__9s��%��rc�,�t|j�S)z�
        Returns the hash of the identifier for this beacon.

        @return: The hash of the identifier. (C{hash(self.identifier)})
        @rtype: C{int}
        )�hashrras r�__hash__zPositioningBeacon.__hash__Bs���D�O�O�$�$rrvc�"�d|j�d�S)z�
        Returns a string representation of this beacon.

        @return: The string representation.
        @rtype: C{str}
        z	<Beacon (z)>rras rr|zPositioningBeacon.__repr__Ks���4�?�?�+�2�.�.rN)rrrrr^rr�r|rrrrr.s���%�%�/�#�/rrc�&�eZdZdZ	dd�Zdefd�Zy)�	Satellitea�
    A satellite.

    @ivar azimuth: The azimuth of the satellite. This is the heading (positive
        angle relative to true north) where the satellite appears to be to the
        device.
    @ivar elevation: The (positive) angle above the horizon where this
        satellite appears to be to the device.
    @ivar signalToNoiseRatio: The signal to noise ratio of the signal coming
        from this satellite.
    Nc�l�tj|t|��||_||_||_y)ar
        Initializes a satellite object.

        @param identifier: The PRN (unique identifier) of this satellite.
        @type identifier: C{int}
        @param azimuth: The azimuth of the satellite (see instance variable
            documentation).
        @type azimuth: C{float}
        @param elevation: The elevation of the satellite (see instance variable
            documentation).
        @type elevation: C{float}
        @param signalToNoiseRatio: The signal to noise ratio of the connection
            to this satellite (see instance variable documentation).
        @type signalToNoiseRatio: C{float}
        N)rr^rf�azimuth�	elevation�signalToNoiseRatio)r"rrrrs     rr^zSatellite.__init__bs.��$	�"�"�4��Z��9����"���"4��rrvc�*�d}|j|��S)z�
        Returns a string representation of this Satellite.

        @return: The string representation.
        @rtype: C{str}
        zi<Satellite ({s.identifier}), azimuth: {s.azimuth}, elevation: {s.elevation}, snr: {s.signalToNoiseRatio}>ryr{)r"r]s  rr|zSatellite.__repr__zs��
+�	������&�&r)NNNr
rrrrrUs��
�LP�5�0'�#�'rr)r�rFr
r r�r�r�rrRrDr@r�r��MPS_PER_KPHr�rrr�N)(r�	functoolsr�operatorr�typingrr�zope.interfacer�
constantlyrr	�twisted.positioningr
�twisted.python.utilrr�rr�r
r�IPositioningReceiverr �	Exceptionr@rDrFrRr�r�r�r�r�r�r��IPositioningBeaconrr�__all__rrr�<module>r&s>�����%�&�+�,�,�!��!���� �U� �0���
�\�
.�
.�/�2�2�0�2�j�i���i��Y+�L�Y+�xV
�e�V
�r3O��3O�l;2�|�;2�|@A��@A�F)�J�)�*
)�J�
)� dG�L�dG�N3�3�l
�\�
,�
,�-�#/�#/�.�#/�L3'�!�3'�l�r

Zerion Mini Shell 1.0