Example #1
0
        public TransceiverData ReadTransceiverData()
        {
            TransceiverData data = new TransceiverData()
            {
                Success = false, Frequency = 0.0, TransceiverMode = TransceiverMode.CW
            };

            try
            {
                byte[] responseBytes = port.ExecuteCommand(readDataBytes, 5);

                lastFrequency  = getFrequency(responseBytes);
                data.Frequency = lastFrequency;

                lastRigMode          = ((TransceiverMode)responseBytes[4]);
                data.TransceiverMode = lastRigMode;

                data.Success = data.Frequency != 0.0;
                if (!data.Success)
                {
                    throw new Exception("Failed to read frequency and mode.");
                }
            }
            catch (Exception ex)
            {
                data.Success      = false;
                data.ErrorMsg     = "Failed to read frequency and mode.";
                data.ExceptionMsg = ex.Message;
                Console.WriteLine(ex.Message);
            }
            return(data);
        }
 private void onTransceiverStateResponse(TransceiverState details)
 {
     transceiverInitialized = true;
     band     = details.Band;
     xcvrMode = details.Mode;
     mode     = xcvrMode.ToMode();
 }
 private void onModeChangedNotification(Mode details)
 {
     if (mode != details)
     {
         mode     = details;
         xcvrMode = mode.ToTransceiverMode();
         resetView();
     }
 }
Example #4
0
        public void SetMode(TransceiverMode mode)
        {
            try
            {
                byte[] requestBytes  = new byte[] { (byte)mode, 0x00, 0x00, 0x00, 0x07 };
                byte[] responseBytes = port.ExecuteCommand(requestBytes, 5);

                if (responseBytes[4] == 0x00)
                {
                    throw new Exception("Failed to set mode.");
                }
            }
            catch
            {
            }
        }
        public static Mode ToMode(this TransceiverMode transceiverMode)
        {
            switch (transceiverMode)
            {
            case TransceiverMode.AM: return(Mode.AM);

            case TransceiverMode.CW:
            case TransceiverMode.CW1:
            case TransceiverMode.CWR:
            case TransceiverMode.CWR1: return(Mode.CW);

            case TransceiverMode.DIG: return(Mode.Digital);

            case TransceiverMode.FM:
            case TransceiverMode.FMN: return(Mode.FM);

            default: return(Mode.Other);

            case TransceiverMode.LSB:
            case TransceiverMode.USB: return(Mode.SSB);

            case TransceiverMode.PKT: return(Mode.Packet);
            }
        }
Example #6
0
 void SetTransceiverMode(TransceiverMode mode)
 {
     VendorRequestOut(DeviceRequest.SetTransceiverMode, (ushort)mode, 0, null);
 }
Example #7
0
 public Transceiver(TransceiverMode mode)
 {
     _currentMode = mode;
 }
Example #8
0
 void SetTransceiverMode(TransceiverMode mode)
 {
     VendorRequestOut(DeviceRequest.SetTransceiverMode, (ushort)mode, 0, null);
 }