예제 #1
0
    def init_module_logger(self):

        # TODO: switch to std logging with config file / http://g-polarion-pangoov4/polarion/redirect/project/PANGOO_PF_DEV/workitem?id=PF-91
        # ... logging.config.fileConfig(logging_config_file)

        # logging setup
        if (on_digi_board()):
            logging_file_prefix = 'WEB/python/'
        else:
            logging_file_prefix = ''

        self.logger = logging.getLogger("XBWP_dd")
        fmt = logging.Formatter(
            "%(asctime)s\t%(name)s\t%(levelname)s\t%(message)s",
            "%Y-%m-%d %H:%M:%S")
        handler = logging.StreamHandler(sys.stderr)
        handler.setFormatter(fmt)
        self.logger.addHandler(handler)

        handler = logutils.SmartHandler(filename=logging_file_prefix +
                                        'log_XBWP_dd.txt',
                                        buffer_size=50,
                                        flush_level=logging.INFO,
                                        flush_window=0)
        handler.setFormatter(fmt)
        self.logger.addHandler(handler)
예제 #2
0
def init_module_logger(logger_name,
                       max_backups=1,
                       max_bytes=512 * 2 * 32,
                       buffer_size=200,
                       flush_level=logging.INFO,
                       flush_window=0):

    # TODO: switch to std logging with config file / http://g-polarion-pangoov4/polarion/redirect/project/PANGOO_PF_DEV/workitem?id=PF-91
    # ... logging.config.fileConfig(logging_config_file)

    # logging setup
    if on_digi_board():
        logging_file_prefix = 'WEB/python/'
    else:
        logging_file_prefix = ''

    logger = logging.getLogger(logger_name)
    fmt = logging.Formatter(
        "%(asctime)s\t%(name)s\t%(levelname)s\t%(message)s",
        "%Y-%m-%d %H:%M:%S")
    handler = logging.StreamHandler(sys.stderr)
    handler.setFormatter(fmt)
    logger.addHandler(handler)

    handler = logutils.SmartHandler(filename=logging_file_prefix + 'log_' +
                                    logger_name + '.txt',
                                    max_backups=max_backups,
                                    max_bytes=max_bytes,
                                    buffer_size=buffer_size,
                                    flush_level=flush_level,
                                    flush_window=flush_window)
    handler.setFormatter(fmt)
    logger.addHandler(handler)

    return logger
예제 #3
0
 def msec_str(self):
     """ return a millisecond time stamp we can use in tracing """
     if (on_digi_board()):
         t = time.clock()
     else:
         t = time.time()
     ms = (int(t * 1000) % 1000)
     return "%03d: " % ms
예제 #4
0
 def init_hardware_board_system_config(self):
     """ Change system board configuration that depends on current runtime configuration"""        
     if (on_digi_board()):
         # Arm watchdogs
         self.mainloop_made_one_loop = digiwdog.Watchdog(MAIN_LOOP_STILL_LOOPING_WATCHOG_DELAY, "Orbcomm Presentation main loop no more looping. Force reset")
         self.mainloop_made_a_pause = digiwdog.Watchdog(MAIN_LOOP_IS_NOT_INSTANTANEOUS_WATCHDOG_DELAY, "Orbcomm Presentation main loop no more looping. Force reset")
     else:
         self.logger.error('No board system configuration necessary')
