Esempio n. 1
0
    def __init__(self, name, core_services, extra_settings=[],
            create_remote=True, create_local=True):
        self.__name = name
        self.__core = core_services
        self.__create_remote = create_remote
        self.__create_local = create_local

        ## Local State Variables:
        self.__xbee_manager = None

        from core.tracing import get_tracer
        self.__tracer = get_tracer(name)

        ## Settings Table Definition:
        settings_list = [
            Setting( name='xbee_device_manager', type=str, required=True),
            Setting( name='extended_address', type=str, required=True),
            Setting( name='endpoint', type=int, required=True),
            Setting( name='profile', type=int, required=True),
            Setting( name='cluster', type=int, required=True),
            Setting( name='local', type=str, required=False),
            Setting( name='remote', type=str, required=False),
        ]
        for s in extra_settings:
            settings_list.append(Setting(name=s['name'], type=s['type'],
                required=s['required']))
            

        ## Channel Properties Definition is in start() below:
        property_list = []
                                            
        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core,
                                settings_list, property_list)
    def __init__(self, name, core_services):
        self.__name = name
        self.__core = core_services
        
        ## Settings Table Definition:
        settings_list = [
            Setting(
                name='sample_rate_ms', type=float, required=False,
                default_value=1000.0,
                verify_function=lambda x: x >= 0.0),
            Setting(
                name='channel_settings', type=str, required=False,
                default_value="name,unit"),
        ]

        ## Channel Properties Definition:
        property_list = []
                                            
        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core, settings_list, property_list)

        ## Thread initialization:
        self.__stopevent = threading.Event()
        threading.Thread.__init__(self, name=name)
        threading.Thread.setDaemon(self, True)
    def __init__(self, name, core_services):
        self.__name = name
        self.__core = core_services

        ## Settings Table Definition:
        settings_list = [
            Setting(
                name='count_init', type=int, required=False, default_value=0,
                  verify_function=lambda x: x >= 0),
            Setting(
                name='update_rate', type=float, required=False, default_value=1.0,
                  verify_function=lambda x: x > 0.0),
        ]

        ## Channel Properties Definition:
        property_list = [
            # gettable properties
            ChannelSourceDeviceProperty(name="counter", type=int,
                initial=Sample(timestamp=0, value=0),
                perms_mask=DPROP_PERM_GET|DPROP_PERM_REFRESH, 
                options=DPROP_OPT_AUTOTIMESTAMP,
                refresh_cb = self.refresh_counter),

            ChannelSourceDeviceProperty(name="adder_total", type=float,
                initial=Sample(timestamp=0, value=0.0),
                perms_mask=DPROP_PERM_GET, 
                options=DPROP_OPT_AUTOTIMESTAMP),        

            # settable properties
            ChannelSourceDeviceProperty(name="counter_reset", type=int,
                perms_mask=DPROP_PERM_SET,
                set_cb=self.prop_set_counter_reset),

            ChannelSourceDeviceProperty(name="global_reset", type=int,
                perms_mask=DPROP_PERM_SET,
                set_cb=self.prop_set_global_reset),

            # gettable & settable properties
            ChannelSourceDeviceProperty(name="adder_reg1", type=float,
                initial=Sample(timestamp=0, value=0.0),
                perms_mask=(DPROP_PERM_GET|DPROP_PERM_SET),
                options=DPROP_OPT_AUTOTIMESTAMP,
                set_cb=lambda x: self.prop_set_adder("adder_reg1", x)),

            ChannelSourceDeviceProperty(name="adder_reg2", type=float,
                initial=Sample(timestamp=0, value=0.0),
                perms_mask=(DPROP_PERM_GET|DPROP_PERM_SET),
                options=DPROP_OPT_AUTOTIMESTAMP,
                set_cb=lambda x: self.prop_set_adder("adder_reg2", x)),

        ]
                                            
        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core,
                                settings_list, property_list)

        ## Thread initialization:
        self.__stopevent = threading.Event()
        threading.Thread.__init__(self, name=name)
        threading.Thread.setDaemon(self, True)
Esempio n. 4
0
    def __init__(self, name, core_services, settings, properties):

        # DeviceBase will create:
        # self._name, self._core, self._tracer,

        self._xbee_manager = None
        self._extended_address = None

        ## Settings Table Definition:
        settings_list = [
            Setting(
                name='xbee_device_manager', type=str, required=True),
            Setting(
                name='extended_address', type=str, required=True),
        ]

        # Add our settings_list entries into the settings passed to us.
        settings = self.merge_settings(settings, settings_list)

        ## Channel Properties Definition:
        property_list = [

        ]

        # Add our property_list entries into the properties passed to us.
        properties = self.merge_properties(properties, property_list)

        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, name, core_services, settings, properties)

        self._tracer.calls("XBeeBase.__init__()")
    def __init__(self, name, core_services):
        # Create protected dictionaries and lists
        self.name_to_signal = lockDict()
        self.name_to_type = lockDict()
        self.signal_to_name = lockDict()
        self.signal_to_units_range = lockDict()
        self.reads_reqd = lockList()
        self.signals_reqd = lockList()
        self.units_reqd = lockList()
        self.names_reqd = lockList()

        self.info_timeout_scale = 1

        self.__name = name
        self.__core = core_services

        ## Local State Variables:
        self.__xbee_manager = None

        from core.tracing import get_tracer
        self.__tracer = get_tracer("XBeeGPIOClient")

        ## Settings Table Definition:
        settings_list = [
            Setting( name='xbee_device_manager', type=str, required=True),
            Setting( name='extended_address', type=str, required=True),
            Setting( name='poll_rate', type=float, required=False),
        ]

        ## Channel Properties Definition is in start() below:
        property_list = []
                                            
        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core,
                                settings_list, property_list)
Esempio n. 6
0
    def __init__(self, name, core_services):
        """
        Standard device init function.
        """
        from core.tracing import get_tracer
        self.__tracer = get_tracer("CSVDevice")
        self.__tracer.info("Initializing CSVDevice")
        self.name = name
        self.core = core_services
        self.tracer = get_tracer(name)

        self.tdict = {}
        self.prop_names = []
        self.dm = self.core.get_service("device_driver_manager")
        self.channel_manager = self.core.get_service('channel_manager')
        self.channel_database = self.channel_manager.channel_database_get()
        settings_list = [
            Setting(name='channel_pattern', type=str, required=True),
            Setting(name='delimiter',
                    type=str,
                    required=False,
                    default_value=','),
            Setting(name='column_names',
                    type=list,
                    default_value=[],
                    required=False),
        ]

        ##No properties defined at first
        property_list = []

        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.name, self.core, settings_list,
                            property_list)
Esempio n. 7
0
    def __init__(self, name, core_services):
        """Basic initialization of members in class"""
        self.__name = name
        self.__core = core_services
        self.cb_handle = None

        self.init_module_logger()
    
        ## Settings Table Definition:
        settings_list = [
            Setting(
                    name='reboot_msg', type=str, required=False, default_value='REBOOT54321',
                    verify_function=lambda x: type(x) == str),
            Setting(
                name='log_level', type=str, required=False, default_value='DEBUG', verify_function=self.check_debug_level_setting),
        ]
    
        ## Channel Properties Definition:
        property_list = []
                                                
        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core,
                                settings_list, property_list)
    
        ## Thread initialization:
        self.__stopevent = threading.Event()
    def __init__(self, name, core_services):
        self.__name = name
        self.__core = core_services

        ## Local State Variables:
        self.__state = STATE_PUMP_OUT_LEFT

        ## Settings Table Definition:
        settings_list = [
            Setting(name=LEFT_VOLUME_CHANNEL, type=str, required=True),
            Setting(name=RIGHT_VOLUME_CHANNEL, type=str, required=True),
            Setting(
                name='transition_threshold', type=float, required=False,
                default_value=5.0,
                verify_function=lambda x: x > 0),
        ]

        ## Channel Properties Definition:
        property_list = [
            # gettable properties
            ChannelSourceDeviceProperty(name="left_pump_on",
                type=Boolean,
                initial=Sample(0, Boolean(False, STYLE_ONOFF)),
                perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),
            ChannelSourceDeviceProperty(name="right_pump_on",
                type=Boolean,
                initial=Sample(0, Boolean(False, STYLE_ONOFF)),
                perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),
        ]
                                            
        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core,
                                settings_list, property_list)
Esempio n. 9
0
    def __init__(self, name, core_services):
        # DeviceBase will create:
        # self._name, self._core, self._tracer, 

        # Settings
        #
        # xbee_device_manager: must be set to the name of an XBeeDeviceManager
        #                      instance.

        settings_list = [
            Setting(
                name='xbee_device_manager', type=str, required=True),
            ]

        ## Channel Properties Definition:
        property_list = [
            # gettable properties
            ChannelSourceDeviceProperty(name="button", type=str,
                initial=Sample(timestamp=0, value=''),
                perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),
            ChannelSourceDeviceProperty(name="cb_trigger", type=bool,
                initial=Sample(timestamp=0, value=False),
                perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),
        ]

        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self,  name, core_services,
                                settings_list, property_list)
Esempio n. 10
0
    def __init__(self, name, core_services):
        self.__name = name
        self.__core = core_services

        ## Settings Table Definition:
        settings_list = [
          Setting(
              name='update_rate', type=float, required=False, default_value=60.0,
                verify_function=lambda x: x > 0.0),
        ]

        ## Channel Properties Definition:
        property_list = [
            # gettable properties
            ChannelSourceDeviceProperty(name="rtt", type=float,
                initial=Sample(timestamp=0, value=0.0, unit="dBm"),
                perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),
            ChannelSourceDeviceProperty(name="evdo", type=float,
                initial=Sample(timestamp=0, value=0.0, unit="dBm"),
                perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP)
        ]

        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core,
                                settings_list, property_list)

        ## Thread initialization:
        self.__stopevent = threading.Event()
        threading.Thread.__init__(self, name=name)
        threading.Thread.setDaemon(self, True)
Esempio n. 11
0
    def __init__(self, name, core, settings, properties):
        self._name = name
        self._core = core
        self._scheduler = self._core.get_service("scheduler")

        self._tracer = get_tracer(name)
        self._filter_channel_object = None
        self._filter_objects = []

        ## Settings Table Definition:
        settings_list = [
            Setting(name='target_channel_filter',
                    type=str,
                    required=False,
                    default_value='*.*'),
            Setting(name='channel_name_override',
                    type=str,
                    required=False,
                    default_value=""),
        ]
        settings.extend(settings_list)

        property_list = []
        properties.extend(property_list)

        ## Initialize the ServiceBase interface:
        DeviceBase.__init__(self, self._name, self._core, settings, properties)
