Пример #1
0
 def __init__(self, host, port, multicast=False):
     CoAP.__init__(self, (host, port), multicast)
     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())
Пример #2
0
 def __init__(self, host, port, multicast=False):
     CoAP.__init__(self, 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())
     print "CoAP Server start on " + host + ":" + str(port)
Пример #3
0
    def __init__(self, server_address, multicast=False):
        """
        Initialize the CoAP protocol

        """
        CoAP.__init__(self, server_address, multicast)
        self._forward = {}
        self._forward_mid = {}
        self._token = random.randint(1, 1000)
        self.timer = {}
Пример #4
0
 def __init__(self, host, port, multicast=False, starting_mid=None):
     CoAP.__init__(self, (host, port), multicast, starting_mid)
     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))
Пример #5
0
 def __init__(self, host, port, multicast=False):
     CoAP.__init__(self, multicast)
     self.add_resource('light01/', Light(payload="Living Room Light", pin=LIVING_ROOM_LED_PIN, ip=YUN1_IP,
                                         command="digital"))
     self.add_resource('light02/', Light(payload="Bedroom Light", pin=BEDROOM_LED_PIN1, ip=YUN1_IP,
                                         command="digital"))
     self.add_resource('light03/', Light(payload="Bedroom Light", pin=BEDROOM_LED_PIN2, ip=YUN1_IP,
                                         command="digital"))
     self.add_resource('light04/', Light(payload="Bathroom Light", pin=BATHROOM_LED_PIN, ip=YUN1_IP,
                                         command="digital"))
     print "CoAP Server start on " + host + ":" + str(port)
     print(self.root.dump())
Пример #6
0
    def __init__(self, server, client):
        """
        Initialize the CoAP protocol

        """
        CoAP.__init__(self)
        self.client = client
        self.server = server
        self._forward = {}
        self._forward_mid = {}
        self._token = random.randint(1, 1000)
        self.timer = {}
Пример #7
0
 def __init__(self, host, port, multicast=False):
     CoAP.__init__(self, multicast)
     self.add_resource('garden01/', Light(payload="Garden Light 01", pin=GARDEN_LED_PIN1, ip=YUN2_IP,
                                          command="digital"))
     self.add_resource('garden02/', Light(payload="Garden Light 02", pin=GARDEN_LED_PIN2, ip=YUN2_IP,
                                          command="digital"))
     self.add_resource('garage/', Servo(payload="Garage Door", pin=GARAGE_PIN, ip=YUN2_IP,
                                        command="servo"))
     self.add_resource('alarm/', Alarm(payload="Alarm", pin=ALARM_PIN, ip=YUN2_IP,
                                       command="digital"))
     self.add_resource('fan/', Fan(payload="Alarm", pin=FAN_PIN, ip=YUN2_IP,
                                     command="digital"))
     self.add_resource('light01/', Light(payload="Bathroom Light", pin=DININGROOM_LED_PIN, ip=YUN2_IP,
                                         command="digital"))
     print "CoAP Server start on " + host + ":" + str(port)
     print(self.root.dump())