예제 #5
0
    def retreive_phone_number_from_sim(self, max_tries=1, retry_delay=2):
        '''Executed a CLI command to get the phone number the Digi board retrieved from the SIM card
        Return a string containing the phone number if found
        Else return None'''

        display_mobile_cli_command = 'display mobile'
        phone_number_line_start_string = 'Phone Number'

        if (on_digi_board()):

            done_tries = 0

            while (done_tries < max_tries):
                self.logger.info('Executing CLI command: %s' %
                                 display_mobile_cli_command)
                cli_command_ok, cli_command_output_list = digicli.digicli(
                    display_mobile_cli_command)

                if (not cli_command_ok):
                    self.logger.error("CLI command and error: %s" %
                                      cli_command_output_list)
                    return None

                # search for phone number
                for line in cli_command_output_list:
                    self.logger.debug('Test line for phone number: %s' % line)
                    # remove leading spaces
                    lineStrippedContent = line.lstrip()
                    if (lineStrippedContent.startswith(
                            phone_number_line_start_string)):
                        self.logger.debug('Found phone number line: %s' % line)
                        # retrieve fields separated by ':'
                        line_fields = lineStrippedContent.split(':')
                        phoneField = line_fields[1]
                        # remove leading a training spaces
                        phone_number = phoneField.strip()

                        if (phone_number != 'N/A'):
                            self.logger.info(
                                'Found mobile phone number: "%s"' %
                                phone_number)
                            return (phone_number)
                        else:
                            self.logger.info(
                                'Mobile phone number not yet available')

                # Did not find the phone number
                done_tries += 1
                time.sleep(retry_delay)

            # After all tries, could not retrieve the phone number
            self.logger.error('Could not get mobile phone number')
            return None
        else:
            self.logger.error('No board system configuration necessary')
            return None
예제 #6
0
    def ms_tstamp(self):
        ''' millisecond timestamp suitable for logging '''

        if (on_digi_board()):
            # digi returns only 1 second granularity on time.time()
            t = time.clock()
        else:
            t = time.time()
        ms = (int(t * 1000) % 1000)
        sec = (int(t) % 60)
        min = (int(t / 60.0) % 60)
        return "%02d:%02d:%03d " % (min, sec, ms)
예제 #7
0
 def start(self):
     """Start the device driver.  Registers callback for SMS messages.  Returns bool."""
     if (on_digi_board()):
         self.cb_handle = digisms.Callback(self.receiveSMS)
         if self.cb_handle == None:
             self.logger.error('SMS callback not handled')
             return False
         else:
             self.logger.info('SMS callback hooked up %s' % self.cb_handle)
     else:
         self.logger.info ('SMS drv: not on a digi board -> cannot register SMS handler')
  
     return True
    def __do_blink(self):

        blinks = SettingsBase.get_setting(self, "blinks")
        blink_speed = SettingsBase.get_setting(self, "blink_speed")

        self.__logger.debug("Start blinking")
        for _ in range(1, blinks):
            # Turn on user LED's
            self.__logger.info("Led ON")
            if on_digi_board():
                digihw.user_led_set(1, 1)
            digitime.sleep(blink_speed)

            # Turn off the LED's
            self.__logger.info("Led OFF")
            if on_digi_board():
                digihw.user_led_set(0, 1)
            digitime.sleep(blink_speed)

        self.__logger.debug("End blinking")
        # Turn off to prevent any strange behavior
        self.__logger.info("Force led OFF")
        if on_digi_board():
            digihw.user_led_set(0, 1)

        cli_command = SettingsBase.get_setting(self, "cli_command")
        self.__logger.info("Issue the command: %s" % cli_command)
        if (on_digi_board() and len(cli_command) > 0):
            self.__logger.debug('Calling digicli...')
            status, output = digicli.digicli(cli_command)
            if status:
                for line in output:
                    self.__logger.info('Command result: %s' % line)
            else:
                self.__logger.error('Error while executing command: %d, %s' %
                                    (status, output))
