예제 #1
0
    def set_session_location(self,
                             session_id,
                             x=None,
                             y=None,
                             z=None,
                             lat=None,
                             lon=None,
                             alt=None,
                             scale=None):
        """
        Set session location.

        :param int session_id: id of session
        :param float x: x position
        :param float y: y position
        :param float z: z position
        :param float lat: latitude position
        :param float lon: longitude  position
        :param float alt: altitude position
        :param float scale: geo scale
        :return: response with result of success or failure
        :rtype: core_pb2.SetSessionLocationResponse
        :raises grpc.RpcError: when session doesn't exist
        """
        position = core_pb2.SessionPosition(x=x,
                                            y=y,
                                            z=z,
                                            lat=lat,
                                            lon=lon,
                                            alt=alt)
        request = core_pb2.SetSessionLocationRequest(session_id=session_id,
                                                     position=position,
                                                     scale=scale)
        return self.stub.SetSessionLocation(request)
예제 #2
0
파일: server.py 프로젝트: yanhc519/core
 def GetSessionLocation(self, request, context):
     logging.debug("get session location: %s", request)
     session = self.get_session(request.session_id, context)
     x, y, z = session.location.refxyz
     lat, lon, alt = session.location.refgeo
     position = core_pb2.SessionPosition(x=x,
                                         y=y,
                                         z=z,
                                         lat=lat,
                                         lon=lon,
                                         alt=alt)
     return core_pb2.GetSessionLocationResponse(
         position=position, scale=session.location.refscale)