Esempio n. 12
0
    def __init__(self, name, core_services):
        self.__name = name
        self.__core = core_services

        ## Settings Table Definition:
        settings_list = [
            Setting(
                name='count_init', type=int, required=False, default_value=0,
                  verify_function=lambda x: x >= 0),
            Setting(
                name='update_rate', type=float, required=False, default_value=1.0,
                  verify_function=lambda x: x > 0.0),
        ]

        ## Channel Properties Definition:
        property_list = [
            # gettable properties
            ChannelSourceDeviceProperty(name="counter", type=int,
                initial=Sample(timestamp=0, value=0),
                perms_mask=DPROP_PERM_GET|DPROP_PERM_REFRESH, 
                options=DPROP_OPT_AUTOTIMESTAMP,
                refresh_cb = self.refresh_counter),

            ChannelSourceDeviceProperty(name="adder_total", type=float,
                initial=Sample(timestamp=0, value=0.0),
                perms_mask=DPROP_PERM_GET, 
                options=DPROP_OPT_AUTOTIMESTAMP),        

            # settable properties
            ChannelSourceDeviceProperty(name="counter_reset", type=int,
                perms_mask=DPROP_PERM_SET,
                set_cb=self.prop_set_counter_reset),

            ChannelSourceDeviceProperty(name="global_reset", type=int,
                perms_mask=DPROP_PERM_SET,
                set_cb=self.prop_set_global_reset),

            # gettable & settable properties
            ChannelSourceDeviceProperty(name="adder_reg1", type=float,
                initial=Sample(timestamp=0, value=0.0),
                perms_mask=(DPROP_PERM_GET|DPROP_PERM_SET),
                options=DPROP_OPT_AUTOTIMESTAMP,
                set_cb=lambda x: self.prop_set_adder("adder_reg1", x)),

            ChannelSourceDeviceProperty(name="adder_reg2", type=float,
                initial=Sample(timestamp=0, value=0.0),
                perms_mask=(DPROP_PERM_GET|DPROP_PERM_SET),
                options=DPROP_OPT_AUTOTIMESTAMP,
                set_cb=lambda x: self.prop_set_adder("adder_reg2", x)),

        ]
                                            
        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core,
                                settings_list, property_list)

        ## Thread initialization:
        self.__stopevent = threading.Event()
        threading.Thread.__init__(self, name=name)
        threading.Thread.setDaemon(self, True)
Esempio n. 13
0
    def __init__(self, name, core_services, settings, properties):

        # DeviceBase will create:
        # self._name, self._core, self._tracer,

        self._xbee_manager = None
        self._extended_address = None

        ## Settings Table Definition:
        settings_list = [
            Setting(
                name='xbee_device_manager', type=str, required=True),
            Setting(
                name='extended_address', type=str, required=True),
        ]

        # Add our settings_list entries into the settings passed to us.
        settings = self.merge_settings(settings, settings_list)

        ## Channel Properties Definition:
        property_list = [

        ]

        # Add our property_list entries into the properties passed to us.
        properties = self.merge_properties(properties, property_list)

        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, name, core_services, settings, properties)

        self._tracer.calls("XBeeBase.__init__()")
    def __init__(self, name, core_services, settings, properties):
        self.__name = name
        self.__core = core_services
        ## Local State Variables:
        self.__xbee_manager = None

        ## Settings Table Definition:
        settings_list = [
            Setting(name="xbee_device_manager", type=str, required=True),
            Setting(name="extended_address", type=str, required=True),
        ]

        # Add our settings_list entries to the settings passed to us.
        #
        # NOTE: If the settings passed to us contain a setting that
        #       is of the same name as one of ours, we will use the
        #        passed in setting, and throw ours away.

        for our_setting in settings_list:
            for setting in settings:
                if our_setting.name == setting.name:
                    break
            else:
                settings.append(our_setting)

        ## Channel Properties Definition:
        property_list = []

        # Add our property_list entries to the properties passed to us.
        properties.extend(property_list)

        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core, settings, properties)
Esempio n. 15
0
    def __init__(self, name, core_services):
        # DeviceBase will create:
        # self._name, self._core, self._tracer,

        # Settings
        #
        # xbee_device_manager: must be set to the name of an XBeeDeviceManager
        #                      instance.

        settings_list = [
            Setting(name='xbee_device_manager', type=str, required=True),
        ]

        ## Channel Properties Definition:
        property_list = [
            # gettable properties
            ChannelSourceDeviceProperty(name="button",
                                        type=str,
                                        initial=Sample(timestamp=0, value=''),
                                        perms_mask=DPROP_PERM_GET,
                                        options=DPROP_OPT_AUTOTIMESTAMP),
            ChannelSourceDeviceProperty(name="cb_trigger",
                                        type=bool,
                                        initial=Sample(timestamp=0,
                                                       value=False),
                                        perms_mask=DPROP_PERM_GET,
                                        options=DPROP_OPT_AUTOTIMESTAMP),
        ]

        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, name, core_services, settings_list,
                            property_list)
Esempio n. 16
0
    def __init__(self, name, core_services):
        self.__name = name
        self.__core = core_services

        ## Settings Table Definition:
        settings_list = [
            Setting(
                name='EnglishToSpanish', type=bool, required=False,
                default_value=True)]

        #Declare the Input and Output channels
        property_list = [
            ChannelSourceDeviceProperty(name="InputString", type=str,
                  initial=Sample(time.time(), ""),
                  perms_mask=DPROP_PERM_GET | DPROP_PERM_SET,
                  options=DPROP_OPT_AUTOTIMESTAMP,
                  set_cb=lambda sample: self.translate(sample=sample)),
            ChannelSourceDeviceProperty(name="OutputString", type=str,
                  initial=Sample(time.time(), ""),
                  perms_mask=DPROP_PERM_GET,
                  options=DPROP_OPT_AUTOTIMESTAMP),
        ]

        ## Initialze the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core,
                                settings_list, property_list)
    def __init__(self, name, core_services):
        self.__name = name
        self.__core = core_services
        
        from core.tracing import get_tracer
        self.__tracer = get_tracer(name)

        settings_list = [
            Setting(
                name='extended_address', type=str, required=False,
                default_value=''),
            Setting(
                name='sample_rate_ms', type=int, required=False),
            Setting(
                name='channel_settings', type=str, required=False,
                default_value="name,unit"),
            Setting(
                name='encryption', type=bool, required=False,
                default_value=False)
        ]
        ## Channel Properties Definition:
        property_list = []
        
        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core, settings_list, property_list)

        ## Thread initialization:
        self.__stopevent = threading.Event()
        threading.Thread.__init__(self, name=name)
        threading.Thread.setDaemon(self, True)
Esempio n. 18
0
    def __init__(self, name, core_services):
        # Create protected dictionaries and lists
        self.name_to_signal = lockDict()
        self.name_to_type = lockDict()
        self.signal_to_name = lockDict()
        self.signal_to_units_range = lockDict()
        self.reads_reqd = lockList()
        self.signals_reqd = lockList()
        self.units_reqd = lockList()
        self.names_reqd = lockList()

        self.info_timeout_scale = 1

        self.__name = name
        self.__core = core_services

        ## Local State Variables:
        self.__xbee_manager = None

        from core.tracing import get_tracer
        self.__tracer = get_tracer("XBeeGPIOClient")

        ## Settings Table Definition:
        settings_list = [
            Setting(name='xbee_device_manager', type=str, required=True),
            Setting(name='extended_address', type=str, required=True),
            Setting(name='poll_rate', type=float, required=False),
        ]

        ## Channel Properties Definition is in start() below:
        property_list = []

        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core, settings_list,
                            property_list)
    def __init__(self, name, core_services):
        self.__name = name
        self.__core = core_services
        
        self._logger = init_module_logger(name)        

        ## Local State Variables:
        self.__lora_manager = None
        
        self._extended_address_setting = None
        
        # Settings
        #
        # xbee_device_manager: must be set to the name of an XBeeDeviceManager
        #                      instance.
        # extended_address: the extended address of the XBee Sensor device you
        #                   would like to monitor.
        #
        # Advanced settings:
        #
        # None

        settings_list = [
                         
            Setting(
                name='lora_device_manager', type=str, required=True),
            Setting(
                name='extended_address', type=str, required=True),                         
                  
            Setting(
                name='log_level', type=str, required=False, default_value='DEBUG', verify_function=check_debug_level_setting),                  
          
            ]

        ## Channel Properties Definition:
        property_list = [
            # getable properties
            ChannelSourceDeviceProperty(name='software_version', type=str,
                initial=Sample(timestamp=digitime.time(), value=VERSION_NUMBER),
                perms_mask= DPROP_PERM_GET,
                options=DPROP_OPT_AUTOTIMESTAMP),
                         
            # setable properties
            ChannelSourceDeviceProperty(name='simulate_xbee_frame', type=str,
                initial=Sample(timestamp=0, value=''),
                perms_mask= DPROP_PERM_SET,
                options=DPROP_OPT_AUTOTIMESTAMP,
                set_cb=self._simulate_xbee_frame_cb),
            ChannelSourceDeviceProperty(name='command', type=str,
                initial=Sample(timestamp=0, value=''),
                perms_mask= DPROP_PERM_SET,
                options=DPROP_OPT_AUTOTIMESTAMP,
                set_cb=self._send_command_to_sensor_cb),                         
                         
         ]
        
        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core,
                                        settings_list, property_list)
Esempio n. 20
0
    def __init__(self, name, core_services):
        self.__name = name
        self.__core = core_services

        from core.tracing import get_tracer
        self.__tracer = get_tracer(name)
        
        
        self.main_addr = "mainMistaway_" + gw_extended_address()

        ## Local State Variables:
        self.__xbee_manager = None
        self.__settings_ctx = \
                    core_services.get_service("settings_base").get_context()
        self.__purgatory = []
        self.__callbacks = []

        ## Settings Table Definition:

        settings_list = [
            Setting(
                name='xbee_device_manager', type=str, required=True),

            # Contains the device driver settings for every device
            # that is intended to be auto enumerated.
            # The 'name: tag' is used as part of the new device name
            Setting(name='devices', type=dict, required=True,
                    default_value=[]),

            Setting(
                name='discover_rate', type=int, required=False,
                default_value=600,
                verify_function=lambda x: x >= 1 and x <= 86400),

            # Shortens the discovered device names, when NI is not used,
            # to only include the last two octets of the XBee MAC Address.
            # User must confirm uniqueness of these 2 octets.
            # Example: 'aio_[00:13:a2:00:40:52:e0:fc]!'
            # becomes just 'aio_E0_FC'
            Setting(name='short_names', type=bool, required=False,
                    default_value=False),
        ]

        ## Channel Properties Definition:
        property_list = [

        ]

        self.__add_device_queue = Queue.Queue()

        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core,
                                settings_list, property_list)

        ## Thread initialization:
        self.__stopevent = threading.Event()
        threading.Thread.__init__(self, name=name)
        threading.Thread.setDaemon(self, True)
    def __init__(self, name, core_services):
        self.__name = name
        self.__core = core_services

        self.targets = {}

        from core.tracing import get_tracer
        self.__tracer = get_tracer(name)

        ## Settings Table Definition:
        settings_list = [

            Setting(name=PROP_PRINTF, type=str, required=False, default_value=PROP_MINUTE),

            Setting( # how often to check for work
                name=PROP_TICK_RATE, type=int, required=False,
                default_value=DEFAULT_TICK_RATE,
                verify_function=lambda x: x > 0.0),
        ]

        ## Channel Properties Definition:
        property_list = [
            # gettable properties

            ChannelSourceDeviceProperty(name=PROP_15SEC, type=tuple,
                initial=Sample(timestamp=0, value=(0,None)),
                perms_mask=DPROP_PERM_GET),

            ChannelSourceDeviceProperty(name=PROP_MINUTE, type=tuple,
                initial=Sample(timestamp=0, value=(0,None)),
                perms_mask=DPROP_PERM_GET),

            ChannelSourceDeviceProperty(name=PROP_15MIN, type=tuple,
                initial=Sample(timestamp=0, value=(0,None)),
                perms_mask=DPROP_PERM_GET),

            ChannelSourceDeviceProperty(name=PROP_HOUR, type=tuple,
                initial=Sample(timestamp=0, value=(0,None)),
                perms_mask=DPROP_PERM_GET),

            ChannelSourceDeviceProperty(name=PROP_SIXHR, type=tuple,
                initial=Sample(timestamp=0, value=(0,None)),
                perms_mask=DPROP_PERM_GET),

            ChannelSourceDeviceProperty(name=PROP_DAY, type=tuple,
                initial=Sample(timestamp=0, value=(0,None)),
                perms_mask=DPROP_PERM_GET),

        ]

        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core,
                                settings_list, property_list)

        ## Thread initialization:
        self.__stopevent = threading.Event()
        threading.Thread.__init__(self, name=name)
        threading.Thread.setDaemon(self, True)
