from gateway import net


class CameraDevice(object):
    def __init__(self, stream, address):
        self.resolution = None
        self.framerate = None
        self.__stream = stream
        self.__address = address

    def send(self, opcode, body=None):
        packet = net.encode_packet(opcode, body)
        yield self.__stream.write(packet)

from tornado import gen

from gateway import net


class CameraDevice(object):
    def __init__(self, stream, address):
        self.resolution = None
        self.framerate = None
        self.__stream = stream
        self.__address = address

    @gen.coroutine
    def send(self, opcode, body=None):
        packet = net.encode_packet(opcode, body)
        yield self.__stream.write(packet)

Fix CameraDevice's send method is not called
Fix CameraDevice's send method is not called

Add send method @gen.coroutine decorator
+ from tornado import gen
+ 
  from gateway import net
  
  
  class CameraDevice(object):
      def __init__(self, stream, address):
          self.resolution = None
          self.framerate = None
          self.__stream = stream
          self.__address = address
  
+     @gen.coroutine
      def send(self, opcode, body=None):
          packet = net.encode_packet(opcode, body)
          yield self.__stream.write(packet)
  
Fix CameraDevice's send method is not called
## Code Before:
from gateway import net


class CameraDevice(object):
    def __init__(self, stream, address):
        self.resolution = None
        self.framerate = None
        self.__stream = stream
        self.__address = address

    def send(self, opcode, body=None):
        packet = net.encode_packet(opcode, body)
        yield self.__stream.write(packet)

## Instruction:
Fix CameraDevice's send method is not called
## Code After:
from tornado import gen

from gateway import net


class CameraDevice(object):
    def __init__(self, stream, address):
        self.resolution = None
        self.framerate = None
        self.__stream = stream
        self.__address = address

    @gen.coroutine
    def send(self, opcode, body=None):
        packet = net.encode_packet(opcode, body)
        yield self.__stream.write(packet)
