private void refreshAngButton_Click(object sender, EventArgs e)
        {
            var message = new CameraControlMessage(CameraControlMessage.QuickCmdEnum.GetAngles);

            try
            {
                var tcp = TcpConnect();

                tcp.Send(message.getBytes());

                //tcp.Disconnect();
            }
            catch (Exception ex)
            {
                SetRichTextBox(richTextBox1, "Failed to send get angles command to TCP server: " + ex.ToString());
            }
        }
        private CameraControlMessage translate2control(ref State state)
        {
            CameraControlMessage msg = new CameraControlMessage();

            try
            {
                msg.Pitch        = Convert.ToByte(pitchBox.Text);
                msg.Yaw          = Convert.ToByte(yawBox.Text);
                msg.Zoom         = Convert.ToByte(zoomBox.Text);
                msg.Focus        = Convert.ToByte(focusBox.Text);
                msg.Switch       = (byte)getSwitchOp(ref state);
                msg.Record       = (byte)getRecordOp(ref state);
                msg.QuickCommand = (byte)button2Cmd(JoyStickDataProcess.sortButtons(state));
            }
            catch
            {
            }

            return(msg);
        }
        //private void SendTcpMsg(object sender, EventArgs e)
        //{
        //    var control_msg = translate2control(ref last_state);

        //    byte[] msg = control_msg.getBytes();

        //    SendContent(msg);
        //    updateLabel(ref control_msg);
        //}

        private void updateLabel(ref CameraControlMessage msg)
        {
            if (msg.Switch == (byte)CameraControlMessage.SwitchOpEnum.PhotoMode)
            {
                SetLabelText(switchLabel, "Photo");
            }
            else if (msg.Switch == (byte)CameraControlMessage.SwitchOpEnum.VideoMode)
            {
                SetLabelText(switchLabel, "Video");
            }

            if (msg.Record == (byte)CameraControlMessage.RecordOpEnum.StartRecord)
            {
                SetLabelText(recordStateLabel, "Recording");
            }
            else if (msg.Record == (byte)CameraControlMessage.RecordOpEnum.StopRecord)
            {
                SetLabelText(recordStateLabel, "Stopped");
            }
        }
Example #4
0
 private void OnCameraControlChange(CameraControlMessage value)
 {
     _enabled = value.Enable;
 }