# Path: wildfind/harrier/events.py
# SCAN_START, SCAN_DONE, \
#     GPS_OPEN, GPS_LOC, GPS_SATS, GPS_ERR, \
#     STATUS_IDLE, STATUS_WAIT, STATUS_CAPTURE, STATUS_PROCESS, \
#     INFO, WARN, ERR = range(13)
# class Event(object):
# class Post(object):
#     def __init__(self, eventType, **kwargs):
#     def get_type(self):
#     def get_arg(self, arg):
#     def get_args(self):
#     def __init__(self, queue):
#     def __post(self, event, delay=0):
#     def status(self, eventType):
#     def scan_start(self, delay=0):
#     def scan_done(self, collars=None, timeStamp=None):
#     def gps_open(self, delay):
#     def gps_location(self, location):
#     def gps_satellites(self, satellites):
#     def gps_error(self, error):
#     def error(self, error):
#     def warning(self, warning):
#     def info(self, info):


import threading
import time
import serial
from serial.serialutil import SerialException
from wildfind.harrier import events
                        pos = -pos
                except ValueError:
                    pass

        return pos

    def __open(self):
        self._timeout = Timeout(self.__timeout)
        self._comm = serial.Serial(self._gps.port,
                                   baudrate=self._gps.baud,
                                   bytesize=self._gps.bits,
                                   parity=self._gps.parity,
                                   stopbits=self._gps.stops,
                                   xonxoff=self._gps.soft,
                                   timeout=0)

    def __read(self):
        for resp in self.__serial_read():
            nmea = resp.split('*')
            if len(nmea) == 2:
                data = nmea[0].split(',')
                if data[0] in ['GPGGA', 'GPGSV']:
                    checksum = self.__checksum(nmea[0])
                    if checksum == nmea[1]:
                        if data[0] == 'GPGGA':
                            self.__global_fix(data)
                        elif data[0] == 'GPGSV':
                            self.__sats(data)
                    else:
                        warn = 'Invalid checksum for {} sentence'.format(data[0])

# Path: wildfind/harrier/events.py
# SCAN_START, SCAN_DONE, \
#     GPS_OPEN, GPS_LOC, GPS_SATS, GPS_ERR, \
#     STATUS_IDLE, STATUS_WAIT, STATUS_CAPTURE, STATUS_PROCESS, \
#     INFO, WARN, ERR = range(13)
# class Event(object):
# class Post(object):
#     def __init__(self, eventType, **kwargs):
#     def get_type(self):
#     def get_arg(self, arg):
#     def get_args(self):
#     def __init__(self, queue):
#     def __post(self, event, delay=0):
#     def status(self, eventType):
#     def scan_start(self, delay=0):
#     def scan_done(self, collars=None, timeStamp=None):
#     def gps_open(self, delay):
#     def gps_location(self, location):
#     def gps_satellites(self, satellites):
#     def gps_error(self, error):
#     def error(self, error):
#     def warning(self, warning):
#     def info(self, info):


# Path: wildfind/harrier/gps.py
import threading
import time
import serial
from serial.serialutil import SerialException
from wildfind.harrier import events

                        pos = -pos
                except ValueError:
                    pass

        return pos

    def __open(self):
        self._timeout = Timeout(self.__timeout)
        self._comm = serial.Serial(self._gps.port,
                                   baudrate=self._gps.baud,
                                   bytesize=self._gps.bits,
                                   parity=self._gps.parity,
                                   stopbits=self._gps.stops,
                                   xonxoff=self._gps.soft,
                                   timeout=0)

    def __read(self):
        for resp in self.__serial_read():
            nmea = resp.split('*')
            if len(nmea) == 2:
                data = nmea[0].split(',')
                if data[0] in ['GPGGA', 'GPGSV']:
                    checksum = self.__checksum(nmea[0])
                    if checksum == nmea[1]:
                        if data[0] == 'GPGGA':
                            self.__global_fix(data)
                        elif data[0] == 'GPGSV':
                            self.__sats(data)
                    else:
                        warn = 'Invalid checksum for {} sentence'.format(data[0])

                        events.Post(self._queue).warning(warn)