# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.8
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info
if version_info >= (2, 6, 0):
def swig_import_helper():
from os.path import dirname
import imp
fp = None
try:
fp, pathname, description = imp.find_module('_pyupm_nmea_gps', [dirname(__file__)])
except ImportError:
import _pyupm_nmea_gps
return _pyupm_nmea_gps
if fp is not None:
try:
_mod = imp.load_module('_pyupm_nmea_gps', fp, pathname, description)
finally:
fp.close()
return _mod
_pyupm_nmea_gps = swig_import_helper()
del swig_import_helper
else:
import _pyupm_nmea_gps
del version_info
try:
_swig_property = property
except NameError:
pass # Python < 2.2 doesn't have 'property'.
def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
if (name == "thisown"):
return self.this.own(value)
if (name == "this"):
if type(value).__name__ == 'SwigPyObject':
self.__dict__[name] = value
return
method = class_type.__swig_setmethods__.get(name, None)
if method:
return method(self, value)
if (not static):
if _newclass:
object.__setattr__(self, name, value)
else:
self.__dict__[name] = value
else:
raise AttributeError("You cannot add attributes to %s" % self)
def _swig_setattr(self, class_type, name, value):
return _swig_setattr_nondynamic(self, class_type, name, value, 0)
def _swig_getattr_nondynamic(self, class_type, name, static=1):
if (name == "thisown"):
return self.this.own()
method = class_type.__swig_getmethods__.get(name, None)
if method:
return method(self)
if (not static):
return object.__getattr__(self, name)
else:
raise AttributeError(name)
def _swig_getattr(self, class_type, name):
return _swig_getattr_nondynamic(self, class_type, name, 0)
def _swig_repr(self):
try:
strthis = "proxy of " + self.this.__repr__()
except Exception:
strthis = ""
return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
try:
_object = object
_newclass = 1
except AttributeError:
class _object:
pass
_newclass = 0
def getVersion():
return _pyupm_nmea_gps.getVersion()
getVersion = _pyupm_nmea_gps.getVersion
[docs]class NMEAGPS(_object):
"""
API for the NMEA GPS Module.
ID: nmea_gps
Name: Generic Serial Interface for GPS NMEA Devices
Category: gps
Manufacturer: dfrobot seeed
Connection: uart gpio
Other Names: VK2828u7 ublox LEA-6H This driver was tested with a
number of GPS devices that emit NMEA data via a serial interface of
some sort (typically a UART).
The I2C capablity was tested with a UBLOX LEA-6H based GPS shield from
DFRobot. Currently, the I2C capability is only supported for UBLOX
devices (or compatibles) that conform to the specifications outlined
in the u-blox6 Receiver Description Protocol Specification, Chapter 4,
DDC Port.
An example using the UART.An example using I2C.
C++ includes: nmea_gps.hpp
"""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, NMEAGPS, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, NMEAGPS, name)
__repr__ = _swig_repr
def __init__(self, *args):
"""
NMEAGPS(unsigned int
bus, uint8_t addr)
NMEAGPS object constructor for a UBLOX I2C interface
Parameters:
-----------
bus: Specify which the I2C bus to use.
addr: Specify the I2C address to use. For UBLOX devices, this
typically defaults to 0x42.
"""
this = _pyupm_nmea_gps.new_NMEAGPS(*args)
try:
self.this.append(this)
except Exception:
self.this = this
__swig_destroy__ = _pyupm_nmea_gps.delete_NMEAGPS
__del__ = lambda self: None
[docs] def readStr(self, size):
"""
std::string
readStr(size_t size)
Read character data from the device.
Parameters:
-----------
size: The maximum number of characters to read.
string containing the data read.
"""
return _pyupm_nmea_gps.NMEAGPS_readStr(self, size)
[docs] def writeStr(self, buffer):
"""
int
writeStr(std::string buffer)
Write character data to the device. This is only valid for a UART
device.
Parameters:
-----------
buffer: The string containing the data to write.
The number of bytes written.
"""
return _pyupm_nmea_gps.NMEAGPS_writeStr(self, buffer)
[docs] def enable(self, enable):
"""
void enable(bool enable)
Enable or disable the device. When disabled, the device enters a low
power mode and does not emit NMEA data. It will still maintain
location data however.
Parameters:
-----------
enable: true to enable the device, false otherwise.
"""
return _pyupm_nmea_gps.NMEAGPS_enable(self, enable)
[docs] def setBaudrate(self, baudrate):
"""
void
setBaudrate(unsigned int baudrate)
Set the baudrate of the device. By default, the constructor will set
the baudrate to 9600. This is only valid for UART devices.
Parameters:
-----------
baudrate: The baud rate to set for the device.
"""
return _pyupm_nmea_gps.NMEAGPS_setBaudrate(self, baudrate)
[docs] def dataAvailable(self, millis):
"""
bool
dataAvailable(unsigned int millis)
Determine whether there is data available to be read. In the case of a
UART, this function will wait up to "millis" milliseconds for data
to become available. In the case of an I2C device, the millis argument
is ignored and the function will return immediately, indicating
whether data is available.
Parameters:
-----------
millis: The number of milliseconds to wait for data to become
available.
true if data is available to be read, false otherwise.
"""
return _pyupm_nmea_gps.NMEAGPS_dataAvailable(self, millis)
NMEAGPS_swigregister = _pyupm_nmea_gps.NMEAGPS_swigregister
NMEAGPS_swigregister(NMEAGPS)
# This file is compatible with both classic and new-style classes.