예제 #9
0
 def process_gateway_command_pkt(self, gw_command):
     
     GET_VERSION_COMMAND = '\x56'
     CLI_COMMAND_PREFIX = '#cli '
     
     response_str = 'INVALID'
     
     if (gw_command == GET_VERSION_COMMAND):
         self.logger.debug ('Received the GET_VERSION gateway command.')
         response_str = GET_VERSION_COMMAND + VERSION_NUMBER
         
     elif (gw_command.startswith(CLI_COMMAND_PREFIX)):
         self.logger.debug ('Received a CLI gateway command: %s' % gw_command)
         if (on_digi_board()):
             cli_command = gw_command.strip(CLI_COMMAND_PREFIX)
             cli_command_ok, cli_command_output = digicli.digicli(cli_command)
             cli_command_output_str = str(cli_command_output)
             if (not cli_command_ok):
                 self.logger.error ("CLI command \"%s\" return and error: %s" % (cli_command, cli_command_output_str))
             response_str = CLI_COMMAND_PREFIX + cli_command_output_str
             
         else:
             response_str = "CLI command not supported on this platform"
         
     else:
         self.logger.error('Invalid gateway command: %s' % ''.join('%02X ' % ord(x) for x in gw_command))
         response_str = 'unimplemented gateway command'
         
     self.logger.debug ('Command answer is: ' + response_str)
     
     command_answer = '\xFF' + response_str
     
     command_answer_max_len = 255
     sz = len(command_answer)
     if (sz >= command_answer_max_len):
         # invalid answer size
         self.logger.critical('Gateway command answer exceeds max len (strip response): %s' % ''.join('%02X ' % ord(x) for x in command_answer))
         command_answer = command_answer[:command_answer_max_len - 1]
         sz = command_answer_max_len - 1
         
     answer_pkt_len = chr (sz + 1)
     answer_pkt = answer_pkt_len + command_answer
     
     return (answer_pkt)
예제 #10
0
    def init_hardware_board_system_config(self):
        """ Change system board configuration that depends on current runtime configuration
        Form example, borad name depends on SIM card number"""

        if (on_digi_board()):

            # set DynDNS configuration
            try:

                # gateway_id is supposed to be set (mandatory Setting) and should be a phone number "+33..."
                if (self.gateway_id[0] == '+'):
                    # If the ID starts with '+' as expected, remove the '+' to build the hostname
                    ddhostname = DYNDNS_HOSTNAME_PATTERN % self.gateway_id[1:]
                else:
                    ddhostname = DYNDNS_HOSTNAME_PATTERN % self.gateway_id

                ddns_cli_command_arg='ddsystem=dyndns ' + \
                    'ddusername=%s '%DYNDNS_USERNAME + \
                    'ddpassword=%s '%DYNDNS_PASSWORD + \
                    'ddhostname=%s '%ddhostname + \
                    'service=dyndnsorg'

                cli_command = 'set ddns ' + ddns_cli_command_arg
                self.logger.debug(
                    'Board system config will execute CLI command: %s' %
                    cli_command)

                digicli.digicli(cli_command)

                # Arm watchdogs
                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")

            except Exception, msg:
                self.logger.error(
                    'Board system config: Error during DynDNs config setup. Error was: %s'
                    % msg)
예제 #11
0
    def start(self):

        self._logger.info('Start')

        while 1:

            interface = SettingsBase.get_setting(self, 'interface')

            if self.__stopevent.isSet():
                self.__stopevent.clear()
                break
            if on_digi_board() and (not SettingsBase.get_setting(
                    self, "no_digicli")):
                current_ip_address = self._get_ip_address_with_digicli()
            else:
                current_ip_address = self._get_ip_address_with_socket()
            if current_ip_address:
                # we got a valid address
                if current_ip_address != self._published_ip_address:
                    # address has changed => update it
                    self._logger.debug('Got new IP address for interface: %s' %
                                       interface)
                    if self._update_dtdns():
                        self._published_ip_address = current_ip_address
                else:
                    self._logger.debug('IP address unchanged')
                # wait and check for new address change
                digitime.sleep(
                    SettingsBase.get_setting(self, 'address_update_rate'))
            else:
                self._logger.debug('No valid IP address for interface: %s' %
                                   interface)
                # wait and check for new address availability
                digitime.sleep(
                    SettingsBase.get_setting(self,
                                             'check_for_valid_address_rate'))

        self._logger.info('Terminating')
        return True
