def __init__(self, host, port): CoAP.__init__(self, (host, port)) path_1 = 'basic/' self.add_resource(path_1, BasicResource()) path_2 = 'temperature/' self.add_resource(path_2, BasicResource()) path_3 = 'brightness/' self.add_resource(path_3, BasicResource())
def __init__(self, host, port): CoAP.__init__(self, (host, port)) self.add_resource('pir_sensor/', Exam_Resource2.PIR_sensor(coap_server=self)) self.add_resource('buzzer/', Exam_Resource2.Buzzer(coap_server=self)) self.add_resource('th_sensor/', Exam_Resource2.TH_sensor(coap_server=self)) self.add_resource('led/', Exam_Resource2.LED(coap_server=self))
def __init__(self, host, port): CoAP.__init__(self, (host, port)) self.add_resource('HelloWorld/', HelloWorld()) self.add_resource('InitialImageSet/', InitialImageSet()) self.add_resource('SetMode/', SetMode()) self.add_resource('TheftDetectionSystem/',BeginTDS())
def __init__(self, host, port): CoAP.__init__(self, (host, port)) all_resources = AvailableResources().get_all() # quantidade de recursos por nodo quantity = random.randint(0, len(all_resources)) # lista com id dos recursos ids = random.sample(range(0, quantity), quantity) for id in ids: if id == 0: self.add_resource('/sensor-light', LightResource()) # 0 elif id == 1: self.add_resource('/sensor-presence', PresenceResource()) # 1 elif id == 2: self.add_resource('/cam-front', CamResource()) # 2 elif id == 3: self.add_resource('/cam-back', CamResource()) # 3 elif id == 4: self.add_resource('cam-right', CamResource()) # 2 elif id == 5: self.add_resource('cam-left', CamResource()) # 3 print 'CoAP Server start on ' + host + ':' + str(port) print self.root.dump()
def __init__(self, host, port): CoAP.__init__(self, (host, port)) self.add_resource('b/', BasicResource()) self.add_resource('config/', BasicResource()) self.add_resource('cj/', BasicResource()) self.add_resource('fw/', BasicResource()) self.add_resource('fv/', BasicResource())
def __init__(self, host, port): CoAP.__init__(self, (host, port)) global threshRes threshRes = ThresholdResource() self.add_resource( 'threshold/', threshRes) # Adds /threshold resource to the CoAP Server
def __init__(self, host, port, multicast=False, starting_mid=None): CoAP.__init__(self, (host, port), multicast, starting_mid) # create logger logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) # create console handler and set level to debug ch = logging.StreamHandler() ch.setLevel(logging.DEBUG) # create formatter formatter = logging.Formatter( '%(asctime)s - %(name)s - %(levelname)s - %(message)s') # add formatter to ch ch.setFormatter(formatter) # add ch to logger logger.addHandler(ch) self.add_resource('test/', TestResource()) self.add_resource('separate/', SeparateResource()) self.add_resource('seg1/', TestResource()) self.add_resource('seg1/seg2/', TestResource()) self.add_resource('seg1/seg2/seg3/', TestResource()) self.add_resource('query/', TestResource()) self.add_resource("obs/", ObservableResource(coap_server=self)) self.add_resource("large/", LargeResource(coap_server=self)) self.add_resource("large-update/", LargeUpdateResource(coap_server=self)) self.add_resource('long/', LongResource())
def __init__(self, host, port): CoAP.__init__(self, (host, port), multicast=True) threading.Thread.__init__(self) self.add_resource('.well-known/core/', WKResource.WKResource()) self.add_resource('rd/', RDResource.RDResource()) self.add_resource('rd-lookup/ep/', LookupResource.LookupResource("endpoints")) self.add_resource('rd-lookup/res/', LookupResource.LookupResource("resources"))
def __init__(self, ipAddr="localhost", port=5683, multicast=False): CoAP.__init__(self, (ipAddr, port), multicast) self.port = 5683 self.ipAddr = ipAddr self.useMulticast = multicast self.initResources()
def __init__(self, server_id, name): self.id = server_id self.name = name self.coapaddress = settings.COAP_ADDR self.coapport = settings.COAP_PORT self.multicast = settings.COAP_MULTICAST self.proxyaddress = settings.PROXY_ADDR self.proxyport = settings.PROXY_PORT self.timeout = settings.HOME_SERVER_TIMEOUT logger.info("Starting CoAP Server...") CoAP.__init__(self, (self.coapaddress, self.coapport), self.multicast) self.info = HomeServerInfo(self) self.devices = DevicesList(self) self.id_gen = IDGenerator(self) self.services = HomeServerServices(self) self.configs = HomeServerConfigs(self) logger.info("CoAP Server start on " + self.coapaddress + ":" + str(self.coapport)) logger.info(self.root.dump())
def __init__(self, host, port, multicast=False, starting_mid=None): CoAP.__init__(self, (host, port), multicast, starting_mid) # create logger logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) # create console handler and set level to debug ch = logging.StreamHandler() ch.setLevel(logging.DEBUG) # create formatter formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') # add formatter to ch ch.setFormatter(formatter) # add ch to logger logger.addHandler(ch) self.add_resource('test/', TestResource()) self.add_resource('separate/', SeparateResource()) self.add_resource('seg1/', TestResource()) self.add_resource('seg1/seg2/', TestResource()) self.add_resource('seg1/seg2/seg3/', TestResource()) self.add_resource('query/', TestResource()) self.add_resource("obs/", ObservableResource(coap_server=self)) self.add_resource("large/", LargeResource(coap_server=self)) self.add_resource("large-update/", LargeUpdateResource(coap_server=self)) self.add_resource('long/', LongResource())
def __init__(self, host, port, config): ''' Constructor ''' CoAP.__init__(self, (host, port)) self.add_resource( "temperature/", TempResourceHandler(config=config) ) #Add Temperature resource while initializing server
def __init__(self, host, port, multicast=False): CoAP.__init__(self, (host, port), multicast) self.add_resource('basic/', BasicResource()) self.add_resource('long/', Long()) self.add_resource('xml/', XMLResource()) print(("CoAP Server start on " + host + ":" + str(port))) print((self.root.dump()))
def __init__(self): self.SERVER = "192.168.0.3" # Access IP address self.PORT = 5683 # Access port # Bind IP and port to the CoAP server CoAP.__init__(self, (self.SERVER, self.PORT)) # Declare the available resources and their indexes self.add_resource("index/", COAPResource()) print("Server listening on %s:%d" % (self.SERVER, self.PORT))
def __init__(self, host, port): CoAP.__init__(self, (host, port)) #clientMongo = MongoClient('mongodb://localhost:27017') #self.database = clientMongo.aquaponey self.add_resource('waterLevelSensor/', WaterLevelRest()) #self.add_resource( 'waterLevelSensor/', PowerManagment( element, 'waterLevelSensor_1')) self.add_resource('basic/', BasicResource())
def __init__(self, host, port): CoAP.__init__(self, (host, port)) self.add_resource('auth/', AuthenticationResource()) self.add_resource('login/', LoginBasicResource()) self.add_resource('basic/', BasicResource()) self.add_resource('register/', RegisterResource()) self.add_resource('sala/teste', TesteResource()) self.add_resource('jardim/teste', TesteResource())
def __init__(self, host, port): CoAP.__init__(self, (host, port)) self.add_resource("resources/", Resources()) self.add_resource("living_room/", LivingRoomResources()) self.add_resource("kitchen/", KitchenResources()) self.add_resource("bedroom/", BedroomResources()) self.add_resource("utility_room/", UtilityRoomResources()) self.add_resource("bathroom/", BathroomResources()) self.add_resource("outside/", OutsideResources())
def __init__(self, host, port, multicast=False): CoAP.__init__(self, (host, port), multicast) self.add_resource('direction/', Direction()) self.add_resource('accident/', AccidentOccurence()) self.add_resource('suddenbreakes/', SuddenBreakes()) self.add_resource('location/', Location()) print "CoAP Server start on " + host + ":" + str(port) print self.root.dump()
def __init__(self, host, port): CoAP.__init__(self, (host, port)) try: if(MONGO): self.add_resource('/temp', MongoResource()) else: self.add_resource('/temp', BasicResource()) except NameError: self.add_resource('/temp', MongoResource())
def __init__(self, host, port, multicast=False): CoAP.__init__(self, (host, port), multicast) self.add_resource('request/', RequestOfferResource()) self.add_resource('task/', RunTaskResource()) self.add_resource('kill/', KillTaskResource()) self.add_resource('ping/', PingResource()) print("CoAP Server start on " + host + ":" + str(port)) print(self.root.dump())
def __init__(self, host, port, config_file, config_cloud): CoAP.__init__(self, (host, port)) self.config_file = config_file self.config_cloud = config_cloud self.add_resource( 'shadow', AdvancedResource("DataBridge", None, config_file, config_cloud))
def __init__(self, host, port, multicast=False): CoAP.__init__(self, (host, port), multicast) self.add_resource('display_res/', DisplayResource()) self.add_resource('green_led_res/', GreenLEDResource()) self.add_resource('blue_led_res/', BlueLEDResource()) #for i in range(1): # self.add_resource('basic_' + str(i) + '/', BasicResource()) print "CoAP Server start on " + host + ":" + str(port) print self.root.dump()
def __init__(self): self.path = "" self.config = ConfigUtil( '../../../config/ConnectedDevicesConfig.props') self.host = self.config.getProperty(ConfigConst.COAP_DEVICE_SECTION, ConfigConst.HOST_KEY) self.port = int( self.config.getProperty(ConfigConst.COAP_DEVICE_SECTION, ConfigConst.PORT_KEY)) CoAP.__init__(self, (self.host, self.port))
def __init__(self, host, port, multicast=False): CoAP.__init__(self, (host, port), multicast) '''Adding resources to the server along with the HTTP endpoints for the resource ''' self.add_resource('electricitymeters/', ElectricityResource()) self.add_resource('watermeters/', WaterResource()) self.add_resource('allmeters/', AllMetersResource()) self.add_resource('basic/', BasicResource()) print("CoAP server starting on " + host + ":" + str(port)) print(self.root.dump())
def __init__(self, host, port, multicast=False): CoAP.__init__(self, (host, port), multicast) self.add_resource('/temp', TempResource()) self.add_resource('/temp_threshold', TempThreshold()) self.add_resource('/humi', HumidityResource()) self.add_resource('/humi_threshold', HumiThreshold()) # self.add_resource('/led', LEDResource()) print("CoAP Server started on " + host + ":" + str(port)) print(self.root.dump())
def __init__(self, host, port, multicast=False): CoAP.__init__(self, (host, port), multicast) # CREATE meta-resource: resource used to create resources add = Add() add.set_server(self) self.add_resource('add/', add) # LOG print "CoAP server started on {}:{}".format(str(host), str(port)) print self.root.dump()
def __init__(self, host, port): CoAP.__init__(self, (host, port)) self.add_resource('/temperature', TemperatureResource()) self.add_resource('/identifier', IdentifierResource()) self.add_resource('/weight', WeightResource()) self.add_resource('/food', FoodResource()) self.add_resource('/water', WaterResource()) print 'CoAP Server start on ' + host + ':' + str(port) print self.root.dump()
def __init__(self, host, port): ''' Constructor * server must initiate with host and port ''' CoAP.__init__(self, (host, port)) # add resources CoAP.add_resource(self, 'temp_sensor/', self.tempResource) CoAP.add_resource(self, 'humidity_sensor/', self.humResource) CoAP.add_resource(self, 'pressure_sensor/', self.pressResource) CoAP.add_resource(self, 'led/', self.ledResource) CoAP.add_resource(self, 'led/status', self.ledResource)
def __init__(self, host, port): CoAP.__init__(self, (host, port)) # pdb.set_trace() try: if (MONGO == True): self.add_resource('/temp', TempMongoResource.TempMongoResource()) else: self.add_resource('/temp', TempResource.TempResource()) except NameError: self.add_resource('/temp', TempMongoResource.TempMongoResource()) self.add_resource('/time', TimeResource.TimeResource())
def __init__(self, host, port,qos=0): CoAP.__init__(self, (host, port),qos) # Add the first base API ps/ resource root_res = TopicResource("/ps",self) root_res.allow_children=True self.add_resource('/ps', root_res) #lines to add /ps/topic topic_res=TopicResource("/ps/topic",self) topic_res.payload = "A" topic_res.parent = root_res root_res.children.append(topic_res) self.add_resource('/ps/topic',topic_res)
def __init__(self, ipAddr = "0.0.0.0", port = 5683, multicast = False): self.config = ConfigUtil.ConfigUtil(ConfigConst.DEFAULT_CONFIG_FILE_NAME) self.config.loadConfig() print('Configuration data...\n' + str(self.config)) CoAP.__init__(self, (ipAddr, port), multicast) if port >= 1024: self.port = port else: self.port = 5683 self.ipAddr = ipAddr self.useMulticast = multicast self.initResources()
def __init__(self, host, port, multicast=False): CoAP.__init__(self, (host, port), multicast) self.add_resource('basic/', BasicResource()) self.add_resource('storage/', Storage()) self.add_resource('separate/', Separate()) self.add_resource('long/', Long()) self.add_resource('big/', Big()) self.add_resource('void/', voidResource()) self.add_resource('xml/', XMLResource()) self.add_resource('etag/', ETAGResource()) self.add_resource('child/', Child()) print "CoAP Server start on " + host + ":" + str(port) print self.root.dump()
def __init__(self, host, port, multicast=False): CoAP.__init__(self, (host, port), multicast) self.add_resource('basic/', BasicResource()) self.add_resource('storage/', Storage()) self.add_resource('separate/', Separate()) self.add_resource('long/', Long()) self.add_resource('big/', Big()) self.add_resource('void/', voidResource()) self.add_resource('xml/', XMLResource()) self.add_resource('encoding/', MultipleEncodingResource()) self.add_resource('etag/', ETAGResource()) self.add_resource('child/', Child()) self.host = host self.port = port
def __init__(self, host, port, multicast=False): CoAP.__init__(self, (host, port), multicast) self.client = HelperClient(server=(defines.RD_HOST, defines.RD_PORT)) self.node_resource_schema = json.load(open(defines.NODE_RESOURCE_SCHEMA_PATH, "r")) self.node_name = self.node_resource_schema["node"]["name"]["value"] self.parameter_schema = json.load(open(defines.SERIAL_PARAMETER_SCHEMA_PATH, "r")) self.parameter_schema_lock = threading.Lock() serial_listener = threading.Thread(target=self.serial_listen) serial_listener.setDaemon(True) serial_listener.start() self.rd_discovery() print "CoAP Server start on " + host + ":" + str(port)
def __init__(self, host, port, multicast=False, disc=None): CoAP.__init__(self, (host, port), multicast) self.disc = disc self.add_resource('message/', MsgResource(disc=disc))
def __init__(self, host, port, multicast=False): CoAP.__init__(self, (host, port), multicast) self.add_resource('Pir/', Pir()) print "CoAP Server start on " + host + ":" + str(port) print self.root.dump()
def __init__(self, host, port): CoAP.__init__(self, (host, port)) self.add_resource('basic/', BasicResource())