Beispiel #1
0
def run():
    with grpc.insecure_channel("localhost:50000") as channel:
        stub = gps_pb2_grpc.GpsServiceStub(channel)
        print("-------------- GetStatus --------------")
        status = get_status(stub)
        print(repr(status))

        if not status.is_updating and not status.has_position:
            print("-------------- StartUpdating --------------")
            start_updating(stub)

            status = get_status(stub)

        print("-------------- GetPosition --------------")
        get_position(stub)
Beispiel #2
0
 def start(self):
     with grpc.insecure_channel(self.service_address) as channel:
         stub = gps_pb2_grpc.GpsServiceStub(channel)
         stub.StartUpdating(gps_pb2.StartRequest(stop_when_found=True))
Beispiel #3
0
 def position(self):
     with grpc.insecure_channel(self.service_address) as channel:
         stub = gps_pb2_grpc.GpsServiceStub(channel)
         return stub.GetPosition(gps_pb2.EmptyRequest())
Beispiel #4
0
 def stop(self):
     with grpc.insecure_channel(self.service_address) as channel:
         stub = gps_pb2_grpc.GpsServiceStub(channel)
         stub.StopUpdating(gps_pb2.EmptyRequest())