예제 #12
0
    def _send_frame_to_xbee_address(self, xbee_address, frame):
        self.logger.info('Request to send to xbee device "%s" command: %s' %
                         (xbee_address, ''.join('\\x%02X ' % ord(x)
                                                for x in frame)))

        if on_digi_board():

            try:
                # Create the socket, datagram mode, proprietary transport:
                sd = socket(AF_ZIGBEE, SOCK_DGRAM, ZBS_PROT_TRANSPORT)

                # Bind to endpoint 0xe8 (232):
                sd.bind(("", 0xe8, 0, 0))

                destination = (xbee_address, 0xe8, 0xc105, 0x11)
                sd.sendto(frame, 0, destination)

                # close socket now
                sd.close()

            except Exception, msg:
                self.logger.fatal("Exception during xbee communication: %s" %
                                  msg)
예제 #13
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
예제 #14
0
from custom_lib.runtimeutils import on_digi_board, \
    get_time_seconds_since_epoch

from serial import serialutil
import serial

import time
import threading
import Queue
import struct
import logging

import sys
import traceback

if on_digi_board():
    # import Digi board specific libraries
    import digiwdog  #@UnresolvedImport

from custom_lib import logutils

#--- Pangoo common definitions
from custom_lib.commons.pangoolib import *

from devices.device_base import DeviceBase
from settings.settings_base import SettingsBase, Setting
from channels.channel_source_device_property import *

from custom_lib.commons import PANGOO_STRING_SAMPLE_FOR_DD_ERROR

# constants
예제 #15
0
    def __init__(self, name, core_services):
        """Performs startup initializations.  It verifies and loads the settings list."""
        self.__name = name
        self.__core = core_services
        self.destinations = []
        self.request_channel_to_wp0_dd = None
        self.xbeerawout_channel = None

        self.waiting_for_reply = False
        self.gateway_v1_backward_compatibility = False

        self.radio_responses_queue = Queue.Queue(8)
        self.pangoo_request_queue = Queue.Queue(8)

        self.logger = init_module_logger(name)

        settings_list = [
            Setting(name='destinations',
                    type=list,
                    required=False,
                    default_value=[{
                        'value': 0,
                        'device_driver_name': 'waveport'
                    }]),
            Setting(name='xbeerawout_interface',
                    type=list,
                    required=False,
                    default_value=[{
                        'device_driver_name': 'rawxbeeout'
                    }]),
            Setting(name='gateway_v1_backward_compatibility',
                    type=bool,
                    required=False,
                    default_value=False),
            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="pangoo_ascii_request",
                                        type=str,
                                        initial=Sample(timestamp=0, value=""),
                                        perms_mask=DPROP_PERM_SET,
                                        options=DPROP_OPT_AUTOTIMESTAMP,
                                        set_cb=self.pangoo_ascii_request_cb),
            ChannelSourceDeviceProperty(name="pangoo_bin_request",
                                        type=str,
                                        initial=Sample(timestamp=0, value=""),
                                        perms_mask=DPROP_PERM_SET,
                                        options=DPROP_OPT_AUTOTIMESTAMP,
                                        set_cb=self.pangoo_bin_request_cb),
            ChannelSourceDeviceProperty(name="pangoo_response",
                                        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),
        ]

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

        # 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

        ## Thread initialization:
        self.__stopevent = threading.Event()
        threading.Thread.__init__(self, name=name)
        threading.Thread.setDaemon(self, True)
