示例#1
0
    def __init__(self, config_path):
        super(certification, self).__init__()

        PrintConfig.PrintConfig(config_path).show()

        config = ConfigParser.ConfigParser()
        config.read(config_path)
        """DEVICE_INFO"""
        self.device_id = config.getint("DEVICE_INFO", "id")
        """NETWORK_CONF"""
        server_ip = config.get("NETWORK_CONF", "server_ip")
        server_port = config.getint("NETWORK_CONF", "server_port")
        """IMPULSE_RADAR_CONF"""
        serial_path = config.get("IMPULSE_RADAR_CONF", "serial_path")
        serial_baudrate = config.getint("IMPULSE_RADAR_CONF",
                                        "serial_baudrate")
        report_interval = config.getint("IMPULSE_RADAR_CONF",
                                        "report_interval")

        self.seqnum = 0
        self.distance = 0

        self.radar_serial = serial.Serial(serial_path, serial_baudrate)
        self.socket = AutoSocket.AutoSocket(server_ip, server_port)

        self.radar_serial.close()
        self.radar_serial.open()

        schedule.every(report_interval).seconds.do(self.report)
示例#2
0
    def get_config(self, config_path):

        PrintConfig.PrintConfig(config_path).show()

        config = ConfigParser.ConfigParser()
        config.read(config_path)
        """DEVICE_INFO"""
        self.device_id = config.getint("DEVICE_INFO", "id")
        """NETWORK_CONF"""
        self.server_ip = config.get("NETWORK_CONF", "server_ip")
        self.server_port = config.getint("NETWORK_CONF", "server_port")
        """IMPULSE_RADAR_CONF"""
        self.serial_path = config.get("IMPULSE_RADAR_CONF", "serial_path")
        self.serial_baudrate = config.getint("IMPULSE_RADAR_CONF",
                                             "serial_baudrate")
        self.report_interval = config.getint("IMPULSE_RADAR_CONF",
                                             "report_interval")
示例#3
0
#-*- coding: utf-8 -*-

# import schedule  # see https://github.com/dbader/schedule
import threading

import serial
import ConfigParser
from collections import namedtuple

from import_manager import AutoSocket
from import_manager import PrintConfig
from import_manager import protocol

PrintConfig.PrintConfig("config.conf").show()

config = ConfigParser.ConfigParser()
config.read("config.conf")
"""DEVICE_INFO"""
device_id = config.getint("DEVICE_INFO", "id")
"""NETWORK_CONF"""
server_ip = config.get("NETWORK_CONF", "server_ip")
server_port = config.getint("NETWORK_CONF", "server_port")
"""GPS_CONF"""
serial_path = config.get("GPS_CONF", "serial_path")
serial_baudrate = config.getint("GPS_CONF", "serial_baudrate")
report_interval = config.getint("GPS_CONF", "report_interval")
"""GPS_DUMMY_CONF"""
tagid = config.getint("GPS_DUMMY_CONF", "tagid")
default_latitute = config.getfloat("GPS_DUMMY_CONF", "default_latitute")
default_longitute = config.getfloat("GPS_DUMMY_CONF", "default_longitute")
rand_value = config.getint("GPS_DUMMY_CONF", "rand_value")