private void Response()
    {
        while (true)
        {
            var receivedBuffer = ReceiveRequest();

            var requestMessage = ParsingCameraInfoRequest(ref memoryStreamForCameraInfo, receivedBuffer);

            // Debug.Log(subPartName + receivedString);
            if (requestMessage != null && requestMessage.Name.Equals("request_camera_info"))
            {
                var cameraInfoMessage = cam.GetCameraInfo();

                SetCameraInfoResponse(ref memoryStreamForCameraInfo, cameraInfoMessage);

                SendResponse(memoryStreamForCameraInfo);
            }
        }
    }
Exemple #2
0
    private void Response()
    {
        while (IsRunningThread)
        {
            var receivedBuffer = ReceiveRequest();

            var requestMessage = ParsingInfoRequest(receivedBuffer, ref msForInfoResponse);

            // Debug.Log(subPartName + receivedString);
            if (requestMessage != null)
            {
                switch (requestMessage.Name)
                {
                case "request_ros2":
                    var topic_name = parameters.GetValue <string>("ros2/topic_name");
                    var frame_id   = parameters.GetValue <string>("ros2/frame_id");
                    SetROS2CommonInfoResponse(ref msForInfoResponse, topic_name, frame_id);
                    break;

                case "request_camera_info":
                    var cameraInfoMessage = cam.GetCameraInfo();
                    SetCameraInfoResponse(ref msForInfoResponse, cameraInfoMessage);
                    break;

                case "request_transform":
                    var isSubParts = string.IsNullOrEmpty(subPartName);
                    var devicePose = cam.GetPose(isSubParts);
                    SetTransformInfoResponse(ref msForInfoResponse, devicePose);
                    break;

                default:
                    break;
                }

                SendResponse(msForInfoResponse);
            }

            ThreadWait();
        }
    }