backup a bit

main
Tom Early 4 years ago
parent ca057dd185
commit b73f547440

@ -52,7 +52,7 @@ void CController::Stop()
reader.Close(); reader.Close();
dstar_device.CloseDevice(); dstar_device.CloseDevice();
dmrsf_device.CloseDevice(); dmr_device.CloseDevice();
} }
bool CController::CheckTCModules() const bool CController::CheckTCModules() const
@ -157,13 +157,13 @@ bool CController::InitDevices()
{ {
dstar_device.OpenDevice(deviceset.front().first, deviceset.front().second, 921600); dstar_device.OpenDevice(deviceset.front().first, deviceset.front().second, 921600);
deviceset.pop_front(); deviceset.pop_front();
dmrsf_device.OpenDevice(deviceset.front().first, deviceset.front().second, 921600); dmr_device.OpenDevice(deviceset.front().first, deviceset.front().second, 921600);
deviceset.pop_front(); deviceset.pop_front();
} }
// and start them up! // and start them up!
dstar_device.Start(); dstar_device.Start();
dmrsf_device.Start(); dmr_device.Start();
deviceset.clear(); deviceset.clear();
@ -190,7 +190,7 @@ void CController::ReadReflectorThread()
dstar_device.AddPacket(packet); dstar_device.AddPacket(packet);
break; break;
case ECodecType::dmr: case ECodecType::dmr:
dmrsf_device.AddPacket(packet); dmr_device.AddPacket(packet);
break; break;
case ECodecType::c2_1600: case ECodecType::c2_1600:
case ECodecType::c2_3200: case ECodecType::c2_3200:
@ -284,7 +284,7 @@ void CController::Codec2toAudio(std::shared_ptr<CTranscoderPacket> packet)
} }
// the only thing left is to encode the two ambe, so push the packet onto both AMBE queues // the only thing left is to encode the two ambe, so push the packet onto both AMBE queues
dstar_device.AddPacket(packet); dstar_device.AddPacket(packet);
dmrsf_device.AddPacket(packet); dmr_device.AddPacket(packet);
} }
void CController::ProcessC2Thread() void CController::ProcessC2Thread()
@ -329,7 +329,7 @@ void CController::RouteDstPacket(std::shared_ptr<CTranscoderPacket> packet)
{ {
// codec_in is dstar, the audio has just completed, so now calc the M17 and DMR // codec_in is dstar, the audio has just completed, so now calc the M17 and DMR
codec2_queue.push(packet); codec2_queue.push(packet);
dmrsf_device.AddPacket(packet); dmr_device.AddPacket(packet);
} }
else if (packet->AllCodecsAreSet()) else if (packet->AllCodecsAreSet())
{ {

@ -29,10 +29,12 @@
#include "UnixDgramSocket.h" #include "UnixDgramSocket.h"
#include "configure.h" #include "configure.h"
enum class EAmbeType { dstar, dmr };
class CController class CController
{ {
public: public:
std::mutex dstar_mux, dmrsf_mux; std::mutex dstar_mux, dmr_mux;
CController(); CController();
bool Start(); bool Start();
@ -50,7 +52,7 @@ protected:
CUnixDgramWriter writer; CUnixDgramWriter writer;
std::unordered_map<char, std::unique_ptr<CCodec2>> c2_16, c2_32; std::unordered_map<char, std::unique_ptr<CCodec2>> c2_16, c2_32;
CDV3003 dstar_device{Encoding::dstar}; CDV3003 dstar_device{Encoding::dstar};
CDV3003 dmrsf_device{Encoding::dmrsf}; CDV3003 dmr_device{Encoding::dmr};
CPacketQueue codec2_queue; CPacketQueue codec2_queue;
std::mutex send_mux; std::mutex send_mux;

@ -201,7 +201,7 @@ bool CDV3003::OpenDevice(const std::string &serialno, const std::string &desc, i
} }
} }
status = FT_SetBaudRate(ftHandle, baudrate); status = FT_SetBaudRate(ftHandle, baudrate );
if (status != FT_OK) if (status != FT_OK)
{ {
FTDI_Error("FT_SetBaudRate", status); FTDI_Error("FT_SetBaudRate", status);
@ -221,7 +221,7 @@ bool CDV3003::OpenDevice(const std::string &serialno, const std::string &desc, i
return true; return true;
} }
status = FT_SetTimeouts(ftHandle, 200, 200); status = FT_SetTimeouts(ftHandle, 200, 200 );
if (status != FT_OK) if (status != FT_OK)
{ {
FTDI_Error("FT_SetTimeouts", status); FTDI_Error("FT_SetTimeouts", status);
@ -229,7 +229,7 @@ bool CDV3003::OpenDevice(const std::string &serialno, const std::string &desc, i
} }
description.assign(desc); description.assign(desc);
description.append(":"); description.append(": ");
description.append(serialno); description.append(serialno);
std::cout << "Opened " << description << std::endl; std::cout << "Opened " << description << std::endl;
@ -445,7 +445,7 @@ bool CDV3003::ConfigureVocoder(uint8_t pkt_ch, Encoding type)
if ((ntohs(responsePacket.header.payload_length) != 16) || (responsePacket.field_id != pkt_ch) || (0 != memcmp(responsePacket.payload.ctrl.data.resp, resp, sizeof(resp)))) if ((ntohs(responsePacket.header.payload_length) != 16) || (responsePacket.field_id != pkt_ch) || (0 != memcmp(responsePacket.payload.ctrl.data.resp, resp, sizeof(resp))))
{ {
std::cerr << "Config response packet failed" << std::endl; std::cerr << "Config response packet failed" << std::endl;
dump("Configuration Response Packet:", &responsePacket, sizeof(responsePacket)); dump("Configuration Response Packet:", &responsePacket, packet_size(responsePacket));
return true; return true;
}; };
@ -467,8 +467,7 @@ bool CDV3003::GetResponse(SDV3003_Packet &packet)
FTDI_Error("Reading packet start byte", status); FTDI_Error("Reading packet start byte", status);
return true; return true;
} }
if (0 == bytes_read)
return true; // nothing to read
if (packet.start_byte == PKT_HEADER) if (packet.start_byte == PKT_HEADER)
break; break;
} }
@ -610,9 +609,9 @@ void CDV3003::ReadDevice()
} }
else else
{ {
Controller.dmrsf_mux.lock(); Controller.dmr_mux.lock();
Controller.RouteDmrPacket(packet); Controller.RouteDmrPacket(packet);
Controller.dmrsf_mux.unlock(); Controller.dmr_mux.unlock();
} }
} }
} }

@ -98,7 +98,7 @@ struct dv3003_packet {
using SDV3003_Packet = struct dv3003_packet; using SDV3003_Packet = struct dv3003_packet;
enum class Encoding { dstar, dmrsf }; enum class Encoding { dstar, dmr };
class CDV3003 { class CDV3003 {
public: public:

Loading…
Cancel
Save

Powered by TurnKey Linux.