Beispiel #1
0
 def ping(self, request, context):
     # TODO
     print("Encode:\n", request)
     response = ping_pb2.Response()
     response.data = "pong"
     #return None
     return response
Beispiel #2
0
 def ping(self, request, context):
     # TODO
     data = str(request.data)
     print("Server: {}".format(data))
     response = ping_pb2.Response()
     response.data = 'pong'
     return response
Beispiel #3
0
 def coordinates(self, request, context):
     for x in self.client_dict:
         if (x == request.id):
             yield ping_pb2.Response(data=str(self.client_dict[x]),
                                     change=self.cord_update[x],
                                     id=x)
             self.cord_update[x] = False
Beispiel #4
0
 def ping(self, request, context):
     request_id = request.id
     if request_id in self.location_map:
         return ping_pb2.Response(loc=stringToIntList(
             self.location_map[request_id]),
                                  id=request_id)
     else:
         self.location_map[request_id] = None
         print("Client id [", request_id, "] is not registered yet!")
Beispiel #5
0
    def update(self, request, context):
        request_id = request.id

        while True:
            updated_loc = str(
                stringToIntList(self.start_coor)[0] +
                stringToIntList(self.dist)[0] * request_id) + "," + str(
                    stringToIntList(self.start_coor)[1] +
                    stringToIntList(self.dist)[1] * request_id) + "," + str(
                        stringToIntList(self.start_coor)[2] +
                        stringToIntList(self.dist)[2] * request_id)
            output = map(int, updated_loc.split(','))
            yield ping_pb2.Response(loc=output, id=request_id)
Beispiel #6
0
    def ping(self, request, context):
        global index_client_counter

        if index_client_counter == 1:
            ret = "Client id {} connected to server.\n[received] moving to {}".format(
                index_client_counter,
                str(self.client_dict[index_client_counter]))
            id = index_client_counter
        else:
            ret = "Client id {} connected to server.\n[received] moving to {}".format(
                index_client_counter, self.client_dict[index_client_counter])
            id = index_client_counter
        index_client_counter = index_client_counter + 1

        return ping_pb2.Response(data=ret, id=id)
Beispiel #7
0
 def register(self, request, context):
     request_id = request.id
     if request_id == -1:
         cur_count = self.count
         self.count += 1
         if cur_count == 0:
             self.location_map[0] = self.start_coor
         else:
             self.location_map[cur_count] = str(
                 stringToIntList(self.location_map[cur_count - 1])[0] +
                 stringToIntList(self.dist)[0]) + "," + str(
                     stringToIntList(self.start_coor)[1] +
                     stringToIntList(self.dist)[1]) + "," + str(
                         stringToIntList(self.start_coor)[2] +
                         stringToIntList(self.dist)[2])
         return ping_pb2.Response(loc=stringToIntList(
             self.location_map[cur_count]),
                                  id=cur_count)
     else:
         if request_id in self.location_map:
             print("This ID already exist.")
Beispiel #8
0
 def ping(self, request, context):
     # TODO
     # print("Encode:\n", request)
     # return None
     return ping_pb2.Response(data='Pong')
 def ping(self, request, context):
     # TODO
     print("Encode:\n", request)
     data = str("Pong")
     return ping_pb2.Response(data="Pong")
Beispiel #10
0
 def ping(self, request, context):
     # TODO
     print("Encode:\n", request)
     return ping_pb2.Response(data="pong!!")
Beispiel #11
0
 def pong(self, request, context):
     # TODO
     print("Response=", request.data)
     return ping_pb2.Response(data = "pong")
 def ping(self, request, context):
     print("Encode:\n", request.data)
     return ping_pb2.Response(data="Pong")
Beispiel #13
0
    def ping(self, request, context):

        return ping_pb2.Response(data='pong')
Beispiel #14
0
 def ping(self, request, context):
     print(request.data)
     return ping_pb2.Response(data='pong')
Beispiel #15
0
 def ping(self, request, context):
     print("Ping Server")
     print("Server = {}".format(request.data))
     return ping_pb2.Response(data="Pong")
Beispiel #16
0
 def ping(self, request, context):
     # TODO
     print("Encode:\n", request)
     #return ping_pb2.Response(data='Pong, %s!' % request.data)
     return ping_pb2.Response(data='Pong')
Beispiel #17
0
 def ping(self, request, context):
     # TODO
     return ping_pb2.Response(data = "pong")
 def ping(self, request, context):
     print("Data{} =", request.data)
     return ping_pb2.Response(data="pong")