public void SendTrackingStateChanged(IConnectionProvider connectionProvider, TrackingStateChanged data)
 {
     connectionProvider.SendMessage(StructToByteArray <TrackingStateChanged>(data), trackingStateChanged);
 }
 public void SendFrameReceived(IConnectionProvider connectionProvider, CameraFrameReceived data)
 {
     connectionProvider.SendMessage(StructToByteArray <CameraFrameReceived>(data), frameReceivedID);
 }
        public void SendFrameReceived(IConnectionProvider connectionProvider, ARCameraFrameEventArgs frameEventArgs)
        {
            if (ARSubsystemManager.cameraSubsystem == null)
            {
                return;
            }

            writer.BeginMessage(RemoteMessage.ARCameraFrameData);

            writer.Write(frameEventArgs.lightEstimation.averageBrightness.GetValueOrDefault());
            writer.Write(frameEventArgs.lightEstimation.averageColorTemperature.GetValueOrDefault());
            writer.Write(frameEventArgs.time.GetValueOrDefault());

            var gotDisplayMatrix = ARSubsystemManager.cameraSubsystem.TryGetDisplayMatrix(ref dm);

            writer.Write(gotDisplayMatrix);

            if (gotDisplayMatrix)
            {
                for (int i = 0; i < 16; i++)
                {
                    writer.Write(dm[i]);
                }
            }

            Matrix4x4 pm = Matrix4x4.identity;
            var       gotProjectionMatrix = ARSubsystemManager.cameraSubsystem.TryGetProjectionMatrix(ref pm);

            writer.Write(gotProjectionMatrix);

            if (gotProjectionMatrix)
            {
                for (int i = 0; i < 16; i++)
                {
                    writer.Write(pm[i]);
                }
            }


            byte fieldMask = 0;

            if (frameEventArgs.time.HasValue)
            {
                fieldMask |= 1 << 0;
            }
            if (frameEventArgs.lightEstimation.averageBrightness.HasValue)
            {
                fieldMask |= 1 << 1;
            }
            if (frameEventArgs.lightEstimation.averageColorTemperature.HasValue)
            {
                fieldMask |= 1 << 2;
            }
            if (gotProjectionMatrix)
            {
                fieldMask |= 1 << 3;
            }
            if (gotDisplayMatrix)
            {
                fieldMask |= 1 << 4;
            }

            writer.Write(fieldMask);

            writer.EndMessage(stream);

            if (connectionProvider != null)
            {
                connectionProvider.SendMessage(stream);
            }
        }
 public void SendReferenePointUpdate(IConnectionProvider connectionProvider, ReferencePointUpdateID data)
 {
     connectionProvider.SendMessage(StructToByteArray <ReferencePointUpdateID>(data), referencePointUpdateID);
 }
 public void SendPlane(IConnectionProvider connectionProvider, PlaneData planeData)
 {
     connectionProvider.SendMessage(StructToByteArray <PlaneData>(planeData), planeEventID);
 }
        public void SendWebCamStream(string name, int width, int height, byte[] image, int angle, bool verticallyMirrored, IConnectionProvider connectionProvider)
        {
            writer.BeginMessage(RemoteMessage.WebCamStream);
            writer.Write(name);
            writer.Write((uint)width);
            writer.Write((uint)height);
            writer.Write(angle);
            writer.Write(verticallyMirrored);
            writer.Write((uint)image.Length);
            writer.Write(image);
            writer.EndMessage(stream);

            if (connectionProvider != null)
            {
                connectionProvider.SendMessage(stream);
            }
        }