ipositioning.py 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. # Copyright (c) Twisted Matrix Laboratories.
  2. # See LICENSE for details.
  3. """
  4. Positioning interfaces.
  5. @since: 14.0
  6. """
  7. from __future__ import absolute_import, division
  8. from zope.interface import Attribute, Interface
  9. class IPositioningReceiver(Interface):
  10. """
  11. An interface for positioning providers.
  12. """
  13. def positionReceived(latitude, longitude):
  14. """
  15. Method called when a position is received.
  16. @param latitude: The latitude of the received position.
  17. @type latitude: L{twisted.positioning.base.Coordinate}
  18. @param longitude: The longitude of the received position.
  19. @type longitude: L{twisted.positioning.base.Coordinate}
  20. """
  21. def positionErrorReceived(positionError):
  22. """
  23. Method called when position error is received.
  24. @param positioningError: The position error.
  25. @type positioningError: L{twisted.positioning.base.PositionError}
  26. """
  27. def timeReceived(time):
  28. """
  29. Method called when time and date information arrives.
  30. @param time: The date and time (expressed in UTC unless otherwise
  31. specified).
  32. @type time: L{datetime.datetime}
  33. """
  34. def headingReceived(heading):
  35. """
  36. Method called when a true heading is received.
  37. @param heading: The heading.
  38. @type heading: L{twisted.positioning.base.Heading}
  39. """
  40. def altitudeReceived(altitude):
  41. """
  42. Method called when an altitude is received.
  43. @param altitude: The altitude.
  44. @type altitude: L{twisted.positioning.base.Altitude}
  45. """
  46. def speedReceived(speed):
  47. """
  48. Method called when the speed is received.
  49. @param speed: The speed of a mobile object.
  50. @type speed: L{twisted.positioning.base.Speed}
  51. """
  52. def climbReceived(climb):
  53. """
  54. Method called when the climb is received.
  55. @param climb: The climb of the mobile object.
  56. @type climb: L{twisted.positioning.base.Climb}
  57. """
  58. def beaconInformationReceived(beaconInformation):
  59. """
  60. Method called when positioning beacon information is received.
  61. @param beaconInformation: The beacon information.
  62. @type beaconInformation: L{twisted.positioning.base.BeaconInformation}
  63. """
  64. class IPositioningBeacon(Interface):
  65. """
  66. A positioning beacon.
  67. """
  68. identifier = Attribute(
  69. """
  70. A unique identifier for this beacon. The type is dependent on the
  71. implementation, but must be immutable.
  72. """)
  73. class INMEAReceiver(Interface):
  74. """
  75. An object that can receive NMEA data.
  76. """
  77. def sentenceReceived(sentence):
  78. """
  79. Method called when a sentence is received.
  80. @param sentence: The received NMEA sentence.
  81. @type L{twisted.positioning.nmea.NMEASentence}
  82. """
  83. __all__ = [
  84. "IPositioningReceiver",
  85. "IPositioningBeacon",
  86. "INMEAReceiver"
  87. ]