runtime/eRPCServer.py
changeset 4037 4127c64df073
parent 3905 d47fe28d799a
child 4043 b217fb367574
equal deleted inserted replaced
4030:45532de22b75 4037:4127c64df073
    83         self.continueloop = True
    83         self.continueloop = True
    84         self.server = None
    84         self.server = None
    85         self.transport = None
    85         self.transport = None
    86         self.servicename = servicename
    86         self.servicename = servicename
    87         self.ip_addr = ip_addr
    87         self.ip_addr = ip_addr
    88         self.port = port
    88         self.port = int(port)
    89         self.servicepublisher = None
    89         self.servicepublisher = None
    90 
    90 
    91     def _to_be_published(self):
    91     def _to_be_published(self):
    92         return self.servicename is not None and \
    92         return self.servicename is not None and \
    93                self.ip_addr not in ["", "localhost", "127.0.0.1"]
    93                self.ip_addr not in ["", "localhost", "127.0.0.1"]
   116 
   116 
   117         # TODO initialize Serial transport layer if selected
   117         # TODO initialize Serial transport layer if selected
   118         # transport = erpc.transport.SerialTransport(device, baudrate)
   118         # transport = erpc.transport.SerialTransport(device, baudrate)
   119 
   119 
   120         # initialize TCP transport layer
   120         # initialize TCP transport layer
   121         self.transport = erpc.transport.TCPTransport(self.ip_addr, int(self.port), True)
   121         self.transport = erpc.transport.TCPTransport(self.ip_addr, self.port, True)
   122 
   122 
   123         self.server = erpc.simple_server.SimpleServer(self.transport, erpc.basic_codec.BasicCodec)
   123         self.server = erpc.simple_server.SimpleServer(self.transport, erpc.basic_codec.BasicCodec)
   124         self.server.add_service(service)
   124         self.server.add_service(service)
   125 
   125 
   126         when_ready()
   126         when_ready()