Esempio n. 22
0
    def __init__(self, name, core_services, settings = None):
        self.__name = name
        self.__core = core_services
        
        #Setting table definition
        settings_list = [
            Setting(                
                name = 'analog1_mode', type = str, required = False,
                default_value = 'Receiver'),
            Setting(                
                name = 'analog2_mode', type = str, required = False,
                default_value = 'Receiver'),
            Setting(                
                name = 'analog3_mode', type = str, required = False,
                default_value = 'Receiver'),
            Setting(                
                name = 'analog4_mode', type = str, required = False,
                default_value = 'Receiver'),
            Setting(
                name = 'channel1_dir', type = str, required = False,
                default_value = 'in'),
            Setting(
                name = 'channel2_dir', type = str, required = False,
                default_value = 'in'),
            Setting(
                name = 'channel3_dir', type = str, required = False,
                default_value = 'in'),
            Setting(
                name = 'channel4_dir', type = str, required = False,
                default_value = 'in'),
            Setting(
                name = 'channel1_source', type = str, required = False),
            Setting(
                name = 'channel2_source', type = str, required = False),
            Setting(
                name = 'channel3_source', type = str, required = False),
            Setting(
                name = 'channel4_source', type = str, required = False),
            Setting(
                name = 'sample_rate_ms', type = float, required = False, 
                    default_value = 10000.0,
                        verify_function = lambda x: x > 0.0),
        ]             
                  
        #Properties are added dynamically based on configuration.
        property_list = [
        ]
        
        #Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core,
                                settings_list, property_list)

        ## Thread initialization:
        self.__stopevent = threading.Event()
        threading.Thread.__init__(self, name=name)
        threading.Thread.setDaemon(self, True)
Esempio n. 23
0
    def __init__(self, name, core_services):
        self.__name = name
        self.__core = core_services

        ## Local State Variables:
        self.__response_buffer = ""
        self.__request_events = []
        self.__request_retry_events = []

        from core.tracing import get_tracer
        self.__tracer = get_tracer(name)

        ## Settings Table Definition:
        settings_list = [
            Setting(
                name='poll_rate_sec', type=int, required=False,
                default_value=5,
                verify_function=lambda x: x >= 0),
            Setting(
                name='bus_id', type=int, required=False,
                default_value=0,
                verify_function=lambda x: x >= 0),
        ]

        ## Channel Properties Definition:
        property_list = [
            # gettable properties
            ChannelSourceDeviceProperty(name="strength", type=int,
                initial=Sample(timestamp=0, value=0, unit="%"),
                perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="target_detected", type=Boolean,
                initial=Sample(timestamp=0,
                    value=Boolean(False, style=STYLE_YESNO)),
                perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="error_flag", type=Boolean,
                initial=Sample(timestamp=0,
                    value=Boolean(False, style=STYLE_YESNO)),
                perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="range", type=int,
                initial=Sample(timestamp=0, value=0, unit="in"),
                perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="temperature", type=float,
                initial=Sample(timestamp=0, value=0.0, unit="C"),
                perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),
        ]

        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core,
                                settings_list, property_list)

        ## Initialize the serial interface:
        Serial.__init__(self, 0, 19200, timeout = 0)
    def __init__(self, name, core_services):
        self.__name = name
        self.__core = core_services

        ## Local State Variables:
        self.__response_buffer = ""
        self.__request_events = []
        self.__request_retry_events = []

        from core.tracing import get_tracer
        self.__tracer = get_tracer(name)

        ## Settings Table Definition:
        settings_list = [
            Setting(
                name='poll_rate_sec', type=int, required=False,
                default_value=5,
                verify_function=lambda x: x >= 0),
            Setting(
                name='bus_id', type=int, required=False,
                default_value=0,
                verify_function=lambda x: x >= 0),
        ]

        ## Channel Properties Definition:
        property_list = [
            # gettable properties
            ChannelSourceDeviceProperty(name="strength", type=int,
                initial=Sample(timestamp=0, value=0, unit="%"),
                perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="target_detected", type=Boolean,
                initial=Sample(timestamp=0,
                    value=Boolean(False, style=STYLE_YESNO)),
                perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="error_flag", type=Boolean,
                initial=Sample(timestamp=0,
                    value=Boolean(False, style=STYLE_YESNO)),
                perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="range", type=int,
                initial=Sample(timestamp=0, value=0, unit="in"),
                perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="temperature", type=float,
                initial=Sample(timestamp=0, value=0.0, unit="C"),
                perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),
        ]

        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core,
                                settings_list, property_list)

        ## Initialize the serial interface:
        Serial.__init__(self, 0, 19200, timeout = 0)
Esempio n. 25
0
    def __init__(self, name, core_services):
        self.__name = name
        self.__core = core_services

        from core.tracing import get_tracer
        self.__tracer = get_tracer(name)

        ## Local State Variables:
        self.__xbee_manager = None
        self.__settings_ctx = \
                    core_services.get_service("settings_base").get_context()
        self.__purgatory = []
        self.__callbacks = []

        ## Settings Table Definition:

        settings_list = [
            Setting(name='xbee_device_manager', type=str, required=True),

            # Contains the device driver settings for every device
            # that is intended to be auto enumerated.
            # The 'name: tag' is used as part of the new device name
            Setting(name='devices', type=dict, required=True,
                    default_value=[]),
            Setting(name='discover_rate',
                    type=int,
                    required=False,
                    default_value=600,
                    verify_function=lambda x: x >= 60 and x <= 86400),

            # Shortens the discovered device names, when NI is not used,
            # to only include the last two octets of the XBee MAC Address.
            # User must confirm uniqueness of these 2 octets.
            # Example: 'aio_[00:13:a2:00:40:52:e0:fc]!'
            # becomes just 'aio_E0_FC'
            Setting(name='short_names',
                    type=bool,
                    required=False,
                    default_value=False),
        ]

        ## Channel Properties Definition:
        property_list = []

        self.__add_device_queue = Queue.Queue()

        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core, settings_list,
                            property_list)

        ## Thread initialization:
        self.__stopevent = threading.Event()
        threading.Thread.__init__(self, name=name)
        threading.Thread.setDaemon(self, True)
Esempio n. 26
0
    def __init__(self, name, core_services):
        self.__name = name
        self.__core = core_services
        print "SystemStatus: initializing class"

        ## Settings Table Definition:
        settings_list = [
            Setting(name='update_rate', type=float, required=False, default_value=300.0),
            Setting(name='no_mobile', type=bool, required=False, default_value=False),
            Setting(name='no_zigbee', type=bool, required=False, default_value=False),
        ]

        ## Channel Properties Definition:
        property_list = [
            # gettable & settable properties
            ChannelSourceDeviceProperty(name="free_memory", type=int,
                initial=Sample(timestamp=0, unit="bytes", value=0),
                perms_mask=(DPROP_PERM_GET),options=DPROP_OPT_AUTOTIMESTAMP),
            ChannelSourceDeviceProperty(name="cpu_utilization", type=int,
                initial=Sample(timestamp=0, unit="%", value=0),
                perms_mask=(DPROP_PERM_GET), options=DPROP_OPT_AUTOTIMESTAMP),
            #ChannelSourceDeviceProperty(name="mobile_status", type=str,
             #   initial=Sample(timestamp=0, value="N/A"),
             #   perms_mask=(DPROP_PERM_GET), options=DPROP_OPT_AUTOTIMESTAMP),
            #ChannelSourceDeviceProperty(name="mobile_rssi", type=int,
             #   initial=Sample(timestamp=0, value=0),
              #  perms_mask=(DPROP_PERM_GET), options=DPROP_OPT_AUTOTIMESTAMP),
            ChannelSourceDeviceProperty(name="idigi_status", type=str,
                initial=Sample(timestamp=0, value="N/A"),
                perms_mask=(DPROP_PERM_GET), options=DPROP_OPT_AUTOTIMESTAMP),
        ]

        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core,
                                settings_list, property_list)

        print "Setting no_mobile:",SettingsBase.get_setting(self, "no_mobile")
        if not SettingsBase.get_setting(self,"no_mobile"):
            print "adding mobile properties"
            self.add_property(ChannelSourceDeviceProperty(name="mobile_rssi", type=int,
                initial=Sample(timestamp=0, value=0),
                perms_mask=(DPROP_PERM_GET), options=DPROP_OPT_AUTOTIMESTAMP))
            self.add_property(ChannelSourceDeviceProperty(name="mobile_status", type=str,
                initial=Sample(timestamp=0, value="N/A"),
                perms_mask=(DPROP_PERM_GET), options=DPROP_OPT_AUTOTIMESTAMP))
        self.apply_settings()

        print "Setting no_zigbee:",SettingsBase.get_setting(self, "no_zigbee")
        if not SettingsBase.get_setting(self,"no_zigbee"):
            print "adding zigbee properties"
            self.add_property(ChannelSourceDeviceProperty(name="zigbee_coord_rssi", type=int,
                initial=Sample(timestamp=0, value=0),
                perms_mask=(DPROP_PERM_GET), options=DPROP_OPT_AUTOTIMESTAMP))
        self.apply_settings()
    def __init__(self, name, core_services):
        self.__name = name
        self.__core = core_services

        ## Settings Table Definition:
        settings_list = [
            Setting(
                name='prefix_init', type=str, required=False, 
                default_value="Hello ",
                verify_function=lambda x: len(x) >= 1),
            Setting(
                name='suffix_init', type=str, required=False, 
                default_value="World!",
                verify_function=lambda x: len(x) >= 1),
            Setting(
                name='update_rate', type=float, required=False, 
                default_value=1.0,
                verify_function=lambda x: x > 0.0),
        ]

        from core.tracing import get_tracer
        self.__tracer = get_tracer(name)
        
        ## Channel Properties Definition:
        property_list = [
            # gettable properties

            ChannelSourceDeviceProperty(name="prefix_string", type=str,
                initial=Sample(timestamp=0, value="Hello "),
                perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),
                
            ChannelSourceDeviceProperty(name="xtended_string", type=str,
                initial=Sample(timestamp=0, value="Hello World!"),
                perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),
                

            # gettable & settable properties
            ChannelSourceDeviceProperty(name="suffix_string", type=str,
                initial=Sample(timestamp=0, value="World!"),
                perms_mask=(DPROP_PERM_GET|DPROP_PERM_SET),
                options=DPROP_OPT_AUTOTIMESTAMP,
                set_cb=self.prop_set_suffix),
                
        ]
                                            
        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core,
                                settings_list, property_list)

        ## Thread initialization:
        self.__stopevent = threading.Event()
        threading.Thread.__init__(self, name=name)
        threading.Thread.setDaemon(self, True)
