fixed some device startup problems

main
Tom Early 4 years ago
parent ea4720bc74
commit 62bdcde1de

@ -81,19 +81,14 @@ bool CController::InitDevices()
return true;
}
// now initialize each device
//initialize each device
if (dstar_device.OpenDevice(deviceset[0], 921600) || dmr_device.OpenDevice(deviceset[1], 921600))
return true;
if (dstar_device.InitDV3003() || dmr_device.InitDV3003())
return true;
// and start them up!
dstar_device.Start();
dmr_device.Start();
for (uint8_t ch=PKT_CHANNEL0; ch<=PKT_CHANNEL2; ch++)
{
if (dstar_device.ConfigureVocoder(ch, Encoding::dstar) || dmr_device.ConfigureVocoder(ch, Encoding::dmr))
return true;
}
return false;
}

@ -147,6 +147,14 @@ bool CDV3003::OpenDevice(const std::string &ttyname, int baudrate)
std::cout << "Opened " << devicepath << " using fd " << fd << std::endl;
#endif
if (InitDV3003())
return true;
for (uint8_t ch=PKT_CHANNEL0; ch<=PKT_CHANNEL2; ch++)
{
if (ConfigureVocoder(ch, type))
return true;
}
return false;
}
@ -244,9 +252,13 @@ bool CDV3003::InitDV3003()
version.assign(responsePacket.payload.ctrl.data.version);
std::cout << "Found " << productid << " version " << version << " at " << devicepath << std::endl;
return false;
}
void CDV3003::Start()
{
feedFuture = std::async(std::launch::async, &CDV3003::FeedDevice, this);
readFuture = std::async(std::launch::async, &CDV3003::ReadDevice, this);
return false;
}
bool CDV3003::ConfigureVocoder(uint8_t pkt_ch, Encoding type)

@ -105,8 +105,7 @@ public:
CDV3003(Encoding t);
~CDV3003();
bool OpenDevice(const std::string &device, int baudrate);
bool InitDV3003();
bool ConfigureVocoder(uint8_t pkt_ch, Encoding type);
void Start();
void CloseDevice();
std::string GetDevicePath() const;
std::string GetProductID() const;
@ -129,6 +128,8 @@ private:
void FeedDevice();
void ReadDevice();
bool SetBaudRate(int baudrate);
bool InitDV3003();
bool ConfigureVocoder(uint8_t pkt_ch, Encoding type);
bool checkResponse(SDV3003_Packet &responsePacket, uint8_t response) const;
bool SendAudio(const uint8_t channel, const int16_t *audio) const;
bool SendData(const uint8_t channel, const uint8_t *data) const;

Loading…
Cancel
Save

Powered by TurnKey Linux.