Exemple #1
0
    def __init__(self, config, queue_name=None, routing_key=None):
        if not 'ckan.api_key' in config:
            log.warn("No CKAN API key has been specified")

        base_location = self.base_location
        if 'ckan.site_url' in config:
            base_location = urljoin(config.get('ckan.site_url'), "api")

        CkanClient.__init__(self, base_location=base_location,
                            api_key=config.get('ckan.api_key'))
        Consumer.__init__(self, config, 
                          queue_name=queue_name,
                          routing_key=routing_key)
Exemple #2
0
 def __init__(self, opc):
     ConfigOp.__init__(self, 'mqtt', CONFIG_NAME)
     Consumer.__init__(self)
     self.add_command(self.__get_info, GET)
     self.__client = None
     self.__pub_queue = queue.Queue(10)
     self.__connected = False
     self.__last_ping_tm = 0
     self.__valid_config = False
     self.__with_auth = False
     self.__opc = opc
     self.__topic = set()
     self.__sub_cb = None
     self.add_command(self.__reconnect, SET, 'reconnect')
Exemple #3
0
 def __init__(self, opc, name="ybb", rxbuf=1024):
     Consumer.__init__(self)
     self._ble = BLE()
     self._ble.active(True)
     self._ble.irq(self._irq)
     self._ble.config(gap_name = name[:16])
     ((self._tx_handle, self._rx_handle),) = self._ble.gatts_register_services((_UART_SERVICE,))
     # Increase the size of the rx buffer and enable append mode.
     self._ble.gatts_set_buffer(self._rx_handle, rxbuf, True)
     self._connections = {}
     self._rx_buffer = bytearray()
     self._opc = opc
     # Optionally add services=[_UART_UUID], but this is likely to make the payload too large.
     self._payload = advertising_payload(name=name[:16], appearance=_ADV_APPEARANCE_GENERIC_COMPUTER)
     self._advertise()
Exemple #4
0
    def __init__(self, config, queue_name=None, routing_key=None):
        if not 'ckan.api_key' in config:
            log.warn("No CKAN API key has been specified")

        base_location = self.base_location
        if 'ckan.site_url' in config:
            base_location = urljoin(config.get('ckan.site_url'), "api")

        CkanClient.__init__(self,
                            base_location=base_location,
                            api_key=config.get('ckan.api_key'))
        Consumer.__init__(self,
                          config,
                          queue_name=queue_name,
                          routing_key=routing_key)
Exemple #5
0
 def __init__(self,nickname,email,phone,name,eid):
     Consumer.__init__(self,nickname,email,phone,name,eid)
     self.posts = []