Esempio n. 28
0
    def __init__(self, name, core_services):
        self.__name = name
        self.__core = core_services

        #Setting table definition
        settings_list = [
            Setting(name='sample_rate',
                    type=float,
                    required=False,
                    default_value=10.0,
                    verify_function=lambda x: x > 0.0),
        ]

        #Channel properties definition, initially all ports are off
        #Can switch on by deploying a prop_set_port function
        property_list = [
            ChannelSourceDeviceProperty(name="latitude",
                                        type=float,
                                        initial=Sample(timestamp=0, value=0.0),
                                        perms_mask=csdp.DPROP_PERM_GET
                                        | csdp.DPROP_PERM_REFRESH,
                                        options=csdp.DPROP_OPT_AUTOTIMESTAMP),
            ChannelSourceDeviceProperty(name="longitude",
                                        type=float,
                                        initial=Sample(timestamp=0, value=0.0),
                                        perms_mask=csdp.DPROP_PERM_GET
                                        | csdp.DPROP_PERM_REFRESH,
                                        options=csdp.DPROP_OPT_AUTOTIMESTAMP),
            ChannelSourceDeviceProperty(name="altitude",
                                        type=float,
                                        initial=Sample(timestamp=0, value=0.0),
                                        perms_mask=csdp.DPROP_PERM_GET
                                        | csdp.DPROP_PERM_REFRESH,
                                        options=csdp.DPROP_OPT_AUTOTIMESTAMP),
            ChannelSourceDeviceProperty(name="current_time",
                                        type=int,
                                        initial=Sample(timestamp=0, value=0),
                                        perms_mask=csdp.DPROP_PERM_GET
                                        | csdp.DPROP_PERM_REFRESH,
                                        options=csdp.DPROP_OPT_AUTOTIMESTAMP),
        ]

        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core, settings_list,
                            property_list)

        ## Thread initialization:
        self.__stopevent = threading.Event()
        threading.Thread.__init__(self, name=name)
        threading.Thread.setDaemon(self, True)
Esempio n. 29
0
    def __init__(self, name, core_services):
        self.__core = core_services
        self.__tracer = get_tracer("SubTot(%s)" % name)

        # hold last totalizer - start as invalid
        self.total_last = None
        self.delta_out = None
        self.hourly = None
        self.daily = None

        ##Settings Table Definition:
        settings_list = [
            # subscription to totalizer source
            Setting( name=self.TOTAL_SOURCE, type=str, required=True),

            # disable use of the annotated channels
            Setting( name=self.ANNOTATE, type=bool, required=False,
                default_value=True),

            # define the ROLL_OVER point
            Setting( name=self.ROLLOVER, type=long, required=False,
                default_value=0xFFFFFFFFL),

            # enable the delta output channel
            Setting( name=self.DELTA_ENB, type=bool, required=False,
                default_value=True),

            # enable the hourly output channel(s)
            Setting( name=self.HOURLY_ENB, type=bool, required=False,
                default_value=False),

            # enable the daily output channel(s)
            Setting( name=self.DAILY_ENB, type=bool, required=False,
                default_value=False),
        ]

        ##Channel Properties Definition:
        ##Properties are added dynamically based on configured transforms
        property_list = [
            # an input to RESET the totals
            ChannelSourceDeviceProperty(name=self.TOTAL_OUT, type=long,
                initial=Sample(timestamp=0, value=-1L),
                perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ]

        ## Initialze the Devicebase interface:
        DeviceBase.__init__(self, name, self.__core,
                                settings_list, property_list)
        return
    def __init__(self, name, core_services):
        ## Initialize and declare class variables
        self.__name = name
        self.__core = core_services

        self.__logger = init_module_logger(name)

        ## Settings Table Definition:
        settings_list = [
            Setting(name='baudrate',
                    type=int,
                    required=False,
                    default_value=38400,
                    verify_function=lambda x: x > 0),
            Setting(name='port', type=str, required=False, default_value='11'),
            Setting(name='mainloop_serial_read_timeout',
                    type=int,
                    required=False,
                    default_value=30),
            Setting(name='log_level',
                    type=str,
                    required=False,
                    default_value='DEBUG',
                    verify_function=check_debug_level_setting),
        ]

        ## Channel Properties Definition:
        property_list = [
            ChannelSourceDeviceProperty(name='software_version',
                                        type=str,
                                        initial=Sample(
                                            timestamp=digitime.time(),
                                            value=VERSION_NUMBER),
                                        perms_mask=DPROP_PERM_GET,
                                        options=DPROP_OPT_AUTOTIMESTAMP),
            ChannelSourceDeviceProperty(name="LoRaPlugAndSenseFrame",
                                        type=str,
                                        initial=Sample(timestamp=0, value=''),
                                        perms_mask=DPROP_PERM_GET,
                                        options=DPROP_OPT_AUTOTIMESTAMP),
        ]

        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core, settings_list,
                            property_list)

        ## Thread initialization:
        self.__stopevent = threading.Event()
        threading.Thread.__init__(self, name=name)
        threading.Thread.setDaemon(self, True)
    def __init__(self, name, core_services):
        self.__name = name
        self.__core = core_services
        self.__tracer = get_tracer(name)

        settings_list = []

        ## Channel Properties Definition:
        property_list = [
            ChannelSourceDeviceProperty(
                name="critical",
                type=str,
                initial=Sample(value=""),
                perms_mask=DPROP_PERM_GET | DPROP_PERM_SET | DPROP_PERM_REFRESH,
                set_cb=lambda x: self.__tracer.critical(x.value),
            ),
            ChannelSourceDeviceProperty(
                name="error",
                type=str,
                initial=Sample(value=""),
                perms_mask=DPROP_PERM_GET | DPROP_PERM_SET | DPROP_PERM_REFRESH,
                set_cb=lambda x: self.__tracer.error(x.value),
            ),
            ChannelSourceDeviceProperty(
                name="warning",
                type=str,
                initial=Sample(value=""),
                perms_mask=DPROP_PERM_GET | DPROP_PERM_SET | DPROP_PERM_REFRESH,
                set_cb=lambda x: self.__tracer.warning(x.value),
            ),
            ChannelSourceDeviceProperty(
                name="info",
                type=str,
                initial=Sample(value=""),
                perms_mask=DPROP_PERM_GET | DPROP_PERM_SET | DPROP_PERM_REFRESH,
                set_cb=lambda x: self.__tracer.info(x.value),
            ),
            ChannelSourceDeviceProperty(
                name="debug",
                type=str,
                initial=Sample(value=""),
                perms_mask=DPROP_PERM_GET | DPROP_PERM_SET | DPROP_PERM_REFRESH,
                set_cb=lambda x: self.__tracer.debug(x.value),
            ),
        ]

        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core, settings_list, property_list)
    def __init__(self, name, core_services):
        self.__name = name
        self.__core = core_services
        self.showname = 'M300(%s)' % name

        ## Local State Variables:
        self.__response_buffer = ""
        self.__poll_event = None
        self.__request_events = []

        # will hold the list of sensor objects
        self.__sensor_list = []

        self._tracer = get_tracer(name)

        ## Settings Table Definition:
        settings_list = [
            Setting(
                name='sample_rate_sec', type=str, required=False,
                default_value='60'),

            Setting(
                name='bus_id_list', type=list, required=False,
                default_value=[1]),

            Setting(
                name='manual_trigger', type=bool, required=False,
                default_value=False),

            Setting(name='trace', type=str, required=False,
                    default_value='fancy'),
        ]

        ## Channel Properties Definition:
        #    are defined dynamically within self.start()
        property_list = [
        ]

        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core,
                                settings_list, property_list)

        ## Initialize the serial interface:
        # Set the baud rate to 19200,8,N,1 expect answer within 1 secs
        Serial.__init__(self, 0, baudrate=19200, parity='N', \
                        timeout=0.5)

        return
    def __init__(self, name, core_services):
        self.__name = name
        self.__core = core_services

        self.__logger = init_module_logger(name)

        ## Settings Table Definition:
        settings_list = [
            Setting(name='log_level',
                    type=str,
                    required=False,
                    default_value='DEBUG',
                    verify_function=check_debug_level_setting),
        ]

        ## Channel Properties Definition:
        property_list = [
            # gettable properties
            ChannelSourceDeviceProperty(name="raw_out",
                                        type=str,
                                        initial=Sample(timestamp=0, value=""),
                                        perms_mask=DPROP_PERM_GET,
                                        options=DPROP_OPT_AUTOTIMESTAMP),

            # settable properties
            ChannelSourceDeviceProperty(name="raw_in",
                                        type=str,
                                        initial=Sample(
                                            timestamp=0,
                                            value='__INITIAL_SAMPLE__'),
                                        perms_mask=DPROP_PERM_SET,
                                        set_cb=self.__prop_set_raw_in),
            ChannelSourceDeviceProperty(name='software_version',
                                        type=str,
                                        initial=Sample(timestamp=0,
                                                       value=_VERSION_NUMBER),
                                        perms_mask=DPROP_PERM_GET,
                                        options=DPROP_OPT_AUTOTIMESTAMP),
        ]

        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core, settings_list,
                            property_list)

        ## Thread initialization:
        self.__stopevent = threading.Event()
        threading.Thread.__init__(self, name=name)
        threading.Thread.setDaemon(self, True)
    def __init__(self, name, core_services):
        self.__name = name
        self.__core = core_services
        self.__sched = self.__core.get_service('scheduler')

        self.__scheduled_event = None

        from core.tracing import get_tracer
        self.__tracer = get_tracer(name)
        
        ## Settings Table Definition:
        settings_list = [
            Setting(
                name='alarm_level', type=int, required=False, default_value=5,
                  verify_function=lambda x: x >= 0),
            Setting(
                name='sample_rate_sec', type=float, required=False,
                default_value=15.0, verify_function=lambda x: x > 0.0),
        ]

        ## Channel Properties Definition:
        property_list = [
            # gettable properties
            ChannelSourceDeviceProperty(name="counter", type=int,
                initial=Sample(timestamp=0, value=0),
                perms_mask=DPROP_PERM_GET, 
                options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="alarm", type=bool,
                initial=Sample(timestamp=0, value=False),
                perms_mask=DPROP_PERM_GET,
                options=DPROP_OPT_AUTOTIMESTAMP),

            # gettable & settable properties
            ChannelSourceDeviceProperty(name="config_level", type=int,
                perms_mask=DPROP_PERM_SET|DPROP_PERM_GET,
                set_cb=self.prop_set_alarm_level),

            ChannelSourceDeviceProperty(name="config_sample_rate", type=float,
                initial=Sample(0,5.0),
                perms_mask=DPROP_PERM_SET|DPROP_PERM_GET,
                set_cb=self.prop_set_sample_rate),

        ]
                                            
        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core,
                                settings_list, property_list)