예제 #16
0
    def process_gateway_command_pkt(self, gw_command):

        GET_AO_SERVER_IP_ADDRESS = '\x09'
        GET_AO_SERVER_IP_PORT = '\x0A'
        CLI_COMMAND_PREFIX = '#cli '
        ERROR_BYTE_PREFIX = '\x00'

        response_str = 'INVALID'

        if (gw_command == PG_CMD_GET_VERSION):
            self.logger.debug('Received the GET_VERSION gateway command.')
            all_dia_module_software_version = self.get_software_versions()
            response_str = PG_CMD_GET_VERSION + all_dia_module_software_version

        elif (gw_command == GET_AO_SERVER_IP_ADDRESS):
            self.logger.error(
                'Received the AO_SERVER_IP_ADDRESS gateway command.No more implemented.'
            )
            response_str = GET_AO_SERVER_IP_ADDRESS + 'No more implemented: AO server address'

        elif (gw_command == GET_AO_SERVER_IP_PORT):
            self.logger.error(
                'Received the AO_SERVER_IP_PORT gateway command. No more implemented.'
            )
            response_str = GET_AO_SERVER_IP_PORT + 'No more implemented: AO server port'

        elif (gw_command.startswith(CLI_COMMAND_PREFIX)):
            self.logger.debug('Received a CLI gateway command: %s' %
                              gw_command)
            if (on_digi_board()):
                cli_command = gw_command.strip(CLI_COMMAND_PREFIX)
                cli_command_ok, cli_command_output = digicli.digicli(
                    cli_command)
                cli_command_output_str = str(cli_command_output)
                if (not cli_command_ok):
                    self.logger.error(
                        "CLI command \"%s\" return and error: %s" %
                        (cli_command, cli_command_output_str))
                response_str = CLI_COMMAND_PREFIX + cli_command_output_str

            else:
                # FIXME: how to return an error in this case.
                response_str = ERROR_BYTE_PREFIX + "CLI command not supported on this platform"

        else:
            self.logger.error('Invalid gateway command: %s' %
                              ''.join('%02X ' % ord(x) for x in gw_command))
            response_str = ERROR_BYTE_PREFIX + 'unimplemented gateway command'

        self.logger.debug('Command answer is: ' + response_str)

        command_answer = '\xFF' + response_str

        command_answer_max_len = 255
        sz = len(command_answer)
        if (sz >= command_answer_max_len):
            # invalid answer size
            self.logger.critical(
                'Gateway command answer exceeds max len (strip response): %s' %
                ''.join('%02X ' % ord(x) for x in command_answer))
            command_answer = command_answer[:command_answer_max_len - 1]
            sz = command_answer_max_len - 1

        answer_pkt_len = chr(sz + 1)
        answer_pkt = answer_pkt_len + command_answer

        return (answer_pkt)
예제 #17
0
    def __init__(self, name, core_services):
        self.__name = name
        self.__core = core_services
        self.radio_requests_from_presentation_queue = Queue.Queue(8)
        self.radio_message_from_waveport_queue = Queue.Queue(1024)

        self.init_module_logger()

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

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

            # settable properties
            ChannelSourceDeviceProperty(name="request",
                                        type=str,
                                        initial=Sample(timestamp=0,
                                                       value="streq"),
                                        perms_mask=DPROP_PERM_GET
                                        | DPROP_PERM_SET,
                                        options=DPROP_OPT_AUTOTIMESTAMP,
                                        set_cb=self.request_channel_cb),
        ]

        ## Local State Variables:
        self.__xbee_manager = None

        ## Initialize the XBeeSerial interface:
        self.logger.debug("Initialize XBeeSerial")
        XBeeSerial.__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)

        # Arm watchdogs
        if (on_digi_board()):
            self.mainloop_made_one_loop = digiwdog.Watchdog(
                MAIN_LOOP_STILL_LOOPING_WATCHOG_DELAY,
                "AO Presentation main loop no more looping. Force reset")
            self.mainloop_made_a_pause = digiwdog.Watchdog(
                MAIN_LOOP_IS_NOT_INSTANTANEOUS_WATCHDOG_DELAY,
                "AO Presentation main loop no more looping. Force reset")
        else:
            self.mainloop_made_one_loop = None
            self.mainloop_made_a_pause = None
예제 #18
0
#!/usr/bin/python
# $Id: smsHandler.py 7436 2012-01-09 15:49:39Z orba6563 $
"""This driver waits for an SMS and processes the message"""

from custom_lib.runtimeutils import on_digi_board

import logging
import sys

if (on_digi_board()):
    import digisms #@UnresolvedImport
    import digicli #@UnresolvedImport
from devices.device_base import DeviceBase
from settings.settings_base import SettingsBase, Setting
from channels.channel_source_device_property import *

from custom_lib import logutils

class SMSHandler(DeviceBase):

    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(