Example #1
0
__email__ = "*****@*****.**"

import sys
import signal

# sys.path.append('./genericsensor/')
# sys.path.append('./norsutils/')
# sys.path.append('../../')

from genericsensor.genericsensor import Nors_GenericSensor

from grovepi import *

from norsutils.logmsgs.logger import Logger

logger = Logger('debug')
logger.log("SENSOR - DHT Humidity and Temperature", 'info')

class RealSensor(Nors_GenericSensor):
    def __init__(self):
        
        self.sensor_name = 'DHT'
        
        super(RealSensor, self).__init__(
                                         gs_name = self.sensor_name,
                                         gs_id = '1e693dee-e0b6-11e5-8f44-001dbaefa596',
                                         gs_description = 'DHT Humidity and Temperature', 
                                         gs_interface = None,
                                         gs_pull_interval = 5, 
                                         gs_read_interval = 4)
Example #2
0
import sys
import signal
from random import randint

# sys.path.append('./genericsensor/')
# sys.path.append('./norsutils/')
# sys.path.append('../../')

from genericsensor.genericsensor import Nors_GenericSensor

from grovepi import *

from norsutils.logmsgs.logger import Logger

logger = Logger('debug')
logger.log("SENSOR - Dummy (fake) sensor", 'info')

class RealSensor(Nors_GenericSensor):
    def __init__(self):

        self.meanvalue = 0
        self.sensor_name = 'DUMMY'
        
        super(RealSensor, self).__init__(
                                         gs_name = self.sensor_name,
                                         gs_id = '48897fe8-4917-11e6-b789-b827ebc6c8e4',
                                         gs_description = 'Dummy (fake) sensor', 
                                         gs_interface = None,
                                         gs_pull_interval = 5, 
                                         gs_read_interval = 4)
Example #3
0
"""

__author__ = "Daniel Mazzer"
__copyright__ = "Copyright 2016, NORS project"
__credits__ = ""
__license__ = "MIT"
__maintainer__ = "Daniel Mazzer"
__email__ = "*****@*****.**"

from configparser import ConfigParser
from configparser import RawConfigParser
from optparse import OptionParser
from norsutils.logmsgs.logger import Logger

logger = Logger('info')

parser = OptionParser(usage="%prog: [options]")
parser.add_option("-c", "--config-filename", action="store", type="string", dest="config_filename", help="load configuration file")
(options, args) = parser.parse_args()
if(str(options.config_filename) == "None"):
    logger.log("ERROR: config-filename cannot be empty", 'error')
    quit()

class Nors_Configuration:
    def __init__(self, filename=None):
        
        logger.log("Configuration - Started", 'debug')

        if filename is None:
            self.config_filename = options.config_filename
Example #4
0
File: nors.py Project: dmazzer/nors
from sensorservice.sensorservice import Nors_SensorService
from localstorage.localstorage import Nors_LocalStorage
from client.client import Nors_Client
from config.config import Nors_Configuration
from norsutils.logmsgs.logger import Logger

from sensors import sensor_dht
from sensors import sensor_bmp180
from sensors import sensor_dummy

import signal
from uuid import uuid1


logger = Logger('debug')

def load_configuration():
    config = Nors_Configuration()
    server_ip = config.ReadConfig('server', 'ip')
    server_port = config.ReadConfig('server', 'port')
    
    client_auth = config.ReadConfig('client', 'auth')
    client_id = config.ReadConfig('client', 'id')
    
    # The following code generate de client_id if its does not exist
    # in config file.  
    if client_id == None:
        client_id = str(uuid1())
        logger.log('Generating UUID: ' + client_id, level='info')
        config.SaveConfig('client', 'id', client_id)
Example #5
0
config.py: Program Configuration Manager 

"""

__author__ = "Daniel Mazzer"
__copyright__ = "Copyright 2016, NORS project"
__credits__ = ""
__license__ = "MIT"
__maintainer__ = "Daniel Mazzer"
__email__ = "*****@*****.**"

import ConfigParser
from optparse import OptionParser
from norsutils.logmsgs.logger import Logger

logger = Logger('info')

parser = OptionParser(usage="%prog: [options]")
parser.add_option("-c", "--config-filename", action="store", type="string", dest="config_filename", help="load configuration file")
(options, args) = parser.parse_args()
if(str(options.config_filename) == "None"):
    logger.log("ERROR: config-filename cannot be empty", 'error')
    quit()

class Nors_Configuration:
    def __init__(self, filename=None):
        
        logger.log("Configuration - Started", 'debug')

        if filename is None:
            self.config_filename = options.config_filename
Example #6
0
__email__ = "*****@*****.**"

    # TODO: 
    # Conectar no DB local
    # Autenticar (registrar) no servidor
    # coletar dado do db local e enviar para o servidor
    # receber notificacao do servidor

from threading import Thread
import Queue
import time
import sys

# sys.path.append('../')
from norsutils.logmsgs.logger import Logger
logger = Logger('debug')

from connect import Nors_Connect

sys.path.append('../')
sys.path.append('../../')
from models.remote import Remote
from models.stream import Stream

logger.log("NORS Client started", 'debug')

class Nors_Client():
    def __init__(self, config, local_storage, autoinit_check_for_local_data=True):
        
        logger.log('Client/Remote started', 'debug')