Esempio n. 35
0
    def __init__(self, name, core_services):
        self.__name = name
        self.__core = core_services
        self.showname = 'M300(%s)' % name

        ## Local State Variables:
        self.__response_buffer = ""
        self.__poll_event = None
        self.__request_events = []

        # will hold the list of sensor objects
        self.__sensor_list = []

        self._tracer = get_tracer(name)

        ## Settings Table Definition:
        settings_list = [
            Setting(
                name='sample_rate_sec', type=str, required=False,
                default_value='60'),

            Setting(
                name='bus_id_list', type=list, required=False,
                default_value=[1]),

            Setting(
                name='manual_trigger', type=bool, required=False,
                default_value=False),

            Setting(name='trace', type=str, required=False,
                    default_value='fancy'),
        ]

        ## Channel Properties Definition:
        #    are defined dynamically within self.start()
        property_list = [
        ]

        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core,
                                settings_list, property_list)

        ## Initialize the serial interface:
        # Set the baud rate to 19200,8,N,1 expect answer within 1 secs
        Serial.__init__(self, 0, baudrate=19200, parity='N', \
                        timeout=0.5)

        return
Esempio n. 36
0
    def __init__(self, name, core_services):
        self.tracer = get_tracer(name)

        # Learn about the environment
        self.OS_LED_CONTROL = self.take_led_control()
        self.supported_leds = self.get_supported_leds()
        self.stop_event = threading.Event()
        self.clear_event = threading.Event()

        ## Thread initialization:
        threading.Thread.__init__(self, name=name)
        threading.Thread.setDaemon(self, True)
        self.queue = Queue.Queue()

        self.core = core_services

        ## Settings Table Definition:
        settings_list = [
            Setting(
                name='cleared_state',
                type=Boolean,
                required=False,
                default_value=False,
            )
        ]

        ## Channel Properties Definition:
        property_list = [
            # gettable properties
            ChannelSourceDeviceProperty(name="repeat_pattern",
                                        type=str,
                                        initial=Sample(timestamp=0, value=""),
                                        perms_mask=DPROP_PERM_SET,
                                        options=DPROP_OPT_AUTOTIMESTAMP,
                                        set_cb=self.set_blink_pattern),
            ChannelSourceDeviceProperty(name="clear_pattern",
                                        type=bool,
                                        initial=Sample(timestamp=0,
                                                       value=False),
                                        perms_mask=DPROP_PERM_SET,
                                        options=DPROP_OPT_AUTOTIMESTAMP,
                                        set_cb=self.clear_led_blinks),
        ]

        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, name, self.core, settings_list,
                            property_list)
    def __init__(self, name, core_services):
        self.__name = name
        self.__core = core_services

        self.__logger = init_module_logger(logger_name=name, max_backups=1)

        ## Settings Table Definition:
        settings_list = [
            Setting(name='update_rate',
                    type=float,
                    required=False,
                    default_value=5.0,
                    verify_function=lambda x: x > 0.0),
            Setting(name='blinks',
                    type=int,
                    required=False,
                    default_value=20,
                    verify_function=lambda x: (x > 0 and x < 50)),
            Setting(name='blink_speed',
                    type=float,
                    required=False,
                    default_value=0.25,
                    verify_function=lambda x: (x > 0.0 and x < 5.0)),
            Setting(name='cli_command',
                    type=str,
                    required=False,
                    default_value=''),
            Setting(name='command_channel', type=str, required=True),
            Setting(name='log_level',
                    type=str,
                    required=False,
                    default_value='DEBUG',
                    verify_function=check_debug_level_setting),
        ]

        ## Channel Properties Definition:
        property_list = []

        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core, settings_list,
                            property_list)

        ## Thread initialization:
        self.__stopevent = threading.Event()
        threading.Thread.__init__(self, name=name)
        threading.Thread.setDaemon(self, True)
Esempio n. 38
0
    def start(self):
        """\
            Start the device driver.
        """
        self._tracer.calls("XBeeBase.start()")

        # Indicate that we have no more configuration to add:
        self._xbee_manager.xbee_device_configure(self)

        return DeviceBase.start(self)
Esempio n. 39
0
    def start(self):
        """\
            Start the device driver.
        """
        self._tracer.calls("XBeeBase.start()")

        # Indicate that we have no more configuration to add:
        self._xbee_manager.xbee_device_configure(self)

        return DeviceBase.start(self)
Esempio n. 40
0
    def __init__(self, name, core_services):
        self.__name = name
        self.__core = core_services
        self.show_name = 'DigLatch(%s)' % name

        # hold last totalizer - start as invalid
        self.input_last = None
        self.latch_out = None

        ##Settings Table Definition:
        settings_list = [
            # subscription to totalizer source
            Setting( name=self.DIGITAL_SOURCE, type=str, required=True),

            # enable the delta output channel
            Setting( name=self.LATCH_OUT, type=str, required=False,
                default_value='False'),

            # enable the hourly output channel(s)
            #Setting( name=self.HOURLY_OUT, type=str, required=False,
             #   default_value='False'),

            # enable the daily output channel(s)
            #Setting( name=self.DAILY_OUT, type=str, required=False,
            #    default_value='False'),

        ]

        ##Channel Properties Definition:
        ##Properties are added dynamically based on configured transforms
        property_list = [
            # an input to RESET the totals
            #ChannelSourceDeviceProperty(name=self.TOTAL_OUT, type=int,
            #    initial=Sample(timestamp=0, value=-1),
            #    perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ]

        ## Initialze the Devicebase interface:
        DeviceBase.__init__(self, self.__name, self.__core,
                                settings_list, property_list)
        return
Esempio n. 41
0
    def __init__(self, name, core_services):
        self.__name = name
        self.__core = core_services
        self.tlist = []

        cm = self.__core.get_service("channel_manager")
        self.cdb = cm.channel_database_get()

        ## Settings Table Definition:
        settings_list = [
            Setting(name='instance_list', type=list, required=True),
        ]

        ## Channel Properties Definition:
        ## Properties are added dynamically based on configured transforms
        property_list = []

        ## Initialize the Devicebase interface:
        DeviceBase.__init__(self, self.__name, self.__core,
                                settings_list, property_list)
Esempio n. 42
0
    def __init__(self, name, core_services):
        self.__name = name
        self.__core = core_services

        # The __scheduler_handler is the variable that will tell us if there
        # is already a pulse. It is 'None' when the channel is not pulsing
        self.__sched = self.__core.get_service("scheduler")
        self.__scheduler_handler = None

        from core.tracing import get_tracer
        self.__tracer = get_tracer(name)

        ## Settings Table Definition:
        settings_list = [
            Setting(name='duration',
                    type=float,
                    required=False,
                    default_value=5.0,
                    verify_function=lambda x: x > 0.0),
            Setting(name='initial_value',
                    type=bool,
                    required=False,
                    default_value=False,
                    verify_function=lambda x: x is True or x is False),
        ]

        ## Channel Properties Definition:
        property_list = [
            ChannelSourceDeviceProperty(name="pulse_channel",
                                        type=bool,
                                        initial=Sample(timestamp=0,
                                                       value=False),
                                        perms_mask=DPROP_PERM_GET
                                        | DPROP_PERM_SET,
                                        options=DPROP_OPT_AUTOTIMESTAMP,
                                        set_cb=self.pulse_channel_cb),
        ]

        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core, settings_list,
                            property_list)
    def __init__(self, name, core_services):
        self.__name = name
        self.__core = core_services

        from core.tracing import get_tracer
        self.__tracer = get_tracer(name)

        ## Settings Table Definition:
        settings_list = [
            Setting(
                name='update_rate', type=float, required=False, default_value=1.0,
                  verify_function=lambda x: x > 0.0)
        ]

        property_list = [
            ChannelSourceDeviceProperty(name="uptime", type=int,
                  initial=Sample(timestamp=0, value=-1, unit="sec"),
                  perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),
            ChannelSourceDeviceProperty(name="cpu_utilization", type=int,
                  initial=Sample(timestamp=0, value=0, unit="%"),
                  perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),
            ChannelSourceDeviceProperty(name="free_memory", type=int,
                  initial=Sample(timestamp=0, value=-1, unit="bytes"),
                  perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),
            ChannelSourceDeviceProperty(name="used_memory", type=int,
                  initial=Sample(timestamp=0, value=-1, unit="bytes"),
                  perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),
            ChannelSourceDeviceProperty(name="total_memory", type=int,
                  initial=Sample(timestamp=0, value=-1, unit="bytes"),
                  perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),
        ]


        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core,
                                settings_list, property_list)

        ## Thread initialization:
        self.__stopevent = threading.Event()
        threading.Thread.__init__(self, name=name)
        threading.Thread.setDaemon(self, True)
Esempio n. 44
0
    def __init__(self, name, core_services):

        self.logger = init_module_logger(name)

        self.__name = name
        self.__core = core_services

        ## Settings Table Definition:
        settings_list = [
            Setting(name='log_level',
                    type=str,
                    required=False,
                    default_value='DEBUG',
                    verify_function=check_debug_level_setting),
        ]

        from core.tracing import get_tracer
        self.__tracer = get_tracer(name)

        ## Channel Properties Definition:
        property_list = [
            # gettable properties

            # gettable & settable properties
            ChannelSourceDeviceProperty(
                name=CHANNEL_NAME_INCOMING_FRAMES,
                type=str,
                initial=Sample(timestamp=0, value=""),
                perms_mask=(DPROP_PERM_GET | DPROP_PERM_SET),
                options=DPROP_OPT_AUTOTIMESTAMP,
                set_cb=self._receive_raw_xbee_command_cb)
        ]

        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core, settings_list,
                            property_list)

        ## Thread initialization:
        self.__stopevent = threading.Event()
    def __init__(self, name, core, settings, properties):
        self._name = name
        self._core = core
        self._scheduler = self._core.get_service("scheduler")

        self._tracer = get_tracer(name)
        self._filter_channel_object = None
        self._filter_objects = []
        
        ## Settings Table Definition:
        settings_list = [
            Setting(
                name='target_channel_filter', type=str, required=False,
                default_value = '*.*'),
        ]
        settings.extend(settings_list)
        
        property_list = []
        properties.extend(property_list)

        ## Initialize the ServiceBase interface:
        DeviceBase.__init__(self, self._name, self._core, settings, properties)
    def __init__(self, name, core_services):
        self.__name = name
        self.__core = core_services
        
        from core.tracing import get_tracer
        self.__tracer = get_tracer(name)

        # Settings:
        #
        # address:     
        # port:
        # sample_rate_ms:

        settings_list = [
            Setting(
                name='address', type=str, required=False,
                default_value=''),
            Setting(
                name='port', type=str, required=False,
                default_value=''),
            Setting(
                name='sample_rate_ms', type=int, required=False,
                default_value=2000,
                verify_function=lambda x: x > 0 and x < 0xffff),
            Setting(
                name='channel_settings', type=str, required=False,
                default_value="name,unit"),
        ]
        ## Channel Properties Definition:
        property_list = []
        
        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core, settings_list, property_list)

        ## Thread initialization:
        self.__stopevent = threading.Event()
        threading.Thread.__init__(self, name=name)
        threading.Thread.setDaemon(self, True)
Esempio n. 47
0
    def __init__(self,
                 name,
                 core_services,
                 extra_settings=[],
                 create_remote=True,
                 create_local=True):
        self.__name = name
        self.__core = core_services
        self.__create_remote = create_remote
        self.__create_local = create_local

        ## Local State Variables:
        self.__xbee_manager = None

        from core.tracing import get_tracer
        self.__tracer = get_tracer(name)

        ## Settings Table Definition:
        settings_list = [
            Setting(name='xbee_device_manager', type=str, required=True),
            Setting(name='extended_address', type=str, required=True),
            Setting(name='endpoint', type=int, required=True),
            Setting(name='profile', type=int, required=True),
            Setting(name='cluster', type=int, required=True),
            Setting(name='local', type=str, required=False),
            Setting(name='remote', type=str, required=False),
        ]
        for s in extra_settings:
            settings_list.append(
                Setting(name=s['name'], type=s['type'],
                        required=s['required']))

        ## Channel Properties Definition is in start() below:
        property_list = []

        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core, settings_list,
                            property_list)
Esempio n. 48
0
    def __init__(self, name, core_services):
        self.__name = name
        self.__core = core_services
        self.tlist = []

        cm = self.__core.get_service("channel_manager")
        self.cdb = cm.channel_database_get()

        from core.tracing import get_tracer
        self.__tracer = get_tracer(name)

        ## Settings Table Definition:
        settings_list = [
            Setting(name='instance_list', type=list, required=True),
        ]

        ## Channel Properties Definition:
        ## Properties are added dynamically based on configured transforms
        property_list = []

        ## Initialize the Devicebase interface:
        DeviceBase.__init__(self, self.__name, self.__core, settings_list,
                            property_list)
Esempio n. 49
0
    def stop(self):
        """\
            Stop the device driver.
        """
        self._tracer.calls("XBeeBase.stop()")

        # Unregister ourselves with the XBee Device Manager instance:
        if self._xbee_manager is not None:
            self._xbee_manager.xbee_device_unregister(self)

        self._xbee_manager = None
        self._extended_address = None

        return DeviceBase.stop(self)
Esempio n. 50
0
    def stop(self):
        """\
            Stop the device driver.
        """
        self._tracer.calls("XBeeBase.stop()")

        # Unregister ourselves with the XBee Device Manager instance:
        if self._xbee_manager is not None:
            self._xbee_manager.xbee_device_unregister(self)

        self._xbee_manager = None
        self._extended_address = None

        return DeviceBase.stop(self)
Esempio n. 51
0
    def __init__(self, name, core_services):
        self.__name = name
        self.__core = core_services
        
        # The __scheduler_handler is the variable that will tell us if there
        # is already a pulse. It is 'None' when the channel is not pulsing
        self.__sched = self.__core.get_service("scheduler")
        self.__scheduler_handler = None

        from core.tracing import get_tracer
        self.__tracer = get_tracer(name)
        
        ## Settings Table Definition:
        settings_list = [
            Setting(
                name='duration', type=float, required=False, 
                default_value=5.0, verify_function=lambda x: x > 0.0),
                
            Setting(
                name='initial_value', type=bool, 
                required=False, default_value=False,
                verify_function=lambda x: x is True or x is False),
        ]
		
        ## Channel Properties Definition:
        property_list = [
            ChannelSourceDeviceProperty(name="pulse_channel", type=bool,
                initial=Sample(timestamp=0, value=False),
                perms_mask=DPROP_PERM_GET|DPROP_PERM_SET,
                options=DPROP_OPT_AUTOTIMESTAMP,
                set_cb = self.pulse_channel_cb),
        ]
	
        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core,
                                settings_list, property_list)
Esempio n. 52
0
    def __init__(self, name, core_services):
        self.__name = name
        self.__core = core_services

        from core.tracing import get_tracer
        self.__tracer = get_tracer(name)

        ## Settings Table Definition:
        settings_list = [
            Setting(
            name='xbee_device_manager', type=str, required=True),
            Setting(
            name='extended_address', type=str, required=True),
            Setting(
            name='update_rate', type=float, required=False, default_value=5.0,
              verify_function=lambda x: x > 0.0),
        ]

        ## Channel Properties Definition:
        property_list = [
            # gettable properties
            ### vehicle parameters
            ChannelSourceDeviceProperty(name="vehicle_speed", type=float,
            initial=Sample(timestamp=0, value=-1.0),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="engine_speed", type=float,
            initial=Sample(timestamp=0, value=-1.0),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="throttle_position", type=float,
            initial=Sample(timestamp=0, value=-1.0),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="odometer", type=float,
            initial=Sample(timestamp=0, value=-1.0),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="fuel_level", type=float,
            initial=Sample(timestamp=0, value=-1.0),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="fuel_level_remaining",
                                        type=float,
            initial=Sample(timestamp=0, value=-1.0),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="transmission_gear", type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="ignition_status", type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="mil_status", type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="airbag_dash_indicator", type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="abs_dash_indicator", type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="fuel_rate", type=float,
            initial=Sample(timestamp=0, value=-1.0),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="battery_voltage", type=float,
            initial=Sample(timestamp=0, value=-1.0),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="pto_status", type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="seatbelt_fastened", type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="misfire_monitor", type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="fuel_system_monitor", type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="comprehensive_component_monitor",
                                        type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="catalyst_monitor", type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="heated_catalyst_monitor",
                                        type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="evaporative_system_monitor",
                                        type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="secondary_air_system_monitor",
                                        type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="ac_system_refrigerant_monitor",
                                        type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="oxygen_sensor_monitor", type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="oxygen_sensor_heater_monitor",
                                        type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="egr_system_monitor", type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="brake_switch_status", type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="cruise_control_status", type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="turn_signal_status", type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="oil_pressure_lamp", type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="coolant_hot_light", type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="trip_odometer", type=float,
            initial=Sample(timestamp=0, value=-1.0),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="trip_fuel_consumption",
                                        type=float,
            initial=Sample(timestamp=0, value=-1.0),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ### static vehicle parameters

            ChannelSourceDeviceProperty(name="vin", type=str,
            initial=Sample(timestamp=0, value="not acquired"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="supported_parameters", type=str,
            initial=Sample(timestamp=0, value="not acquired"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="diagnostic_trouble_codes",
                                        type=str,
            initial=Sample(timestamp=0, value="not acquired"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="ready_for_communication",
                                        type=int,
            initial=Sample(timestamp=0, value=0),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            # settable properties
            ChannelSourceDeviceProperty(name="force_redetect", type=int,
            perms_mask=DPROP_PERM_SET,
            set_cb=self.prop_set_force_redetect),
        ]

        ## Initialize the Devicebase interface:
        DeviceBase.__init__(self, self.__name, self.__core,
                    settings_list, property_list)

        ## Thread initialization:
        self.__stopevent = threading.Event()
        threading.Thread.__init__(self, name=name)
        threading.Thread.setDaemon(self, True)
    def __init__(self, name, core_services):
        self.__name = name
        self.__core = core_services

        from core.tracing import get_tracer

        self.__tracer = get_tracer(name)

        ## Settings Table Definition:
        settings_list = [
            Setting(name="serial_device", type=str, required=False, default_value="/gps/0"),
            Setting(
                name="serial_baud", type=int, required=False, default_value=4800, verify_function=lambda x: x > 0.0
            ),
            Setting(
                name="sample_rate_sec", type=int, required=False, default_value=60, verify_function=lambda x: x > 0.0
            ),
        ]

        ## Channel Properties Definition:

        # Feel free to create a channel here for any item that the
        # nmea module can extract from a valid sentence.  The
        # property_setter routine will populate correctly.  You may
        # need to extend the sentence templates in nmea.py to teach
        # the library about non position based sentences and types.
        property_list = [
            # gettable properties
            ChannelSourceDeviceProperty(
                name="fix_time",
                type=str,
                initial=Sample(timestamp=0, value=""),
                perms_mask=DPROP_PERM_GET,
                options=DPROP_OPT_AUTOTIMESTAMP,
            ),
            ChannelSourceDeviceProperty(
                name="fix_good",
                type=Boolean,
                initial=Sample(timestamp=0, value=Boolean(False)),
                perms_mask=DPROP_PERM_GET,
                options=DPROP_OPT_AUTOTIMESTAMP,
            ),
            ChannelSourceDeviceProperty(
                name="latitude_degrees",
                type=float,
                initial=Sample(timestamp=0, value=0.0),
                perms_mask=DPROP_PERM_GET,
                options=DPROP_OPT_AUTOTIMESTAMP,
            ),
            ChannelSourceDeviceProperty(
                name="latitude_hemisphere",
                type=str,
                initial=Sample(timestamp=0, value=""),
                perms_mask=DPROP_PERM_GET,
                options=DPROP_OPT_AUTOTIMESTAMP,
            ),
            ChannelSourceDeviceProperty(
                name="longitude_degrees",
                type=float,
                initial=Sample(timestamp=0, value=0.0),
                perms_mask=DPROP_PERM_GET,
                options=DPROP_OPT_AUTOTIMESTAMP,
            ),
            ChannelSourceDeviceProperty(
                name="longitude_hemisphere",
                type=str,
                initial=Sample(timestamp=0, value=""),
                perms_mask=DPROP_PERM_GET,
                options=DPROP_OPT_AUTOTIMESTAMP,
            ),
            ChannelSourceDeviceProperty(
                name="speed_over_ground",
                type=float,
                initial=Sample(timestamp=0, value=0.0),
                perms_mask=DPROP_PERM_GET,
                options=DPROP_OPT_AUTOTIMESTAMP,
            ),
            ChannelSourceDeviceProperty(
                name="course_over_ground",
                type=float,
                initial=Sample(timestamp=0, value=0.0),
                perms_mask=DPROP_PERM_GET,
                options=DPROP_OPT_AUTOTIMESTAMP,
            ),
            ChannelSourceDeviceProperty(
                name="fix_date",
                type=str,
                initial=Sample(timestamp=0, value=""),
                perms_mask=DPROP_PERM_GET,
                options=DPROP_OPT_AUTOTIMESTAMP,
            ),
            ChannelSourceDeviceProperty(
                name="num_satellites",
                type=int,
                initial=Sample(timestamp=0, value=0),
                perms_mask=DPROP_PERM_GET,
                options=DPROP_OPT_AUTOTIMESTAMP,
            ),
            ChannelSourceDeviceProperty(
                name="altitude",
                type=float,
                initial=Sample(timestamp=0, value=0.0),
                perms_mask=DPROP_PERM_GET,
                options=DPROP_OPT_AUTOTIMESTAMP,
            ),
            ChannelSourceDeviceProperty(
                name="hdop",
                type=float,
                initial=Sample(timestamp=0, value=0.0),
                perms_mask=DPROP_PERM_GET,
                options=DPROP_OPT_AUTOTIMESTAMP,
            ),
        ]

        ## Initialize the Devicebase interface:
        DeviceBase.__init__(self, self.__name, self.__core, settings_list, property_list)

        ## Thread initialization:
        self.__stopevent = threading.Event()
        threading.Thread.__init__(self, name=name)
        threading.Thread.setDaemon(self, True)
Esempio n. 54
0
    def __init__(self, name, core_services):

        self.logger = init_module_logger(name)

        # FIXME: remove debug code
        ###### add debug logger to trace strange behaviors
        self.debug_logger = init_module_logger("WP_DEBUG_dd",
                                               max_bytes=1024 * 64,
                                               buffer_size=50,
                                               flush_level=logging.INFO,
                                               flush_window=5)
        self.debug_logger.setLevel(logging.DEBUG)
        self.debug_logger.info(
            'INFO ==============================================================================================='
        )
        # FIXME: end

        self.__name = name
        self.__core = core_services
        self.radio_requests_from_presentation_queue = Queue.Queue(8)

        self._min_delay_between_successive_exchanges_with_waveport = None
        self._time_of_last_exchange_with_waveport = 0

        ## Settings Table Definition:
        settings_list = [
            Setting(name='baudrate',
                    type=int,
                    required=False,
                    default_value=9600,
                    verify_function=lambda x: x > 0),
            Setting(name='port',
                    type=int,
                    required=False,
                    default_value=11,
                    verify_function=lambda x: x >= 0),
            Setting(name='log_level',
                    type=str,
                    required=False,
                    default_value='DEBUG',
                    verify_function=check_debug_level_setting),
            Setting(
                name='_min_delay_between_successive_exchanges_with_waveport',
                type=float,
                required=False,
                default_value=
                DEFAULT_MIN_DELAY_BETWEEN_SUCCESSIVE_EXCHANGES_WITH_WAVEPORT,
                verify_function=lambda x: x > 0.0),
            Setting(name='do_waveport_initialization',
                    type=bool,
                    required=False,
                    default_value=False),
        ]

        ## Channel Properties Definition:
        property_list = [
            # gettable properties
            ChannelSourceDeviceProperty(
                name=received_wavenis_frame_channel_name,
                type=str,
                initial=Sample(timestamp=0, value=''),
                perms_mask=DPROP_PERM_GET,
                options=DPROP_OPT_AUTOTIMESTAMP),
            ChannelSourceDeviceProperty(name='software_version',
                                        type=str,
                                        initial=Sample(
                                            timestamp=digitime.time(),
                                            value=VERSION_NUMBER),
                                        perms_mask=DPROP_PERM_GET,
                                        options=DPROP_OPT_AUTOTIMESTAMP),

            # settable properties
            ChannelSourceDeviceProperty(
                name=wavenis_frame_to_emit_channel_name,
                type=str,
                initial=Sample(timestamp=0, value=''),
                perms_mask=DPROP_PERM_SET,
                options=DPROP_OPT_AUTOTIMESTAMP,
                set_cb=self.request_channel_cb),
        ]

        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core, settings_list,
                            property_list)

        ## Thread initialization:
        self.__stopevent = threading.Event()
        threading.Thread.__init__(self, name=name)
        threading.Thread.setDaemon(self, True)

        # FIXME: variable not used
        self.aoc_rxbuf = ""  # packet data, bytes

        self.waveport_handle = None
        # FIXME: variable not used
        self.request_pkt = None

        # Arm watchdogs
        if (on_digi_board()):
            self.mainloop_made_one_loop = digiwdog.Watchdog(
                MAIN_LOOP_STILL_LOOPING_WATCHOG_DELAY,
                self.get_name() + " main loop no more looping. Force reset")
            self.mainloop_made_a_pause = digiwdog.Watchdog(
                MAIN_LOOP_IS_NOT_INSTANTANEOUS_WATCHDOG_DELAY,
                self.get_name() +
                " main is looping instantaneously. Force reset")
        else:
            self.mainloop_made_one_loop = None
            self.mainloop_made_a_pause = None
Esempio n. 55
0
    def __init__(self, name, core_services, settings=None):
        self.__name = name
        self.__core = core_services

        from core.tracing import get_tracer
        self.__tracer = get_tracer(name)
        
        #Setting table definition
        settings_list = [         
            Setting(
                name = 'channel1_dir', type = str, required = False,
                default_value = 'in'),
            Setting(
                name = 'channel2_dir', type = str, required = False,
                default_value = 'in'),
            Setting(
                name = 'channel3_dir', type = str, required = False,
                default_value = 'in'),
            Setting(
                name = 'channel4_dir', type = str, required = False,
                default_value = 'in'),
            # Setting(
            #     name = 'acc_threshold', type = float, required = False,
            #         default_value = 3.0),
            Setting(
                name = 'sample_rate_ms', type = float, required = False,
                    default_value = 10000.0,
                    verify_function = lambda x: x > 0.0),
        ]             
                                            
        #Channel properties definition, initially all ports are off
        #Can switch on by deploying a prop_set_port function
        #More channels will be added based on channel settings
        property_list = [
            ChannelSourceDeviceProperty(name = "ignition_status", type = bool,
                initial = Sample(timestamp = 0, value = False),
                perms_mask = csdp.DPROP_PERM_GET|csdp.DPROP_PERM_REFRESH,
                options = csdp.DPROP_OPT_AUTOTIMESTAMP,
                refresh_cb = self.refresh_ignition_status),

            # ChannelSourceDeviceProperty(name = "acceleration", type = str,
            #     initial = Sample(timestamp = 0, value = "", unit = 'G'),
            #     perms_mask = csdp.DPROP_PERM_GET|csdp.DPROP_PERM_REFRESH,
            #     options = csdp.DPROP_OPT_AUTOTIMESTAMP,
            #     refresh_cb = self.update_accelerometer_info),

            ChannelSourceDeviceProperty(name = "latitude", type = float,
                initial = Sample(timestamp = 0, value = 0.0), 
                perms_mask = csdp.DPROP_PERM_GET|csdp.DPROP_PERM_REFRESH,
                options = csdp.DPROP_OPT_AUTOTIMESTAMP),
                         
            ChannelSourceDeviceProperty(name = "longitude", type = float,
                initial = Sample(timestamp = 0, value = 0.0), 
                perms_mask = csdp.DPROP_PERM_GET|csdp.DPROP_PERM_REFRESH,
                options = csdp.DPROP_OPT_AUTOTIMESTAMP),
                
            ChannelSourceDeviceProperty(name = "altitude", type = float,
                initial=Sample(timestamp = 0, value = 0.0),
                perms_mask = csdp.DPROP_PERM_GET|csdp.DPROP_PERM_REFRESH,
                options = csdp.DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name = "current_time", type = int,
                initial=Sample(timestamp = 0, value = 0),
                perms_mask = csdp.DPROP_PERM_GET|csdp.DPROP_PERM_REFRESH,
                options = csdp.DPROP_OPT_AUTOTIMESTAMP),
        ]
        
        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core,
                                settings_list, property_list)

        ## Thread initialization:
        self.__stopevent = threading.Event()
        threading.Thread.__init__(self, name=name)
        threading.Thread.setDaemon(self, True)
    def __init__(self, name, core_services):
        
        
        ## Initialize and declare class variables
        self.__name = name
        self.__core = core_services
        self.__cm = self.__core.get_service("channel_manager")
        self.__cp = self.__cm.channel_publisher_get()
        self.__cdb = self.__cm.channel_database_get()
        self._ec_key_to_dia_command_channel_name_cache = {}
        
        self._logger = init_module_logger(name)
        self._subscribed_channels = []
        
        self._ec_access_point_pub_key_setting = None
        self._dia_module_name_to_ec_device_public_key_setting_map = None
        self._sensor_channel_list_to_subscribe_to_setting = None
        self._incoming_command_channel_setting = None
        
        # semaphores and synchronization variables
        self._receive_sensor_data_callback_lock = threading.Lock()
        
        # will be appended to a DIA module name to get the name of the
        # channel to be used to send received commands
        self._sensor_channel_name_where_to_forward_commands = "command"
        
        settings_list = [
            Setting(name='ec_access_point_pub_key', type=str, required=False),
            Setting(name='channels', type=list, required=True, default_value=[]),
            Setting(name='exclude', type=list, required=False, default_value=[]),
            Setting(name='dia_channel_to_ec_sensor', type=dict, required=False, default_value={}),
            Setting(name='dia_module_to_ec_pub_key', type=dict, required=False, default_value={}),
            Setting(name='incoming_command_channel', type=str, required=False, default_value=''),

            Setting(name='log_level', type=str, required=False, default_value='DEBUG', verify_function=check_debug_level_setting),

        ]
        
        # Channel Properties Definition:
        
        property_list = [
                         
            #  properties
            
            ChannelSourceDeviceProperty(name='json_data', type=str,
                initial=Sample(timestamp=digitime.time(), value=""),
                perms_mask= DPROP_PERM_GET,
                options=DPROP_OPT_AUTOTIMESTAMP), 
                         
            ChannelSourceDeviceProperty(name='software_version', type=str,
                initial=Sample(timestamp=digitime.time(), value=VERSION_NUMBER),
                perms_mask= DPROP_PERM_GET,
                options=DPROP_OPT_AUTOTIMESTAMP),                         

        ]        
        
        
        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core,
                                        settings_list, property_list)
        
        self.__stopevent = threading.Event()        
        
        threading.Thread.__init__(self, name=name)
        threading.Thread.setDaemon(self, True)       
Esempio n. 57
0
    def __init__(self, name, core_services):
        self.__name = name
        self.__core = core_services
                
        self.__settings_ctx = \
            core_services.get_service("settings_base").get_context()
    
        from core.tracing import get_tracer
        self.__tracer = get_tracer(name)
    
        ## Settings Table Definition:
        settings_list = [ ]
    
        ## Channel Properties Definition:
        property_list = [
            # gettable and settable settings
            ChannelSourceDeviceProperty(name="format", type=str,
                initial=Sample(timestamp=0, value=''),
                perms_mask=(DPROP_PERM_GET|DPROP_PERM_SET),
                options=DPROP_OPT_AUTOTIMESTAMP,
                set_cb=self.chan_set_format),

            ChannelSourceDeviceProperty(name="binding", type=str,
                initial=Sample(timestamp=0, value=''),
                perms_mask=(DPROP_PERM_GET|DPROP_PERM_SET),
                options=DPROP_OPT_AUTOTIMESTAMP,
                set_cb=self.chan_set_binding),
    
            ChannelSourceDeviceProperty(name="pending_settings", type=str,
                initial=Sample(timestamp=0, value=''),
                perms_mask=(DPROP_PERM_GET|DPROP_PERM_SET),
                options=(DPROP_OPT_AUTOTIMESTAMP|DPROP_OPT_DONOTDUMPDATA),
                set_cb=self.chan_set_pending_settings),
                
            ChannelSourceDeviceProperty(name="filename", type=str,
                initial=Sample(timestamp=0, value=''),
                perms_mask=(DPROP_PERM_GET|DPROP_PERM_SET),
                options=DPROP_OPT_AUTOTIMESTAMP,
                set_cb=self.chan_set_filename),

            # gettable only settings
            ChannelSourceDeviceProperty(name="serializers", type=str,
                initial=Sample(timestamp=0, value=''),
                perms_mask=DPROP_PERM_GET,
                options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="running_settings", type=str,
                initial=Sample(timestamp=0, value=''),
                perms_mask=DPROP_PERM_GET,
                options=(DPROP_OPT_AUTOTIMESTAMP|DPROP_OPT_DONOTDUMPDATA)),
                
            ChannelSourceDeviceProperty(name="application_result", type=str,
                initial=Sample(timestamp=0, value=''),
                perms_mask=DPROP_PERM_GET,
                options=DPROP_OPT_AUTOTIMESTAMP),
                
            # settable only settings
            ChannelSourceDeviceProperty(name="apply", type=str,
                initial=Sample(timestamp=0, value=''),
                perms_mask=DPROP_PERM_SET,
                set_cb=self.chan_set_apply),
                
            ChannelSourceDeviceProperty(name="save_file", type=str,
                initial=Sample(timestamp=0, value=''),
                perms_mask=DPROP_PERM_SET,
                set_cb=self.chan_set_save_file),                   
        ]
                                            
        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core,
                                settings_list, property_list)
Esempio n. 58
0
    def __init__(self, name, core_services):
        self.__name = name
        self.__core = core_services

        from core.tracing import get_tracer
        self.__tracer = get_tracer(name)

        ## Settings Table Definition:
        settings_list = [
            Setting(name='update_rate',
                    type=float,
                    required=False,
                    default_value=1.0,
                    verify_function=lambda x: x > 0.0)
        ]

        property_list = [
            ChannelSourceDeviceProperty(name="uptime",
                                        type=int,
                                        initial=Sample(timestamp=0,
                                                       value=-1,
                                                       unit="sec"),
                                        perms_mask=DPROP_PERM_GET,
                                        options=DPROP_OPT_AUTOTIMESTAMP),
            ChannelSourceDeviceProperty(name="cpu_utilization",
                                        type=int,
                                        initial=Sample(timestamp=0,
                                                       value=0,
                                                       unit="%"),
                                        perms_mask=DPROP_PERM_GET,
                                        options=DPROP_OPT_AUTOTIMESTAMP),
            ChannelSourceDeviceProperty(name="free_memory",
                                        type=int,
                                        initial=Sample(timestamp=0,
                                                       value=-1,
                                                       unit="bytes"),
                                        perms_mask=DPROP_PERM_GET,
                                        options=DPROP_OPT_AUTOTIMESTAMP),
            ChannelSourceDeviceProperty(name="used_memory",
                                        type=int,
                                        initial=Sample(timestamp=0,
                                                       value=-1,
                                                       unit="bytes"),
                                        perms_mask=DPROP_PERM_GET,
                                        options=DPROP_OPT_AUTOTIMESTAMP),
            ChannelSourceDeviceProperty(name="total_memory",
                                        type=int,
                                        initial=Sample(timestamp=0,
                                                       value=-1,
                                                       unit="bytes"),
                                        perms_mask=DPROP_PERM_GET,
                                        options=DPROP_OPT_AUTOTIMESTAMP),
        ]

        ## Initialize the DeviceBase interface:
        DeviceBase.__init__(self, self.__name, self.__core, settings_list,
                            property_list)

        ## Thread initialization:
        self.__stopevent = threading.Event()
        threading.Thread.__init__(self, name=name)
        threading.Thread.setDaemon(self, True)
Esempio n. 59
0
    def __init__(self, name, core_services):
        self.__name = name
        self.__core = core_services

        from core.tracing import get_tracer
        self.__tracer = get_tracer(name)

        ## Settings Table Definition:
        settings_list = [
            Setting(name='serial_device',
                    type=str,
                    required=False,
                    default_value="/gps/0"),
            Setting(name='serial_baud',
                    type=int,
                    required=False,
                    default_value=4800,
                    verify_function=lambda x: x > 0.0),
            Setting(name='sample_rate_sec',
                    type=int,
                    required=False,
                    default_value=60,
                    verify_function=lambda x: x > 0.0),
        ]

        ## Channel Properties Definition:

        # Feel free to create a channel here for any item that the
        # nmea module can extract from a valid sentence.  The
        # property_setter routine will populate correctly.  You may
        # need to extend the sentence templates in nmea.py to teach
        # the library about non position based sentences and types.
        property_list = [
            # gettable properties
            ChannelSourceDeviceProperty(name="fix_time",
                                        type=str,
                                        initial=Sample(timestamp=0, value=""),
                                        perms_mask=DPROP_PERM_GET,
                                        options=DPROP_OPT_AUTOTIMESTAMP),
            ChannelSourceDeviceProperty(name="fix_good",
                                        type=Boolean,
                                        initial=Sample(timestamp=0,
                                                       value=Boolean(False)),
                                        perms_mask=DPROP_PERM_GET,
                                        options=DPROP_OPT_AUTOTIMESTAMP),
            ChannelSourceDeviceProperty(name="latitude_degrees",
                                        type=float,
                                        initial=Sample(timestamp=0, value=0.0),
                                        perms_mask=DPROP_PERM_GET,
                                        options=DPROP_OPT_AUTOTIMESTAMP),
            ChannelSourceDeviceProperty(name="latitude_hemisphere",
                                        type=str,
                                        initial=Sample(timestamp=0, value=""),
                                        perms_mask=DPROP_PERM_GET,
                                        options=DPROP_OPT_AUTOTIMESTAMP),
            ChannelSourceDeviceProperty(name="longitude_degrees",
                                        type=float,
                                        initial=Sample(timestamp=0, value=0.0),
                                        perms_mask=DPROP_PERM_GET,
                                        options=DPROP_OPT_AUTOTIMESTAMP),
            ChannelSourceDeviceProperty(name="longitude_hemisphere",
                                        type=str,
                                        initial=Sample(timestamp=0, value=""),
                                        perms_mask=DPROP_PERM_GET,
                                        options=DPROP_OPT_AUTOTIMESTAMP),
            ChannelSourceDeviceProperty(name="speed_over_ground",
                                        type=float,
                                        initial=Sample(timestamp=0, value=0.0),
                                        perms_mask=DPROP_PERM_GET,
                                        options=DPROP_OPT_AUTOTIMESTAMP),
            ChannelSourceDeviceProperty(name="course_over_ground",
                                        type=float,
                                        initial=Sample(timestamp=0, value=0.0),
                                        perms_mask=DPROP_PERM_GET,
                                        options=DPROP_OPT_AUTOTIMESTAMP),
            ChannelSourceDeviceProperty(name="fix_date",
                                        type=str,
                                        initial=Sample(timestamp=0, value=""),
                                        perms_mask=DPROP_PERM_GET,
                                        options=DPROP_OPT_AUTOTIMESTAMP),
            ChannelSourceDeviceProperty(name="num_satellites",
                                        type=int,
                                        initial=Sample(timestamp=0, value=0),
                                        perms_mask=DPROP_PERM_GET,
                                        options=DPROP_OPT_AUTOTIMESTAMP),
            ChannelSourceDeviceProperty(name="altitude",
                                        type=float,
                                        initial=Sample(timestamp=0, value=0.0),
                                        perms_mask=DPROP_PERM_GET,
                                        options=DPROP_OPT_AUTOTIMESTAMP),
            ChannelSourceDeviceProperty(name="hdop",
                                        type=float,
                                        initial=Sample(timestamp=0, value=0.0),
                                        perms_mask=DPROP_PERM_GET,
                                        options=DPROP_OPT_AUTOTIMESTAMP),
        ]

        ## Initialize the Devicebase interface:
        DeviceBase.__init__(self, self.__name, self.__core, settings_list,
                            property_list)

        ## Thread initialization:
        self.__stopevent = threading.Event()
        threading.Thread.__init__(self, name=name)
        threading.Thread.setDaemon(self, True)
Esempio n. 60
0
    def __init__(self, name, core_services):
        self.__name = name
        self.__core = core_services

        from core.tracing import get_tracer
        self.__tracer = get_tracer(name)

        ## Settings Table Definition:
        settings_list = [
            Setting(
            name='xbee_device_manager', type=str, required=True),
            Setting(
            name='extended_address', type=str, required=True),
            Setting(
            name='update_rate', type=float, required=False, default_value=5.0,
              verify_function=lambda x: x > 0.0),
        ]

        ## Channel Properties Definition:
        property_list = [
            # gettable properties
            ### vehicle parameters
            ChannelSourceDeviceProperty(name="vehicle_speed", type=float,
            initial=Sample(timestamp=0, value=-1.0),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="engine_speed", type=float,
            initial=Sample(timestamp=0, value=-1.0),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="throttle_position", type=float,
            initial=Sample(timestamp=0, value=-1.0),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="odometer", type=float,
            initial=Sample(timestamp=0, value=-1.0),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="fuel_level", type=float,
            initial=Sample(timestamp=0, value=-1.0),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="fuel_level_remaining",
                                        type=float,
            initial=Sample(timestamp=0, value=-1.0),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="transmission_gear", type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="ignition_status", type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="mil_status", type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="airbag_dash_indicator", type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="abs_dash_indicator", type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="fuel_rate", type=float,
            initial=Sample(timestamp=0, value=-1.0),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="battery_voltage", type=float,
            initial=Sample(timestamp=0, value=-1.0),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="pto_status", type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="seatbelt_fastened", type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="misfire_monitor", type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="fuel_system_monitor", type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="comprehensive_component_monitor",
                                        type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="catalyst_monitor", type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="heated_catalyst_monitor",
                                        type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="evaporative_system_monitor",
                                        type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="secondary_air_system_monitor",
                                        type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="ac_system_refrigerant_monitor",
                                        type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="oxygen_sensor_monitor", type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="oxygen_sensor_heater_monitor",
                                        type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="egr_system_monitor", type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="brake_switch_status", type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="cruise_control_status", type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="turn_signal_status", type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="oil_pressure_lamp", type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="coolant_hot_light", type=str,
            initial=Sample(timestamp=0, value="?"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="trip_odometer", type=float,
            initial=Sample(timestamp=0, value=-1.0),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="trip_fuel_consumption",
                                        type=float,
            initial=Sample(timestamp=0, value=-1.0),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ### static vehicle parameters

            ChannelSourceDeviceProperty(name="vin", type=str,
            initial=Sample(timestamp=0, value="not acquired"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="supported_parameters", type=str,
            initial=Sample(timestamp=0, value="not acquired"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="diagnostic_trouble_codes",
                                        type=str,
            initial=Sample(timestamp=0, value="not acquired"),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            ChannelSourceDeviceProperty(name="ready_for_communication",
                                        type=int,
            initial=Sample(timestamp=0, value=0),
            perms_mask=DPROP_PERM_GET, options=DPROP_OPT_AUTOTIMESTAMP),

            # settable properties
            ChannelSourceDeviceProperty(name="force_redetect", type=int,
            perms_mask=DPROP_PERM_SET,
            set_cb=self.prop_set_force_redetect),
        ]

        ## Initialize the Devicebase interface:
        DeviceBase.__init__(self, self.__name, self.__core,
                    settings_list, property_list)

        ## Thread initialization:
        self.__stopevent = threading.Event()
        threading.Thread.__init__(self, name=name)
        threading.Thread.setDaemon(self, True)