├── .gitattributes ├── .github └── workflows │ ├── build.yml │ └── release.yml ├── .gitignore ├── .gitmodules ├── .ycm_extra_conf.py ├── CMakeLists.txt ├── CMakeSettings.json ├── COPYING ├── LICENSE ├── Makefile ├── README.md ├── cmake └── FindASIO.cmake ├── configs ├── RSSI.dat ├── bridge-config.example.yml ├── config.example.yml ├── fne-config.example.yml ├── fne-sysview.example.yml ├── iden_table.example.dat ├── monitor-config.example.yml ├── patch-config.example.yml ├── peer_list.example.dat ├── rid_acl.example.dat ├── schema │ └── talkgroup_rules.yaml_schema.json └── talkgroup_rules.example.yml ├── contrib ├── .ycm_extra_conf.py ├── openssl_cross_patch.RPI_ARM.tar.gz └── vscode │ ├── c_cpp_properties.json │ └── launch.json ├── debian ├── postinst └── postrm ├── docs ├── TN.1000 - FNE Network.adoc ├── TN.1001 - Modem Protocol.adoc ├── TN.1101 - dvmhost Air Interface Tuning.adoc └── TN.Template.adoc ├── doxygen ├── INCLUDE_EMPTY_DIRECTORY └── theme │ └── custom.css ├── dvmhost.doxygen ├── linux └── dvmhost.service ├── repo └── Basic_P25_Network_Diagram.png ├── src ├── CMakeLists.txt ├── CompilerOptions.cmake ├── bridge │ ├── ActivityLog.cpp │ ├── ActivityLog.h │ ├── BridgeMain.cpp │ ├── BridgeMain.h │ ├── CMakeLists.txt │ ├── Defines.h │ ├── HostBridge.cpp │ ├── HostBridge.h │ ├── SampleTimeConversion.h │ ├── audio │ │ ├── miniaudio.c │ │ └── miniaudio.h │ ├── mdc │ │ ├── mdc_common.c │ │ ├── mdc_decode.c │ │ ├── mdc_decode.h │ │ ├── mdc_encode.c │ │ ├── mdc_encode.h │ │ └── mdc_types.h │ └── network │ │ ├── PeerNetwork.cpp │ │ └── PeerNetwork.h ├── common │ ├── AESCrypto.cpp │ ├── AESCrypto.h │ ├── BitManipulation.h │ ├── CMakeLists.txt │ ├── ClassProperties.h │ ├── Clock.cpp │ ├── Clock.h │ ├── Defines.h │ ├── Log.cpp │ ├── Log.h │ ├── RC4Crypto.cpp │ ├── RC4Crypto.h │ ├── RingBuffer.h │ ├── StopWatch.cpp │ ├── StopWatch.h │ ├── Thread.cpp │ ├── Thread.h │ ├── ThreadPool.cpp │ ├── ThreadPool.h │ ├── Timer.cpp │ ├── Timer.h │ ├── Utils.cpp │ ├── Utils.h │ ├── VariableLengthArray.h │ ├── concurrent │ │ ├── concurrent_lock.h │ │ ├── deque.h │ │ ├── map.h │ │ ├── unordered_map.h │ │ └── vector.h │ ├── dmr │ │ ├── DMRDefines.h │ │ ├── DMRUtils.h │ │ ├── SiteData.h │ │ ├── SlotType.cpp │ │ ├── SlotType.h │ │ ├── Sync.cpp │ │ ├── Sync.h │ │ ├── acl │ │ │ ├── AccessControl.cpp │ │ │ └── AccessControl.h │ │ ├── data │ │ │ ├── DataBlock.cpp │ │ │ ├── DataBlock.h │ │ │ ├── DataHeader.cpp │ │ │ ├── DataHeader.h │ │ │ ├── EMB.cpp │ │ │ ├── EMB.h │ │ │ ├── EmbeddedData.cpp │ │ │ ├── EmbeddedData.h │ │ │ ├── NetData.cpp │ │ │ └── NetData.h │ │ └── lc │ │ │ ├── CSBK.cpp │ │ │ ├── CSBK.h │ │ │ ├── FullLC.cpp │ │ │ ├── FullLC.h │ │ │ ├── LC.cpp │ │ │ ├── LC.h │ │ │ ├── PrivacyLC.cpp │ │ │ ├── PrivacyLC.h │ │ │ ├── ShortLC.cpp │ │ │ ├── ShortLC.h │ │ │ └── csbk │ │ │ ├── CSBKFactory.cpp │ │ │ ├── CSBKFactory.h │ │ │ ├── CSBK_ACK_RSP.cpp │ │ │ ├── CSBK_ACK_RSP.h │ │ │ ├── CSBK_ALOHA.cpp │ │ │ ├── CSBK_ALOHA.h │ │ │ ├── CSBK_BROADCAST.cpp │ │ │ ├── CSBK_BROADCAST.h │ │ │ ├── CSBK_BSDWNACT.cpp │ │ │ ├── CSBK_BSDWNACT.h │ │ │ ├── CSBK_CALL_ALRT.cpp │ │ │ ├── CSBK_CALL_ALRT.h │ │ │ ├── CSBK_EXT_FNCT.cpp │ │ │ ├── CSBK_EXT_FNCT.h │ │ │ ├── CSBK_MAINT.cpp │ │ │ ├── CSBK_MAINT.h │ │ │ ├── CSBK_NACK_RSP.cpp │ │ │ ├── CSBK_NACK_RSP.h │ │ │ ├── CSBK_PD_GRANT.cpp │ │ │ ├── CSBK_PD_GRANT.h │ │ │ ├── CSBK_PRECCSBK.cpp │ │ │ ├── CSBK_PRECCSBK.h │ │ │ ├── CSBK_PV_GRANT.cpp │ │ │ ├── CSBK_PV_GRANT.h │ │ │ ├── CSBK_P_CLEAR.cpp │ │ │ ├── CSBK_P_CLEAR.h │ │ │ ├── CSBK_P_GRANT.cpp │ │ │ ├── CSBK_P_GRANT.h │ │ │ ├── CSBK_RAND.cpp │ │ │ ├── CSBK_RAND.h │ │ │ ├── CSBK_RAW.cpp │ │ │ ├── CSBK_RAW.h │ │ │ ├── CSBK_TD_GRANT.cpp │ │ │ ├── CSBK_TD_GRANT.h │ │ │ ├── CSBK_TV_GRANT.cpp │ │ │ ├── CSBK_TV_GRANT.h │ │ │ ├── CSBK_UU_ANS_RSP.cpp │ │ │ ├── CSBK_UU_ANS_RSP.h │ │ │ ├── CSBK_UU_V_REQ.cpp │ │ │ └── CSBK_UU_V_REQ.h │ ├── edac │ │ ├── AMBEFEC.cpp │ │ ├── AMBEFEC.h │ │ ├── BCH.cpp │ │ ├── BCH.h │ │ ├── BPTC19696.cpp │ │ ├── BPTC19696.h │ │ ├── CRC.cpp │ │ ├── CRC.h │ │ ├── Golay2087.cpp │ │ ├── Golay2087.h │ │ ├── Golay24128.cpp │ │ ├── Golay24128.h │ │ ├── Hamming.cpp │ │ ├── Hamming.h │ │ ├── QR1676.cpp │ │ ├── QR1676.h │ │ ├── RS129.cpp │ │ ├── RS129.h │ │ ├── RS634717.cpp │ │ ├── RS634717.h │ │ ├── SHA256.cpp │ │ ├── SHA256.h │ │ ├── Trellis.cpp │ │ ├── Trellis.h │ │ └── rs │ │ │ └── RS.h │ ├── lookups │ │ ├── AffiliationLookup.cpp │ │ ├── AffiliationLookup.h │ │ ├── ChannelLookup.cpp │ │ ├── ChannelLookup.h │ │ ├── IdenTableLookup.cpp │ │ ├── IdenTableLookup.h │ │ ├── LookupTable.h │ │ ├── PeerListLookup.cpp │ │ ├── PeerListLookup.h │ │ ├── RSSIInterpolator.cpp │ │ ├── RSSIInterpolator.h │ │ ├── RadioIdLookup.cpp │ │ ├── RadioIdLookup.h │ │ ├── TalkgroupRulesLookup.cpp │ │ └── TalkgroupRulesLookup.h │ ├── network │ │ ├── BaseNetwork.cpp │ │ ├── BaseNetwork.h │ │ ├── FrameQueue.cpp │ │ ├── FrameQueue.h │ │ ├── NetRPC.cpp │ │ ├── NetRPC.h │ │ ├── Network.cpp │ │ ├── Network.h │ │ ├── PacketBuffer.cpp │ │ ├── PacketBuffer.h │ │ ├── RPCHeader.cpp │ │ ├── RPCHeader.h │ │ ├── RTPExtensionHeader.cpp │ │ ├── RTPExtensionHeader.h │ │ ├── RTPFNEHeader.cpp │ │ ├── RTPFNEHeader.h │ │ ├── RTPHeader.cpp │ │ ├── RTPHeader.h │ │ ├── RawFrameQueue.cpp │ │ ├── RawFrameQueue.h │ │ ├── json │ │ │ └── json.h │ │ ├── rest │ │ │ ├── RequestDispatcher.h │ │ │ └── http │ │ │ │ ├── ClientConnection.h │ │ │ │ ├── HTTPClient.h │ │ │ │ ├── HTTPHeaders.h │ │ │ │ ├── HTTPLexer.cpp │ │ │ │ ├── HTTPLexer.h │ │ │ │ ├── HTTPPayload.cpp │ │ │ │ ├── HTTPPayload.h │ │ │ │ ├── HTTPRequestHandler.cpp │ │ │ │ ├── HTTPRequestHandler.h │ │ │ │ ├── HTTPServer.h │ │ │ │ ├── SecureClientConnection.h │ │ │ │ ├── SecureHTTPClient.h │ │ │ │ ├── SecureHTTPServer.h │ │ │ │ ├── SecureServerConnection.h │ │ │ │ ├── ServerConnection.h │ │ │ │ └── ServerConnectionManager.h │ │ ├── sip │ │ │ ├── RequestDispatcher.h │ │ │ ├── SIPHeaders.h │ │ │ ├── SIPLexer.cpp │ │ │ ├── SIPLexer.h │ │ │ ├── SIPPayload.cpp │ │ │ └── SIPPayload.h │ │ ├── tcp │ │ │ ├── SecureTcpClient.cpp │ │ │ ├── SecureTcpClient.h │ │ │ ├── SecureTcpListener.h │ │ │ ├── Socket.cpp │ │ │ ├── Socket.h │ │ │ ├── TcpClient.h │ │ │ └── TcpListener.h │ │ ├── udp │ │ │ ├── Socket.cpp │ │ │ └── Socket.h │ │ └── viface │ │ │ ├── VIFace.cpp │ │ │ └── VIFace.h │ ├── nxdn │ │ ├── NXDNDefines.h │ │ ├── NXDNUtils.cpp │ │ ├── NXDNUtils.h │ │ ├── SiteData.h │ │ ├── Sync.cpp │ │ ├── Sync.h │ │ ├── acl │ │ │ ├── AccessControl.cpp │ │ │ └── AccessControl.h │ │ ├── channel │ │ │ ├── CAC.cpp │ │ │ ├── CAC.h │ │ │ ├── FACCH1.cpp │ │ │ ├── FACCH1.h │ │ │ ├── LICH.cpp │ │ │ ├── LICH.h │ │ │ ├── SACCH.cpp │ │ │ ├── SACCH.h │ │ │ ├── UDCH.cpp │ │ │ └── UDCH.h │ │ ├── edac │ │ │ ├── Convolution.cpp │ │ │ └── Convolution.h │ │ └── lc │ │ │ ├── PacketInformation.cpp │ │ │ ├── PacketInformation.h │ │ │ ├── RCCH.cpp │ │ │ ├── RCCH.h │ │ │ ├── RTCH.cpp │ │ │ ├── RTCH.h │ │ │ └── rcch │ │ │ ├── MESSAGE_TYPE_DCALL_HDR.cpp │ │ │ ├── MESSAGE_TYPE_DCALL_HDR.h │ │ │ ├── MESSAGE_TYPE_DST_ID_INFO.cpp │ │ │ ├── MESSAGE_TYPE_DST_ID_INFO.h │ │ │ ├── MESSAGE_TYPE_GRP_REG.cpp │ │ │ ├── MESSAGE_TYPE_GRP_REG.h │ │ │ ├── MESSAGE_TYPE_IDLE.cpp │ │ │ ├── MESSAGE_TYPE_IDLE.h │ │ │ ├── MESSAGE_TYPE_REG.cpp │ │ │ ├── MESSAGE_TYPE_REG.h │ │ │ ├── MESSAGE_TYPE_REG_C.cpp │ │ │ ├── MESSAGE_TYPE_REG_C.h │ │ │ ├── MESSAGE_TYPE_REG_COMM.cpp │ │ │ ├── MESSAGE_TYPE_REG_COMM.h │ │ │ ├── MESSAGE_TYPE_SITE_INFO.cpp │ │ │ ├── MESSAGE_TYPE_SITE_INFO.h │ │ │ ├── MESSAGE_TYPE_SRV_INFO.cpp │ │ │ ├── MESSAGE_TYPE_SRV_INFO.h │ │ │ ├── MESSAGE_TYPE_VCALL_ASSGN.cpp │ │ │ ├── MESSAGE_TYPE_VCALL_ASSGN.h │ │ │ ├── MESSAGE_TYPE_VCALL_CONN.cpp │ │ │ ├── MESSAGE_TYPE_VCALL_CONN.h │ │ │ ├── RCCHFactory.cpp │ │ │ └── RCCHFactory.h │ ├── p25 │ │ ├── Audio.cpp │ │ ├── Audio.h │ │ ├── Crypto.cpp │ │ ├── Crypto.h │ │ ├── NID.cpp │ │ ├── NID.h │ │ ├── P25Defines.h │ │ ├── P25Utils.cpp │ │ ├── P25Utils.h │ │ ├── SiteData.h │ │ ├── Sync.cpp │ │ ├── Sync.h │ │ ├── acl │ │ │ ├── AccessControl.cpp │ │ │ └── AccessControl.h │ │ ├── data │ │ │ ├── DataBlock.cpp │ │ │ ├── DataBlock.h │ │ │ ├── DataHeader.cpp │ │ │ ├── DataHeader.h │ │ │ ├── LowSpeedData.cpp │ │ │ └── LowSpeedData.h │ │ ├── dfsi │ │ │ ├── DFSIDefines.h │ │ │ ├── LC.cpp │ │ │ ├── LC.h │ │ │ └── frames │ │ │ │ ├── BlockHeader.cpp │ │ │ │ ├── BlockHeader.h │ │ │ │ ├── ControlOctet.cpp │ │ │ │ ├── ControlOctet.h │ │ │ │ ├── FrameDefines.h │ │ │ │ ├── Frames.h │ │ │ │ ├── FullRateVoice.cpp │ │ │ │ ├── FullRateVoice.h │ │ │ │ ├── MotFullRateVoice.cpp │ │ │ │ ├── MotFullRateVoice.h │ │ │ │ ├── MotPDUFrame.cpp │ │ │ │ ├── MotPDUFrame.h │ │ │ │ ├── MotStartOfStream.cpp │ │ │ │ ├── MotStartOfStream.h │ │ │ │ ├── MotStartVoiceFrame.cpp │ │ │ │ ├── MotStartVoiceFrame.h │ │ │ │ ├── MotTSBKFrame.cpp │ │ │ │ ├── MotTSBKFrame.h │ │ │ │ ├── MotVoiceHeader1.cpp │ │ │ │ ├── MotVoiceHeader1.h │ │ │ │ ├── MotVoiceHeader2.cpp │ │ │ │ ├── MotVoiceHeader2.h │ │ │ │ ├── StartOfStream.cpp │ │ │ │ ├── StartOfStream.h │ │ │ │ └── fsc │ │ │ │ ├── FSCACK.cpp │ │ │ │ ├── FSCACK.h │ │ │ │ ├── FSCConnect.cpp │ │ │ │ ├── FSCConnect.h │ │ │ │ ├── FSCDisconnect.cpp │ │ │ │ ├── FSCDisconnect.h │ │ │ │ ├── FSCHeartbeat.cpp │ │ │ │ ├── FSCHeartbeat.h │ │ │ │ ├── FSCMessage.cpp │ │ │ │ ├── FSCMessage.h │ │ │ │ ├── FSCReportSelModes.cpp │ │ │ │ ├── FSCReportSelModes.h │ │ │ │ ├── FSCSelChannel.cpp │ │ │ │ └── FSCSelChannel.h │ │ ├── kmm │ │ │ ├── KMMDeregistrationCommand.cpp │ │ │ ├── KMMDeregistrationCommand.h │ │ │ ├── KMMDeregistrationResponse.cpp │ │ │ ├── KMMDeregistrationResponse.h │ │ │ ├── KMMFactory.cpp │ │ │ ├── KMMFactory.h │ │ │ ├── KMMFrame.cpp │ │ │ ├── KMMFrame.h │ │ │ ├── KMMHello.cpp │ │ │ ├── KMMHello.h │ │ │ ├── KMMInventoryCommand.cpp │ │ │ ├── KMMInventoryCommand.h │ │ │ ├── KMMInventoryResponseHeader.cpp │ │ │ ├── KMMInventoryResponseHeader.h │ │ │ ├── KMMInventoryResponseListKeyIDs.cpp │ │ │ ├── KMMInventoryResponseListKeyIDs.h │ │ │ ├── KMMInventoryResponseListKeysets.cpp │ │ │ ├── KMMInventoryResponseListKeysets.h │ │ │ ├── KMMModifyKey.cpp │ │ │ ├── KMMModifyKey.h │ │ │ ├── KMMNegativeAck.cpp │ │ │ ├── KMMNegativeAck.h │ │ │ ├── KMMNoService.cpp │ │ │ ├── KMMNoService.h │ │ │ ├── KMMRegistrationCommand.cpp │ │ │ ├── KMMRegistrationCommand.h │ │ │ ├── KMMRegistrationResponse.cpp │ │ │ ├── KMMRegistrationResponse.h │ │ │ ├── KMMZeroize.cpp │ │ │ ├── KMMZeroize.h │ │ │ └── KeysetItem.h │ │ ├── lc │ │ │ ├── AMBT.cpp │ │ │ ├── AMBT.h │ │ │ ├── LC.cpp │ │ │ ├── LC.h │ │ │ ├── TDULC.cpp │ │ │ ├── TDULC.h │ │ │ ├── TSBK.cpp │ │ │ ├── TSBK.h │ │ │ ├── tdulc │ │ │ │ ├── LC_ADJ_STS_BCAST.cpp │ │ │ │ ├── LC_ADJ_STS_BCAST.h │ │ │ │ ├── LC_CALL_TERM.cpp │ │ │ │ ├── LC_CALL_TERM.h │ │ │ │ ├── LC_CONV_FALLBACK.cpp │ │ │ │ ├── LC_CONV_FALLBACK.h │ │ │ │ ├── LC_FAILSOFT.cpp │ │ │ │ ├── LC_FAILSOFT.h │ │ │ │ ├── LC_GROUP.cpp │ │ │ │ ├── LC_GROUP.h │ │ │ │ ├── LC_GROUP_UPDT.cpp │ │ │ │ ├── LC_GROUP_UPDT.h │ │ │ │ ├── LC_IDEN_UP.cpp │ │ │ │ ├── LC_IDEN_UP.h │ │ │ │ ├── LC_NET_STS_BCAST.cpp │ │ │ │ ├── LC_NET_STS_BCAST.h │ │ │ │ ├── LC_PRIVATE.cpp │ │ │ │ ├── LC_PRIVATE.h │ │ │ │ ├── LC_RFSS_STS_BCAST.cpp │ │ │ │ ├── LC_RFSS_STS_BCAST.h │ │ │ │ ├── LC_SYS_SRV_BCAST.cpp │ │ │ │ ├── LC_SYS_SRV_BCAST.h │ │ │ │ ├── LC_TEL_INT_VCH_USER.cpp │ │ │ │ ├── LC_TEL_INT_VCH_USER.h │ │ │ │ ├── TDULCFactory.cpp │ │ │ │ └── TDULCFactory.h │ │ │ └── tsbk │ │ │ │ ├── IOSP_ACK_RSP.cpp │ │ │ │ ├── IOSP_ACK_RSP.h │ │ │ │ ├── IOSP_CALL_ALRT.cpp │ │ │ │ ├── IOSP_CALL_ALRT.h │ │ │ │ ├── IOSP_EXT_FNCT.cpp │ │ │ │ ├── IOSP_EXT_FNCT.h │ │ │ │ ├── IOSP_GRP_AFF.cpp │ │ │ │ ├── IOSP_GRP_AFF.h │ │ │ │ ├── IOSP_GRP_VCH.cpp │ │ │ │ ├── IOSP_GRP_VCH.h │ │ │ │ ├── IOSP_MSG_UPDT.cpp │ │ │ │ ├── IOSP_MSG_UPDT.h │ │ │ │ ├── IOSP_RAD_MON.cpp │ │ │ │ ├── IOSP_RAD_MON.h │ │ │ │ ├── IOSP_STS_UPDT.cpp │ │ │ │ ├── IOSP_STS_UPDT.h │ │ │ │ ├── IOSP_UU_ANS.cpp │ │ │ │ ├── IOSP_UU_ANS.h │ │ │ │ ├── IOSP_UU_VCH.cpp │ │ │ │ ├── IOSP_UU_VCH.h │ │ │ │ ├── IOSP_U_REG.cpp │ │ │ │ ├── IOSP_U_REG.h │ │ │ │ ├── ISP_AUTH_FNE_RST.cpp │ │ │ │ ├── ISP_AUTH_FNE_RST.h │ │ │ │ ├── ISP_AUTH_RESP.cpp │ │ │ │ ├── ISP_AUTH_RESP.h │ │ │ │ ├── ISP_AUTH_SU_DMD.cpp │ │ │ │ ├── ISP_AUTH_SU_DMD.h │ │ │ │ ├── ISP_CAN_SRV_REQ.cpp │ │ │ │ ├── ISP_CAN_SRV_REQ.h │ │ │ │ ├── ISP_EMERG_ALRM_REQ.cpp │ │ │ │ ├── ISP_EMERG_ALRM_REQ.h │ │ │ │ ├── ISP_GRP_AFF_Q_RSP.cpp │ │ │ │ ├── ISP_GRP_AFF_Q_RSP.h │ │ │ │ ├── ISP_LOC_REG_REQ.cpp │ │ │ │ ├── ISP_LOC_REG_REQ.h │ │ │ │ ├── ISP_SNDCP_CH_REQ.cpp │ │ │ │ ├── ISP_SNDCP_CH_REQ.h │ │ │ │ ├── ISP_SNDCP_REC_REQ.cpp │ │ │ │ ├── ISP_SNDCP_REC_REQ.h │ │ │ │ ├── ISP_U_DEREG_REQ.cpp │ │ │ │ ├── ISP_U_DEREG_REQ.h │ │ │ │ ├── OSP_ADJ_STS_BCAST.cpp │ │ │ │ ├── OSP_ADJ_STS_BCAST.h │ │ │ │ ├── OSP_AUTH_FNE_RESP.cpp │ │ │ │ ├── OSP_AUTH_FNE_RESP.h │ │ │ │ ├── OSP_DENY_RSP.cpp │ │ │ │ ├── OSP_DENY_RSP.h │ │ │ │ ├── OSP_DVM_LC_CALL_TERM.cpp │ │ │ │ ├── OSP_DVM_LC_CALL_TERM.h │ │ │ │ ├── OSP_GRP_AFF_Q.cpp │ │ │ │ ├── OSP_GRP_AFF_Q.h │ │ │ │ ├── OSP_GRP_VCH_GRANT_UPD.cpp │ │ │ │ ├── OSP_GRP_VCH_GRANT_UPD.h │ │ │ │ ├── OSP_IDEN_UP.cpp │ │ │ │ ├── OSP_IDEN_UP.h │ │ │ │ ├── OSP_IDEN_UP_VU.cpp │ │ │ │ ├── OSP_IDEN_UP_VU.h │ │ │ │ ├── OSP_LOC_REG_RSP.cpp │ │ │ │ ├── OSP_LOC_REG_RSP.h │ │ │ │ ├── OSP_MOT_CC_BSI.cpp │ │ │ │ ├── OSP_MOT_CC_BSI.h │ │ │ │ ├── OSP_MOT_GRG_ADD.cpp │ │ │ │ ├── OSP_MOT_GRG_ADD.h │ │ │ │ ├── OSP_MOT_GRG_DEL.cpp │ │ │ │ ├── OSP_MOT_GRG_DEL.h │ │ │ │ ├── OSP_MOT_GRG_VCH_GRANT.cpp │ │ │ │ ├── OSP_MOT_GRG_VCH_GRANT.h │ │ │ │ ├── OSP_MOT_GRG_VCH_UPD.cpp │ │ │ │ ├── OSP_MOT_GRG_VCH_UPD.h │ │ │ │ ├── OSP_MOT_PSH_CCH.cpp │ │ │ │ ├── OSP_MOT_PSH_CCH.h │ │ │ │ ├── OSP_NET_STS_BCAST.cpp │ │ │ │ ├── OSP_NET_STS_BCAST.h │ │ │ │ ├── OSP_QUE_RSP.cpp │ │ │ │ ├── OSP_QUE_RSP.h │ │ │ │ ├── OSP_RFSS_STS_BCAST.cpp │ │ │ │ ├── OSP_RFSS_STS_BCAST.h │ │ │ │ ├── OSP_SCCB.cpp │ │ │ │ ├── OSP_SCCB.h │ │ │ │ ├── OSP_SCCB_EXP.cpp │ │ │ │ ├── OSP_SCCB_EXP.h │ │ │ │ ├── OSP_SNDCP_CH_ANN.cpp │ │ │ │ ├── OSP_SNDCP_CH_ANN.h │ │ │ │ ├── OSP_SNDCP_CH_GNT.cpp │ │ │ │ ├── OSP_SNDCP_CH_GNT.h │ │ │ │ ├── OSP_SYNC_BCAST.cpp │ │ │ │ ├── OSP_SYNC_BCAST.h │ │ │ │ ├── OSP_SYS_SRV_BCAST.cpp │ │ │ │ ├── OSP_SYS_SRV_BCAST.h │ │ │ │ ├── OSP_TIME_DATE_ANN.cpp │ │ │ │ ├── OSP_TIME_DATE_ANN.h │ │ │ │ ├── OSP_TSBK_RAW.cpp │ │ │ │ ├── OSP_TSBK_RAW.h │ │ │ │ ├── OSP_UU_VCH_GRANT_UPD.cpp │ │ │ │ ├── OSP_UU_VCH_GRANT_UPD.h │ │ │ │ ├── OSP_U_DEREG_ACK.cpp │ │ │ │ ├── OSP_U_DEREG_ACK.h │ │ │ │ ├── OSP_U_REG_CMD.cpp │ │ │ │ ├── OSP_U_REG_CMD.h │ │ │ │ ├── TSBKFactory.cpp │ │ │ │ ├── TSBKFactory.h │ │ │ │ └── mbt │ │ │ │ ├── MBT_IOSP_ACK_RSP.cpp │ │ │ │ ├── MBT_IOSP_ACK_RSP.h │ │ │ │ ├── MBT_IOSP_CALL_ALRT.cpp │ │ │ │ ├── MBT_IOSP_CALL_ALRT.h │ │ │ │ ├── MBT_IOSP_EXT_FNCT.cpp │ │ │ │ ├── MBT_IOSP_EXT_FNCT.h │ │ │ │ ├── MBT_IOSP_GRP_AFF.cpp │ │ │ │ ├── MBT_IOSP_GRP_AFF.h │ │ │ │ ├── MBT_IOSP_MSG_UPDT.cpp │ │ │ │ ├── MBT_IOSP_MSG_UPDT.h │ │ │ │ ├── MBT_IOSP_STS_UPDT.cpp │ │ │ │ ├── MBT_IOSP_STS_UPDT.h │ │ │ │ ├── MBT_ISP_AUTH_RESP_M.cpp │ │ │ │ ├── MBT_ISP_AUTH_RESP_M.h │ │ │ │ ├── MBT_ISP_AUTH_SU_DMD.cpp │ │ │ │ ├── MBT_ISP_AUTH_SU_DMD.h │ │ │ │ ├── MBT_ISP_CAN_SRV_REQ.cpp │ │ │ │ ├── MBT_ISP_CAN_SRV_REQ.h │ │ │ │ ├── MBT_ISP_GRP_AFF_Q_RSP.cpp │ │ │ │ ├── MBT_ISP_GRP_AFF_Q_RSP.h │ │ │ │ ├── MBT_OSP_ADJ_STS_BCAST.cpp │ │ │ │ ├── MBT_OSP_ADJ_STS_BCAST.h │ │ │ │ ├── MBT_OSP_AUTH_DMD.cpp │ │ │ │ ├── MBT_OSP_AUTH_DMD.h │ │ │ │ ├── MBT_OSP_GRP_VCH_GRANT.cpp │ │ │ │ ├── MBT_OSP_GRP_VCH_GRANT.h │ │ │ │ ├── MBT_OSP_NET_STS_BCAST.cpp │ │ │ │ ├── MBT_OSP_NET_STS_BCAST.h │ │ │ │ ├── MBT_OSP_RFSS_STS_BCAST.cpp │ │ │ │ ├── MBT_OSP_RFSS_STS_BCAST.h │ │ │ │ ├── MBT_OSP_UU_VCH_GRANT.cpp │ │ │ │ └── MBT_OSP_UU_VCH_GRANT.h │ │ └── sndcp │ │ │ ├── SNDCPCtxActAccept.cpp │ │ │ ├── SNDCPCtxActAccept.h │ │ │ ├── SNDCPCtxActReject.cpp │ │ │ ├── SNDCPCtxActReject.h │ │ │ ├── SNDCPCtxActRequest.cpp │ │ │ ├── SNDCPCtxActRequest.h │ │ │ ├── SNDCPCtxDeactivation.cpp │ │ │ ├── SNDCPCtxDeactivation.h │ │ │ ├── SNDCPFactory.cpp │ │ │ ├── SNDCPFactory.h │ │ │ ├── SNDCPPacket.cpp │ │ │ └── SNDCPPacket.h │ ├── yaml │ │ ├── Yaml.cpp │ │ └── Yaml.h │ └── zlib │ │ ├── Compression.cpp │ │ ├── Compression.h │ │ ├── adler32.c │ │ ├── crc32.c │ │ ├── crc32.h │ │ ├── deflate.c │ │ ├── deflate.h │ │ ├── infback.c │ │ ├── inffast.c │ │ ├── inffast.h │ │ ├── inffixed.h │ │ ├── inflate.c │ │ ├── inflate.h │ │ ├── inftrees.c │ │ ├── inftrees.h │ │ ├── trees.c │ │ ├── trees.h │ │ ├── zconf.h │ │ ├── zlib.h │ │ ├── zutil.c │ │ └── zutil.h ├── fne │ ├── ActivityLog.cpp │ ├── ActivityLog.h │ ├── CMakeLists.txt │ ├── CryptoContainer.cpp │ ├── CryptoContainer.h │ ├── Defines.h │ ├── FNEMain.cpp │ ├── FNEMain.h │ ├── HostFNE.cpp │ ├── HostFNE.h │ ├── network │ │ ├── DiagNetwork.cpp │ │ ├── DiagNetwork.h │ │ ├── FNENetwork.cpp │ │ ├── FNENetwork.h │ │ ├── PeerNetwork.cpp │ │ ├── PeerNetwork.h │ │ ├── RESTAPI.cpp │ │ ├── RESTAPI.h │ │ ├── RESTDefines.h │ │ ├── callhandler │ │ │ ├── TagDMRData.cpp │ │ │ ├── TagDMRData.h │ │ │ ├── TagNXDNData.cpp │ │ │ ├── TagNXDNData.h │ │ │ ├── TagP25Data.cpp │ │ │ ├── TagP25Data.h │ │ │ └── packetdata │ │ │ │ ├── DMRPacketData.cpp │ │ │ │ ├── DMRPacketData.h │ │ │ │ ├── P25PacketData.cpp │ │ │ │ └── P25PacketData.h │ │ └── influxdb │ │ │ ├── InfluxDB.cpp │ │ │ └── InfluxDB.h │ └── xml │ │ ├── rapidxml.h │ │ ├── rapidxml_print.h │ │ └── rapidxml_utils.h ├── host │ ├── ActivityLog.cpp │ ├── ActivityLog.h │ ├── CMakeLists.txt │ ├── Console.cpp │ ├── Console.h │ ├── Defines.h │ ├── Host.Config.cpp │ ├── Host.DMR.cpp │ ├── Host.NXDN.cpp │ ├── Host.P25.cpp │ ├── Host.cpp │ ├── Host.h │ ├── HostMain.cpp │ ├── HostMain.h │ ├── calibrate │ │ ├── HostCal.cpp │ │ └── HostCal.h │ ├── dmr │ │ ├── Control.cpp │ │ ├── Control.h │ │ ├── Slot.cpp │ │ ├── Slot.h │ │ ├── lc │ │ │ └── csbk │ │ │ │ ├── CSBK_DVM_GIT_HASH.cpp │ │ │ │ └── CSBK_DVM_GIT_HASH.h │ │ ├── lookups │ │ │ ├── DMRAffiliationLookup.cpp │ │ │ └── DMRAffiliationLookup.h │ │ └── packet │ │ │ ├── ControlSignaling.cpp │ │ │ ├── ControlSignaling.h │ │ │ ├── Data.cpp │ │ │ ├── Data.h │ │ │ ├── Voice.cpp │ │ │ └── Voice.h │ ├── modem │ │ ├── Modem.cpp │ │ ├── Modem.h │ │ ├── ModemV24.cpp │ │ ├── ModemV24.h │ │ └── port │ │ │ ├── IModemPort.cpp │ │ │ ├── IModemPort.h │ │ │ ├── ISerialPort.cpp │ │ │ ├── ISerialPort.h │ │ │ ├── ModemNullPort.cpp │ │ │ ├── ModemNullPort.h │ │ │ ├── PseudoPTYPort.cpp │ │ │ ├── PseudoPTYPort.h │ │ │ ├── UARTPort.cpp │ │ │ ├── UARTPort.h │ │ │ ├── UDPPort.cpp │ │ │ ├── UDPPort.h │ │ │ └── specialized │ │ │ ├── V24UDPPort.cpp │ │ │ └── V24UDPPort.h │ ├── network │ │ ├── RESTAPI.cpp │ │ ├── RESTAPI.h │ │ ├── RESTDefines.h │ │ └── RPCDefines.h │ ├── nxdn │ │ ├── Audio.cpp │ │ ├── Audio.h │ │ ├── Control.cpp │ │ ├── Control.h │ │ └── packet │ │ │ ├── ControlSignaling.cpp │ │ │ ├── ControlSignaling.h │ │ │ ├── Data.cpp │ │ │ ├── Data.h │ │ │ ├── Voice.cpp │ │ │ └── Voice.h │ ├── p25 │ │ ├── Control.cpp │ │ ├── Control.h │ │ ├── lc │ │ │ └── tsbk │ │ │ │ ├── OSP_DVM_GIT_HASH.cpp │ │ │ │ └── OSP_DVM_GIT_HASH.h │ │ ├── lookups │ │ │ ├── P25AffiliationLookup.cpp │ │ │ └── P25AffiliationLookup.h │ │ └── packet │ │ │ ├── ControlSignaling.cpp │ │ │ ├── ControlSignaling.h │ │ │ ├── Data.cpp │ │ │ ├── Data.h │ │ │ ├── Voice.cpp │ │ │ └── Voice.h │ └── setup │ │ ├── AdjustWndBase.h │ │ ├── BERDisplayWnd.h │ │ ├── ChannelConfigSetWnd.h │ │ ├── CloseWndBase.h │ │ ├── FIFOBufferAdjustWnd.h │ │ ├── HSBandwidthAdjustWnd.h │ │ ├── HSGainAdjustWnd.h │ │ ├── HostSetup.cpp │ │ ├── HostSetup.h │ │ ├── LevelAdjustWnd.h │ │ ├── LogDisplayWnd.h │ │ ├── LoggingAndDataSetWnd.h │ │ ├── ModemStatusWnd.h │ │ ├── SetupApplication.h │ │ ├── SetupMainWnd.h │ │ ├── SiteParamSetWnd.h │ │ ├── SymbLevelAdjustWnd.h │ │ └── SystemConfigSetWnd.h ├── monitor │ ├── CMakeLists.txt │ ├── Defines.h │ ├── FDblDialog.h │ ├── InhibitSubscriberWnd.h │ ├── LogDisplayWnd.h │ ├── MonitorApplication.h │ ├── MonitorMain.cpp │ ├── MonitorMain.h │ ├── MonitorMainWnd.h │ ├── NodeStatusWnd.h │ ├── PageSubscriberWnd.h │ ├── RadioCheckSubscriberWnd.h │ ├── SelectedNodeWnd.h │ ├── TransmitWndBase.h │ └── UninhibitSubscriberWnd.h ├── patch │ ├── ActivityLog.cpp │ ├── ActivityLog.h │ ├── CMakeLists.txt │ ├── Defines.h │ ├── HostPatch.cpp │ ├── HostPatch.h │ ├── PatchMain.cpp │ ├── PatchMain.h │ └── network │ │ ├── PeerNetwork.cpp │ │ └── PeerNetwork.h ├── peered │ ├── CMakeLists.txt │ ├── CloseWndBase.h │ ├── Defines.h │ ├── FDblDialog.h │ ├── LogDisplayWnd.h │ ├── PeerEdApplication.h │ ├── PeerEdMain.cpp │ ├── PeerEdMain.h │ ├── PeerEdMainWnd.h │ ├── PeerEditWnd.h │ └── PeerListWnd.h ├── remote │ ├── CMakeLists.txt │ ├── Defines.h │ ├── RESTClient.cpp │ ├── RESTClient.h │ └── RESTClientMain.cpp ├── sysview │ ├── AffListWnd.h │ ├── CMakeLists.txt │ ├── Defines.h │ ├── DynRegroupSubscriberWnd.h │ ├── FDblDialog.h │ ├── HostWS.cpp │ ├── HostWS.h │ ├── InhibitSubscriberWnd.h │ ├── LogDisplayWnd.h │ ├── NodeStatusWnd.h │ ├── PageSubscriberWnd.h │ ├── PeerListWnd.h │ ├── RadioCheckSubscriberWnd.h │ ├── SysViewApplication.h │ ├── SysViewMain.cpp │ ├── SysViewMain.h │ ├── SysViewMainWnd.h │ ├── TransmitWndBase.h │ ├── UninhibitSubscriberWnd.h │ ├── network │ │ ├── PeerNetwork.cpp │ │ └── PeerNetwork.h │ └── p25 │ │ └── tsbk │ │ ├── OSP_GRP_AFF.cpp │ │ └── OSP_GRP_AFF.h ├── tged │ ├── CMakeLists.txt │ ├── CloseWndBase.h │ ├── Defines.h │ ├── FDblDialog.h │ ├── LogDisplayWnd.h │ ├── PeerEntryWnd.h │ ├── TGEdApplication.h │ ├── TGEdMain.cpp │ ├── TGEdMain.h │ ├── TGEdMainWnd.h │ ├── TGEditPeerListWnd.h │ ├── TGEditRIDListWnd.h │ ├── TGEditWnd.h │ └── TGListWnd.h └── vocoder │ ├── CMakeLists.txt │ ├── MBEDecoder.cpp │ ├── MBEDecoder.h │ ├── MBEEncoder.cpp │ ├── MBEEncoder.h │ ├── ambe3600x2250.c │ ├── ambe3600x2400.c │ ├── ambe3600x2400_const.h │ ├── ambe3600x2450.c │ ├── ambe3600x2450_const.h │ ├── ecc.c │ ├── ecc_const.h │ ├── imbe │ ├── aux_sub.cpp │ ├── aux_sub.h │ ├── basic_op.cpp │ ├── basic_op.h │ ├── ch_decode.cpp │ ├── ch_decode.h │ ├── ch_encode.cpp │ ├── ch_encode.h │ ├── dc_rmv.cpp │ ├── dc_rmv.h │ ├── decode.cpp │ ├── dsp_sub.cpp │ ├── encode.cpp │ ├── globals.h │ ├── imbe.h │ ├── imbe_vocoder.cpp │ ├── imbe_vocoder.h │ ├── math_sub.cpp │ ├── math_sub.h │ ├── pe_lpf.cpp │ ├── pe_lpf.h │ ├── pitch_est.cpp │ ├── pitch_est.h │ ├── pitch_ref.cpp │ ├── pitch_ref.h │ ├── qnt_sub.cpp │ ├── qnt_sub.h │ ├── rand_gen.cpp │ ├── rand_gen.h │ ├── sa_decode.cpp │ ├── sa_encode.cpp │ ├── sa_enh.cpp │ ├── sa_enh.h │ ├── tbls.cpp │ ├── tbls.h │ ├── typedef.h │ ├── typedefs.h │ ├── uv_synt.cpp │ ├── v_synt.cpp │ └── v_uv_det.cpp │ ├── imbe7200x4400.c │ ├── imbe7200x4400_const.h │ ├── mbe.c │ ├── mbe.h │ └── mbe_const.h ├── tests ├── CMakeLists.txt ├── Defines.h ├── crypto │ ├── AES_Crypto_Test.cpp │ ├── AES_LLA_AM1_Test.cpp │ ├── AES_LLA_AM2_Test.cpp │ ├── AES_LLA_AM3_Test.cpp │ ├── AES_LLA_AM4_Test.cpp │ └── RC4_Crypto_Test.cpp ├── edac │ ├── CRC_12_Test.cpp │ ├── CRC_15_Test.cpp │ ├── CRC_16_Test.cpp │ ├── CRC_32_Test.cpp │ ├── CRC_6_Test.cpp │ ├── CRC_8_Test.cpp │ ├── CRC_9_Test.cpp │ ├── CRC_CCITT_161_Test.cpp │ └── CRC_CCITT_162_Test.cpp ├── nulltest.cpp ├── nxdn │ └── AMBE_FEC_Test.cpp └── p25 │ ├── HDU_RS_Test.cpp │ ├── LDU1_RS_Test.cpp │ └── LDU2_RS_Test.cpp └── tools ├── colorize-fne.sh ├── config_annotator.py ├── dvm-watchdog.sh ├── fne-watchdog.sh ├── start-dvm-fne.sh ├── start-dvm.sh ├── stop-dvm.sh └── stop-watchdog.sh /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore built binaries 2 | build/ 3 | build*/ 4 | dvmcmd 5 | dvmhost 6 | dvmdfsi 7 | 8 | # Ignore CMake temporary files 9 | CMakeLists.txt.user 10 | CMakeCache.txt 11 | CMakeFiles 12 | CMakeScripts 13 | CPackConfig.cmake 14 | CPackSourceConfig.cmake 15 | Voice.plist 16 | Testing 17 | cmake_install.cmake 18 | install_manifest.txt 19 | compile_commands.json 20 | CTestTestfile.cmake 21 | _deps 22 | 23 | # Ignore thumbnails created by windows 24 | Thumbs.db 25 | 26 | # Ignore files created by clang-check 27 | *.plist 28 | 29 | # Ignore files build by Visual Studio 30 | *.obj 31 | *.pdb 32 | *.mdb # Mono debug file 33 | *.user 34 | *.aps 35 | *.pch 36 | *.vspscc 37 | *_i.c 38 | *_p.c 39 | *.ncb 40 | *.suo 41 | *.tlb 42 | *.tlh 43 | *.bak 44 | *.cache 45 | *.ilk 46 | *.log 47 | [Bb]in 48 | [Dd]ebug*/ 49 | *.lib 50 | *.sbr 51 | [Oo]bj*/ 52 | [Rr]elease*/ 53 | [R]elease*/ 54 | _ReSharper*/ 55 | [Tt]est[Rr]esult* 56 | *.sdf 57 | *.opensdf 58 | *.userprefs 59 | build.mk 60 | *.prv.xml 61 | *.pub.xml 62 | build/ 63 | .vscode/ 64 | package/ 65 | *.ini 66 | .vs 67 | .idea/ 68 | 69 | # Prerequisites 70 | *.d 71 | 72 | # Compiled Object files 73 | *.slo 74 | *.lo 75 | *.o 76 | *.obj 77 | 78 | # Precompiled Headers 79 | *.gch 80 | *.pch 81 | 82 | # Compiled Dynamic libraries 83 | *.so 84 | *.dylib 85 | *.dll 86 | 87 | # Fortran module files 88 | *.mod 89 | *.smod 90 | 91 | # Compiled Static libraries 92 | *.lai 93 | *.la 94 | *.a 95 | *.lib 96 | 97 | # Executables 98 | *.exe 99 | *.out 100 | *.app 101 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "src/fw/modem"] 2 | path = src/fw/modem 3 | url = https://github.com/DVMProject/dvmfirmware.git 4 | [submodule "src/fw/hotspot"] 5 | path = src/fw/hotspot 6 | url = https://github.com/DVMProject/dvmfirmware-hs.git 7 | [submodule "src/fw/v24"] 8 | path = src/fw/v24 9 | url = https://github.com/dvmproject/dvmv24.git 10 | -------------------------------------------------------------------------------- /cmake/FindASIO.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Finds the ASIO library. 3 | # 4 | # from https://think-async.com/Asio/ 5 | # 6 | # This will define the following variables 7 | # 8 | # ASIO_FOUND 9 | # ASIO_INCLUDE_DIR 10 | # 11 | # and the following imported targets 12 | # 13 | # asio::asio 14 | # 15 | 16 | find_package(Threads QUIET) 17 | if (Threads_FOUND) 18 | find_path(ASIO_INCLUDE_DIR asio.hpp) 19 | 20 | mark_as_advanced(ASIO_FOUND ASIO_INCLUDE_DIR) 21 | 22 | include(FindPackageHandleStandardArgs) 23 | find_package_handle_standard_args(ASIO 24 | FOUND_VAR ASIO_FOUND 25 | REQUIRED_VARS ASIO_INCLUDE_DIR 26 | ) 27 | 28 | if(ASIO_FOUND AND NOT TARGET asio::asio) 29 | add_library(asio::asio INTERFACE IMPORTED) 30 | target_include_directories(asio::asio INTERFACE ${ASIO_INCLUDE_DIR}) 31 | target_compile_definitions(asio::asio INTERFACE "ASIO_STANDALONE") 32 | target_link_libraries(asio::asio INTERFACE Threads::Threads) 33 | endif() 34 | else() 35 | if(asio_FIND_REQUIRED) 36 | message(FATAL_ERROR "asio requires Threads, which couldn't be found.") 37 | elseif(asio_FIND_QUIETLY) 38 | message(STATUS "asio requires Threads, which couldn't be found.") 39 | endif() 40 | endif() 41 | -------------------------------------------------------------------------------- /configs/RSSI.dat: -------------------------------------------------------------------------------- 1 | # This file maps the raw RSSI values to dBm values to send to the DMR network. A number of data 2 | # points should be entered and the software will use those to work out the in-between values. 3 | # 4 | # The format of the file is: 5 | # Raw RSSI Value dBm Value 6 | # 7 | # For example 8 | # 1134 -90 9 | # 1123 -100 10 | # 1000 -109 11 | # 12 | -------------------------------------------------------------------------------- /configs/iden_table.example.dat: -------------------------------------------------------------------------------- 1 | # 2 | # This file sets the valid bandplan identity table. 3 | # (It is recommended to use the included iden_channel_calc.py Python script 4 | # to generate entries for this file.) 5 | # 6 | # ChId,Base Freq,Spacing (khz),Input Offset (mhz),Bandwidth (khz), 7 | 0,851006250,6.25,-45.000,12.5, 8 | 1,762006250,6.25,30.000,12.5, 9 | 15,935001250,6.25,-39.00000,12.5, 10 | 2,450000000,6.25,5.000,12.5, 11 | 3,146000000,6.25,1.000,12.5, 12 | -------------------------------------------------------------------------------- /configs/monitor-config.example.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Digital Voice Modem - Monitor Configuration 3 | # 4 | 5 | # 6 | # Channel Identity Table Configuration 7 | # 8 | iden_table: 9 | # Full path to the identity table file. 10 | file: iden_table.dat 11 | # Amount of time between updates of identity table file. (minutes) 12 | time: 30 13 | 14 | # 15 | # DVM Channels to Monitor 16 | # 17 | channels: 18 | # REST API IP Address for channel. 19 | - restAddress: 127.0.0.1 20 | # REST API Port number for channel. 21 | restPort: 9990 22 | # REST API access password for channel. 23 | restPassword: "PASSWORD" 24 | # Flag indicating whether or not REST API is operating in SSL mode. 25 | restSsl: false 26 | -------------------------------------------------------------------------------- /configs/peer_list.example.dat: -------------------------------------------------------------------------------- 1 | # 2 | # This file sets the valid peer IDs allowed on a FNE. 3 | # 4 | # Entry Format: "Peer ID,Peer Password,Peer Link (1 = Enabled / 0 = Disabled),Peer Alias (optional),Can Request Keys (1 = Enabled / 0 = Disabled)," 5 | #1234,,0,,1, 6 | #5678,MYSECUREPASSWORD,0,,0, 7 | #9876,MYSECUREPASSWORD,1,,0, 8 | #5432,MYSECUREPASSWORD,,Peer Alias 1,0, 9 | #1012,MYSECUREPASSWORD,1,Peer Alias 2,1, 10 | -------------------------------------------------------------------------------- /configs/rid_acl.example.dat: -------------------------------------------------------------------------------- 1 | # 2 | # This file sets the valid Radio IDs allowed on a repeater. 3 | # 4 | # Entry Format: "RID,Enabled (1 = Enabled / 0 = Disabled),Optional Alias,Optional IP Address," 5 | # 6 | #1234,1,RID Alias,IP Address, 7 | -------------------------------------------------------------------------------- /contrib/openssl_cross_patch.RPI_ARM.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DVMProject/dvmhost/fcdec00f32ae96cd47e823f62b67b563a987b510/contrib/openssl_cross_patch.RPI_ARM.tar.gz -------------------------------------------------------------------------------- /contrib/vscode/c_cpp_properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "compileCommands": "${workspaceFolder}/build/compile_commands.json", 5 | "configurationProvider": "ms-vscode.cmake-tools" 6 | } 7 | ], 8 | "version": 4 9 | } -------------------------------------------------------------------------------- /contrib/vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | // Use IntelliSense to find out which attributes exist for C# debugging 9 | // Use hover for the description of the existing attributes 10 | // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md 11 | "name": "Debug", 12 | "type": "cppdbg", 13 | "request": "launch", 14 | // If you have changed target frameworks, make sure to update the program path. 15 | "program": "${workspaceFolder}/build/dvmhost", 16 | "args": ["-c", "./config.yml", "-f"], 17 | "cwd": "${workspaceFolder}/build", 18 | "stopAtEntry": false, 19 | "logging": { 20 | "moduleLoad": true, 21 | "trace": true 22 | } 23 | }, 24 | { 25 | // Use IntelliSense to find out which attributes exist for C# debugging 26 | // Use hover for the description of the existing attributes 27 | // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md 28 | "name": "Debug FNE", 29 | "type": "cppdbg", 30 | "request": "launch", 31 | // If you have changed target frameworks, make sure to update the program path. 32 | "program": "${workspaceFolder}/build/dvmfne", 33 | "args": ["-c", "./fne-config.yml", "-f"], 34 | "cwd": "${workspaceFolder}/build", 35 | "stopAtEntry": false, 36 | "logging": { 37 | "moduleLoad": true, 38 | "trace": true 39 | } 40 | } 41 | ] 42 | } 43 | -------------------------------------------------------------------------------- /debian/postinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then 4 | useradd --user-group -M --system dvmhost --shell /bin/false || true 5 | usermod --groups dialout --append dvmhost || true 6 | chown dvmhost:dvmhost /usr/local/etc/config.yml 7 | chown dvmhost:dvmhost /usr/local/etc/iden_table.dat 8 | chown dvmhost:dvmhost /usr/local/etc/rid_acl.dat 9 | chown dvmhost:dvmhost /usr/local/etc/tg_acl.dat 10 | chown dvmhost:dvmhost /usr/local/etc/log 11 | 12 | sed -i 's/filePath: ./filePath: \\\\/var\\\\/log\\\\//' /usr/local/etc/config.example.yml\" 13 | sed -i 's/activityFilePath: ./activityFilePath: \\\\/var\\\\/log\\\\//' /usr/local/etc/config.example.yml\" 14 | sed -i 's/file: iden_table.dat/file: \\\\/usr\\\\/local\\\\/etc\\\\/iden_table.dat/' /usr/local/etc/config.example.yml\" 15 | sed -i 's/file: rid_acl.dat/file: \\\\/usr\\\\/local\\\\/etc\\\\/rid_acl.dat/' /usr/local/etc/config.example.yml\" 16 | sed -i 's/file: tg_acl.dat/file: \\\\/usr\\\\/local\\\\/etc\\\\/tg_acl.dat/' /usr/local/etc/config.example.yml\" 17 | 18 | # This will only remove masks created by d-s-h on package removal. 19 | deb-systemd-helper unmask 'dvmhost.service' >/dev/null || true 20 | 21 | # was-enabled defaults to true, so new installations run enable. 22 | if deb-systemd-helper --quiet was-enabled 'dvmhost.service'; then 23 | # Enables the unit on first installation, creates new 24 | # symlinks on upgrades if the unit file has changed. 25 | deb-systemd-helper enable 'dvmhost.service' >/dev/null || true 26 | else 27 | # Update the statefile to add new symlinks (if any), which need to be 28 | # cleaned up on purge. Also remove old symlinks. 29 | deb-systemd-helper update-state 'dvmhost.service' >/dev/null || true 30 | fi 31 | fi 32 | -------------------------------------------------------------------------------- /debian/postrm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | if [ "$1" = "remove" ]; then 4 | userdel dvmhost || true 5 | groupdel dvmhost || true 6 | 7 | if [ -x "/usr/bin/deb-systemd-helper" ]; then 8 | deb-systemd-helper mask 'dvmhost.service' >/dev/null || true 9 | fi 10 | fi 11 | 12 | if [ "$1" = "purge" ]; then 13 | userdel dvmhost || true 14 | groupdel dvmhost || true 15 | 16 | if [ -x "/usr/bin/deb-systemd-helper" ]; then 17 | deb-systemd-helper purge 'dvmhost.service' >/dev/null || true 18 | deb-systemd-helper unmask 'dvmhost.service' >/dev/null || true 19 | fi 20 | fi 21 | -------------------------------------------------------------------------------- /docs/TN.Template.adoc: -------------------------------------------------------------------------------- 1 | = Digital Voice Modem 2 | 3 | == Technical Note 4 | === ** 5 | 6 | Document Identifier: 7 | 8 | Author: 9 | 10 | Editors: 11 | 12 | Contributors: 13 | 14 | Abstract: 15 | 16 | Status: 17 | 18 | == 1. Introduction 19 | _Place a general summary of the technical note here to serve as executive summary enticing the reader to read on._ 20 | 21 | == 2. Technical Note 22 | _Place a general summary of the technical note here to serve as executive summary enticing the reader to read on._ 23 | 24 | === 2.1 Definitions 25 | _Use this section to list any technical definitions required by the reader in order to understand the proposed technical note below._ 26 | 27 | === 2.2 __ 28 | _Use this section and all following sections to describe the content of the technical note._ -------------------------------------------------------------------------------- /doxygen/INCLUDE_EMPTY_DIRECTORY: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DVMProject/dvmhost/fcdec00f32ae96cd47e823f62b67b563a987b510/doxygen/INCLUDE_EMPTY_DIRECTORY -------------------------------------------------------------------------------- /linux/dvmhost.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=DVMProject Host Radio Service 3 | After=syslog.target network.target 4 | 5 | [Service] 6 | User=dvmhost 7 | Type=forking 8 | ExecStart=/usr/local/bin/dvmhost -c /usr/local/etc/config.yml 9 | Restart=on-abnormal 10 | 11 | [Install] 12 | WantedBy=multi-user.target 13 | -------------------------------------------------------------------------------- /repo/Basic_P25_Network_Diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DVMProject/dvmhost/fcdec00f32ae96cd47e823f62b67b563a987b510/repo/Basic_P25_Network_Diagram.png -------------------------------------------------------------------------------- /src/bridge/ActivityLog.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Bridge 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2024 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | /** 11 | * @file ActivityLog.h 12 | * @ingroup bridge 13 | * @file ActivityLog.cpp 14 | * @ingroup bridge 15 | */ 16 | #if !defined(__ACTIVITY_LOG_H__) 17 | #define __ACTIVITY_LOG_H__ 18 | 19 | #include "Defines.h" 20 | 21 | #include 22 | 23 | // --------------------------------------------------------------------------- 24 | // Global Functions 25 | // --------------------------------------------------------------------------- 26 | 27 | /** 28 | * @brief Initializes the activity log. 29 | * @param filePath File path for the log file. 30 | * @param fileRoot Root name for log file. 31 | */ 32 | extern HOST_SW_API bool ActivityLogInitialise(const std::string& filePath, const std::string& fileRoot); 33 | /** 34 | * @brief Finalizes the activity log. 35 | */ 36 | extern HOST_SW_API void ActivityLogFinalise(); 37 | /** 38 | * @brief Writes a new entry to the activity log. 39 | * @param msg String format. 40 | * 41 | * This is a variable argument function. 42 | */ 43 | extern HOST_SW_API void ActivityLog(const char* msg, ...); 44 | 45 | #endif // __ACTIVITY_LOG_H__ 46 | -------------------------------------------------------------------------------- /src/bridge/BridgeMain.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Bridge 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2024 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | /** 11 | * @file BridgeMain.h 12 | * @ingroup bridge 13 | * @file BridgeMain.cpp 14 | * @ingroup bridge 15 | */ 16 | #if !defined(__BRIDGE_MAIN_H__) 17 | #define __BRIDGE_MAIN_H__ 18 | 19 | #include "Defines.h" 20 | #define MINIAUDIO_IMPLEMENTATION 21 | #include "audio/miniaudio.h" 22 | 23 | #include 24 | 25 | // --------------------------------------------------------------------------- 26 | // Externs 27 | // --------------------------------------------------------------------------- 28 | 29 | /** @brief */ 30 | extern int g_signal; 31 | /** @brief */ 32 | extern std::string g_progExe; 33 | /** @brief */ 34 | extern std::string g_iniFile; 35 | /** @brief */ 36 | extern std::string g_lockFile; 37 | 38 | /** @brief (Global) Flag indicating foreground operation. */ 39 | extern bool g_foreground; 40 | /** @brief (Global) Flag indicating the FNE should stop immediately. */ 41 | extern bool g_killed; 42 | 43 | /** @brief Audio Input Device Index. */ 44 | extern int g_inputDevice; 45 | /** @brief Audio Output Device Index. */ 46 | extern int g_outputDevice; 47 | 48 | extern uint8_t* g_gitHashBytes; 49 | 50 | #ifdef _WIN32 51 | extern ma_backend g_backends[]; 52 | extern ma_uint32 g_backendCnt; 53 | #else 54 | extern ma_backend g_backends[]; 55 | extern ma_uint32 g_backendCnt; 56 | #endif 57 | 58 | /** 59 | * @brief Helper to trigger a fatal error message. This will cause the program to terminate 60 | * immediately with an error message. 61 | * 62 | * @param msg String format. 63 | * 64 | * This is a variable argument function. 65 | */ 66 | extern HOST_SW_API void fatal(const char* msg, ...); 67 | 68 | #endif // __BRIDGE_MAIN_H__ 69 | -------------------------------------------------------------------------------- /src/bridge/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0-only 2 | #/* 3 | # * Digital Voice Modem - Bridge 4 | # * GPLv2 Open Source. Use is subject to license terms. 5 | # * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | # * 7 | # * Copyright (C) 2024 Bryan Biedenkapp, N2PLL 8 | # * 9 | # */ 10 | file(GLOB bridge_SRC 11 | "src/bridge/audio/*.h" 12 | "src/bridge/audio/*.c" 13 | 14 | "src/bridge/mdc/*.h" 15 | "src/bridge/mdc/*.c" 16 | 17 | "src/bridge/network/*.h" 18 | "src/bridge/network/*.cpp" 19 | "src/bridge/*.h" 20 | "src/bridge/*.cpp" 21 | ) 22 | -------------------------------------------------------------------------------- /src/bridge/Defines.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Bridge 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2024 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | /** 11 | * @defgroup bridge Bridge 12 | * @brief Digital Voice Modem - Bridge 13 | * @details Analog audio bridge, this provides facilities to convert analog audio into digital audio. 14 | * @ingroup bridge 15 | * 16 | * @file Defines.h 17 | * @ingroup bridge 18 | */ 19 | #if !defined(__DEFINES_H__) 20 | #define __DEFINES_H__ 21 | 22 | #include "common/Defines.h" 23 | 24 | // --------------------------------------------------------------------------- 25 | // Constants 26 | // --------------------------------------------------------------------------- 27 | 28 | #undef __PROG_NAME__ 29 | #define __PROG_NAME__ "Digital Voice Modem (DVM) Bridge" 30 | #undef __EXE_NAME__ 31 | #define __EXE_NAME__ "bridge" 32 | 33 | #undef __NETVER__ 34 | #define __NETVER__ "BRIDGE_R" VERSION_MAJOR VERSION_REV VERSION_MINOR 35 | 36 | #undef DEFAULT_CONF_FILE 37 | #define DEFAULT_CONF_FILE "bridge-config.yml" 38 | #undef DEFAULT_LOCK_FILE 39 | #define DEFAULT_LOCK_FILE "/tmp/dvmbridge.lock" 40 | 41 | #endif // __DEFINES_H__ 42 | -------------------------------------------------------------------------------- /src/bridge/SampleTimeConversion.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Bridge 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2024 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | /** 11 | * @file SampleTimeConversion.h 12 | * @ingroup bridge 13 | */ 14 | #if !defined(__SAMPLE_TIME_CONVERSION_H__) 15 | #define __SAMPLE_TIME_CONVERSION_H__ 16 | 17 | #include "Defines.h" 18 | 19 | // --------------------------------------------------------------------------- 20 | // Class Declaration 21 | // --------------------------------------------------------------------------- 22 | 23 | /** 24 | * @brief 25 | * @ingroup bridge 26 | */ 27 | class HOST_SW_API SampleTimeConvert { 28 | public: 29 | /** 30 | * @brief (ms) to sample count conversion 31 | * @param sampleRate Sample rate. 32 | * @param channels Number of audio channels. 33 | * @param ms Number of milliseconds. 34 | * @returns int Number of samples. 35 | */ 36 | static int ToSamples(uint32_t sampleRate, uint8_t channels, int ms) 37 | { 38 | return (int)(((long)ms) * sampleRate * channels / 1000); 39 | } 40 | 41 | /** 42 | * @brief Sample count to (ms) conversion 43 | * @param sampleRate Sample rate. 44 | * @param channels Number of audio channels. 45 | * @param samples Number of samples. 46 | * @returns int Number of milliseconds. 47 | */ 48 | static int ToMS(uint32_t sampleRate, uint8_t channels, int samples) 49 | { 50 | return (int)(((float)samples / (float)sampleRate / (float)channels) * 1000); 51 | } 52 | }; 53 | 54 | #endif // __SAMPLE_TIME_CONVERSION_H__ 55 | -------------------------------------------------------------------------------- /src/common/dmr/SlotType.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2015,2016 Jonathan Naylor, G4KLX 8 | * Copyright (C) 2024 Bryan Biedenkapp, N2PLL 9 | * 10 | */ 11 | /** 12 | * @file SlotType.h 13 | * @ingroup dmr 14 | * @file SlotType.cpp 15 | * @ingroup dmr 16 | */ 17 | #if !defined(__DMR_SLOT_TYPE_H__) 18 | #define __DMR_SLOT_TYPE_H__ 19 | 20 | #include "common/Defines.h" 21 | #include "common/dmr/DMRDefines.h" 22 | 23 | namespace dmr 24 | { 25 | // --------------------------------------------------------------------------- 26 | // Class Declaration 27 | // --------------------------------------------------------------------------- 28 | 29 | /** 30 | * @brief Represents DMR slot type. 31 | * @ingroup dmr 32 | */ 33 | class HOST_SW_API SlotType { 34 | public: 35 | /** 36 | * @brief Initializes a new instance of the SlotType class. 37 | */ 38 | SlotType(); 39 | /** 40 | * @brief Finalizes a instance of the SlotType class. 41 | */ 42 | ~SlotType(); 43 | 44 | /** 45 | * @brief Decodes DMR slot type. 46 | * @param[in] data Buffer containing DMR slot type. 47 | */ 48 | void decode(const uint8_t* data); 49 | /** 50 | * @brief Encodes DMR slot type. 51 | * @param[out] data Buffer to encode DMR slot type. 52 | */ 53 | void encode(uint8_t* data) const; 54 | 55 | public: 56 | /** 57 | * @brief DMR access color code. 58 | */ 59 | DECLARE_PROPERTY(uint8_t, colorCode, ColorCode); 60 | 61 | /** 62 | * @brief Slot data type. 63 | */ 64 | DECLARE_PROPERTY(defines::DataType::E, dataType, DataType); 65 | }; 66 | } // namespace dmr 67 | 68 | #endif // __DMR_SLOT_TYPE_H__ 69 | -------------------------------------------------------------------------------- /src/common/dmr/Sync.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2015,2016 Jonathan Naylor, G4KLX 8 | * 9 | */ 10 | #include "Defines.h" 11 | #include "dmr/DMRDefines.h" 12 | #include "dmr/Sync.h" 13 | 14 | using namespace dmr; 15 | using namespace dmr::defines; 16 | 17 | #include 18 | 19 | // --------------------------------------------------------------------------- 20 | // Static Class Members 21 | // --------------------------------------------------------------------------- 22 | 23 | /* Helper to append DMR data sync bytes to the passed buffer. */ 24 | 25 | void Sync::addDMRDataSync(uint8_t* data, bool duplex) 26 | { 27 | assert(data != nullptr); 28 | 29 | if (duplex) { 30 | for (uint32_t i = 0U; i < 7U; i++) 31 | data[i + 13U] = (data[i + 13U] & ~SYNC_MASK[i]) | BS_SOURCED_DATA_SYNC[i]; 32 | } 33 | else { 34 | for (uint32_t i = 0U; i < 7U; i++) 35 | data[i + 13U] = (data[i + 13U] & ~SYNC_MASK[i]) | MS_SOURCED_DATA_SYNC[i]; 36 | } 37 | } 38 | 39 | /* Helper to append DMR voice sync bytes to the passed buffer. */ 40 | 41 | void Sync::addDMRAudioSync(uint8_t* data, bool duplex) 42 | { 43 | assert(data != nullptr); 44 | 45 | if (duplex) { 46 | for (uint32_t i = 0U; i < 7U; i++) 47 | data[i + 13U] = (data[i + 13U] & ~SYNC_MASK[i]) | BS_SOURCED_AUDIO_SYNC[i]; 48 | } 49 | else { 50 | for (uint32_t i = 0U; i < 7U; i++) 51 | data[i + 13U] = (data[i + 13U] & ~SYNC_MASK[i]) | MS_SOURCED_AUDIO_SYNC[i]; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/common/dmr/Sync.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2015,2016 Jonathan Naylor, G4KLX 8 | * 9 | */ 10 | /** 11 | * @file Sync.h 12 | * @ingroup dmr 13 | * @file Sync.cpp 14 | * @ingroup dmr 15 | */ 16 | #if !defined(__DMR_SYNC_H__) 17 | #define __DMR_SYNC_H__ 18 | 19 | #include "common/Defines.h" 20 | 21 | namespace dmr 22 | { 23 | // --------------------------------------------------------------------------- 24 | // Class Declaration 25 | // --------------------------------------------------------------------------- 26 | 27 | /** 28 | * @brief Helper class for generating DMR sync data. 29 | * @ingroup dmr 30 | */ 31 | class HOST_SW_API Sync { 32 | public: 33 | /** 34 | * @brief Helper to append DMR data sync bytes to the passed buffer. 35 | * @param data Buffer to append DMR data sync bytes to. 36 | * @param duplex Flag indicating whether or not duplex sync is required. 37 | */ 38 | static void addDMRDataSync(uint8_t* data, bool duplex); 39 | /** 40 | * @brief Helper to append DMR voice sync bytes to the passed buffer. 41 | * @param data Buffer to append DMR voice sync bytes to. 42 | * @param duplex Flag indicating whether or not duplex sync is required. 43 | */ 44 | static void addDMRAudioSync(uint8_t* data, bool duplex); 45 | }; 46 | } // namespace dmr 47 | 48 | #endif // __DMR_SYNC_H__ 49 | -------------------------------------------------------------------------------- /src/common/dmr/lc/csbk/CSBK_RAW.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2022,2024 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "Defines.h" 11 | #include "dmr/lc/csbk/CSBK_RAW.h" 12 | 13 | using namespace dmr; 14 | using namespace dmr::defines; 15 | using namespace dmr::lc; 16 | using namespace dmr::lc::csbk; 17 | 18 | #include 19 | 20 | // --------------------------------------------------------------------------- 21 | // Public Class Members 22 | // --------------------------------------------------------------------------- 23 | 24 | /* Initializes a new instance of the CSBK_RAW class. */ 25 | 26 | CSBK_RAW::CSBK_RAW() : CSBK(), 27 | m_csbk(nullptr) 28 | { 29 | m_CSBKO = CSBKO::RAND; 30 | } 31 | 32 | /* Finalizes a new instance of the CSBK_RAW class. */ 33 | 34 | CSBK_RAW::~CSBK_RAW() 35 | { 36 | if (m_csbk != nullptr) { 37 | delete m_csbk; 38 | } 39 | } 40 | 41 | /* Decode a control signalling block. */ 42 | 43 | bool CSBK_RAW::decode(const uint8_t* data) 44 | { 45 | assert(data != nullptr); 46 | 47 | /* stub */ 48 | 49 | return true; 50 | } 51 | 52 | /* Encode a control signalling block. */ 53 | 54 | void CSBK_RAW::encode(uint8_t* data) 55 | { 56 | assert(data != nullptr); 57 | assert(m_csbk != nullptr); 58 | 59 | /* stub */ 60 | 61 | CSBK::encode(data, m_csbk); 62 | } 63 | 64 | /* Sets the CSBK to encode. */ 65 | 66 | void CSBK_RAW::setCSBK(const uint8_t* csbk) 67 | { 68 | assert(csbk != nullptr); 69 | 70 | m_CSBKO = csbk[0U] & 0x3FU; // CSBKO 71 | m_lastBlock = (csbk[0U] & 0x80U) == 0x80U; // Last Block Marker 72 | m_FID = csbk[1U]; // Feature ID 73 | 74 | m_csbk = new uint8_t[DMR_CSBK_LENGTH_BYTES]; 75 | ::memset(m_csbk, 0x00U, DMR_CSBK_LENGTH_BYTES); 76 | 77 | ::memcpy(m_csbk, csbk, DMR_CSBK_LENGTH_BYTES); 78 | } 79 | -------------------------------------------------------------------------------- /src/common/dmr/lc/csbk/CSBK_UU_ANS_RSP.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2022,2024 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "Defines.h" 11 | #include "dmr/lc/csbk/CSBK_UU_ANS_RSP.h" 12 | 13 | using namespace dmr; 14 | using namespace dmr::defines; 15 | using namespace dmr::lc; 16 | using namespace dmr::lc::csbk; 17 | 18 | #include 19 | 20 | // --------------------------------------------------------------------------- 21 | // Public Class Members 22 | // --------------------------------------------------------------------------- 23 | 24 | /* Initializes a new instance of the CSBK_UU_ANS_RSP class. */ 25 | 26 | CSBK_UU_ANS_RSP::CSBK_UU_ANS_RSP() : CSBK() 27 | { 28 | m_CSBKO = CSBKO::UU_ANS_RSP; 29 | } 30 | 31 | /* Decode a control signalling block. */ 32 | 33 | bool CSBK_UU_ANS_RSP::decode(const uint8_t* data) 34 | { 35 | assert(data != nullptr); 36 | 37 | uint8_t csbk[DMR_CSBK_LENGTH_BYTES]; 38 | ::memset(csbk, 0x00U, DMR_CSBK_LENGTH_BYTES); 39 | 40 | bool ret = CSBK::decode(data, csbk); 41 | if (!ret) 42 | return false; 43 | 44 | ulong64_t csbkValue = CSBK::toValue(csbk); 45 | 46 | m_dstId = (uint32_t)((csbkValue >> 24) & 0xFFFFFFU); // Target Radio Address 47 | m_srcId = (uint32_t)(csbkValue & 0xFFFFFFU); // Source Radio Address 48 | 49 | return true; 50 | } 51 | 52 | /* Encode a control signalling block. */ 53 | 54 | void CSBK_UU_ANS_RSP::encode(uint8_t* data) 55 | { 56 | assert(data != nullptr); 57 | 58 | /* stub */ 59 | } 60 | 61 | /* Returns a string that represents the current CSBK. */ 62 | 63 | std::string CSBK_UU_ANS_RSP::toString() 64 | { 65 | return std::string("CSBKO, UU_ANS_RSP (Unit-to-Unit Answer Response)"); 66 | } 67 | -------------------------------------------------------------------------------- /src/common/dmr/lc/csbk/CSBK_UU_V_REQ.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2022,2024 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "Defines.h" 11 | #include "dmr/lc/csbk/CSBK_UU_V_REQ.h" 12 | 13 | using namespace dmr; 14 | using namespace dmr::defines; 15 | using namespace dmr::lc; 16 | using namespace dmr::lc::csbk; 17 | 18 | #include 19 | 20 | // --------------------------------------------------------------------------- 21 | // Public Class Members 22 | // --------------------------------------------------------------------------- 23 | 24 | /* Initializes a new instance of the CSBK_UU_V_REQ class. */ 25 | 26 | CSBK_UU_V_REQ::CSBK_UU_V_REQ() : CSBK() 27 | { 28 | m_CSBKO = CSBKO::UU_V_REQ; 29 | } 30 | 31 | /* Decode a control signalling block. */ 32 | 33 | bool CSBK_UU_V_REQ::decode(const uint8_t* data) 34 | { 35 | assert(data != nullptr); 36 | 37 | uint8_t csbk[DMR_CSBK_LENGTH_BYTES]; 38 | ::memset(csbk, 0x00U, DMR_CSBK_LENGTH_BYTES); 39 | 40 | bool ret = CSBK::decode(data, csbk); 41 | if (!ret) 42 | return false; 43 | 44 | ulong64_t csbkValue = CSBK::toValue(csbk); 45 | 46 | m_dstId = (uint32_t)((csbkValue >> 24) & 0xFFFFFFU); // Target Radio Address 47 | m_srcId = (uint32_t)(csbkValue & 0xFFFFFFU); // Source Radio Address 48 | 49 | return true; 50 | } 51 | 52 | /* Encode a control signalling block. */ 53 | 54 | void CSBK_UU_V_REQ::encode(uint8_t* data) 55 | { 56 | assert(data != nullptr); 57 | 58 | /* stub */ 59 | } 60 | 61 | /* Returns a string that represents the current CSBK. */ 62 | 63 | std::string CSBK_UU_V_REQ::toString() 64 | { 65 | return std::string("CSBKO, UU_V_REQ (Unit-to-Unit Voice Channel Request)"); 66 | } 67 | -------------------------------------------------------------------------------- /src/common/edac/BCH.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2016 Jonathan Naylor, G4KLX 8 | * 9 | */ 10 | /** 11 | * @file BCH.h 12 | * @ingroup edac 13 | * @file BCH.cpp 14 | * @ingroup edac 15 | */ 16 | #if !defined(__BCH_H__) 17 | #define __BCH_H__ 18 | 19 | #include "common/Defines.h" 20 | 21 | namespace edac 22 | { 23 | // --------------------------------------------------------------------------- 24 | // Class Declaration 25 | // --------------------------------------------------------------------------- 26 | 27 | /** 28 | * @brief Implements Bose/Chaudhuri/Hocquenghem codes for protecting P25 NID 29 | * data. 30 | * @ingroup edac 31 | */ 32 | class HOST_SW_API BCH { 33 | public: 34 | /** 35 | * @brief Initializes a new instance of the BCH class. 36 | */ 37 | BCH(); 38 | /** 39 | * @brief Finalizes a instance of the BCH class. 40 | */ 41 | ~BCH(); 42 | 43 | /** 44 | * @brief Encodes input data with BCH. 45 | * @param data Data to encode with BCH. 46 | */ 47 | void encode(uint8_t* data); 48 | 49 | private: 50 | /** 51 | * @brief Compute redundancy bb[], the coefficients of b(x). The redundancy polynomial b(x) is the 52 | * remainder after dividing x^(length-k)*data(x) by the generator polynomial g(x). 53 | * @param data 54 | * @param bb 55 | */ 56 | void encode(const int* data, int* bb); 57 | }; 58 | } // namespace edac 59 | 60 | #endif // __BCH_H__ 61 | -------------------------------------------------------------------------------- /src/common/edac/Golay2087.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2015 Jonathan Naylor, G4KLX 8 | * 9 | */ 10 | /** 11 | * @file Golay2087.h 12 | * @ingroup edac 13 | * @file Golay2087.cpp 14 | * @ingroup edac 15 | */ 16 | #if !defined(__GOLAY2087_H__) 17 | #define __GOLAY2087_H__ 18 | 19 | #include "common/Defines.h" 20 | 21 | namespace edac 22 | { 23 | // --------------------------------------------------------------------------- 24 | // Class Declaration 25 | // --------------------------------------------------------------------------- 26 | 27 | /** 28 | * @brief Implements Golay (20,8,7) forward error correction. 29 | * @ingroup edac 30 | */ 31 | class HOST_SW_API Golay2087 { 32 | public: 33 | /** 34 | * @brief Decode Golay (20,8,7) FEC. 35 | * @param bytes Golay FEC encoded data byte array. 36 | * @returns uint8_t 37 | */ 38 | static uint8_t decode(const uint8_t* data); 39 | /** 40 | * @brief Encode Golay (20,8,7) FEC. 41 | * @param data Data to encode with Golay FEC. 42 | */ 43 | static void encode(uint8_t* data); 44 | 45 | private: 46 | /** 47 | * @brief Compute the syndrome corresponding to the given pattern, i.e., the 48 | * remainder after dividing the pattern (when considering it as the vector 49 | * representation of a polynomial) by the generator polynomial, GENPOL. 50 | * In the program this pattern has several meanings: (1) pattern = information 51 | * bits, when constructing the encoding table; (2) pattern = error pattern, 52 | * when constructing the decoding table; and (3) pattern = received vector, to 53 | * obtain its syndrome in decoding. 54 | */ 55 | static uint32_t getSyndrome1987(uint32_t pattern); 56 | }; 57 | } // namespace edac 58 | 59 | #endif // __GOLAY2087_H__ 60 | -------------------------------------------------------------------------------- /src/common/edac/QR1676.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2015 Jonathan Naylor, G4KLX 8 | * 9 | */ 10 | /** 11 | * @file QR1676.h 12 | * @ingroup edac 13 | * @file QR1676.cpp 14 | * @ingroup edac 15 | */ 16 | #if !defined(__QR1676_H__) 17 | #define __QR1676_H__ 18 | 19 | #include "common/Defines.h" 20 | 21 | namespace edac 22 | { 23 | // --------------------------------------------------------------------------- 24 | // Class Declaration 25 | // --------------------------------------------------------------------------- 26 | 27 | /** 28 | * @brief Implements Quadratic residue (16,7,6) forward error correction. 29 | * @ingroup edac 30 | */ 31 | class HOST_SW_API QR1676 { 32 | public: 33 | /** 34 | * @brief Decode QR (16,7,6) FEC. 35 | * @param data QR (16,7,6) FEC encoded data to decode. 36 | * @returns uint8_t Number of errors detected. 37 | */ 38 | static uint8_t decode(const uint8_t* data); 39 | /** 40 | * @brief Encode QR (16,7,6) FEC. 41 | * @param data Raw data to encode with QR (16,7,6) FEC. 42 | */ 43 | static void encode(uint8_t* data); 44 | 45 | private: 46 | /** 47 | * @brief Compute the syndrome corresponding to the given pattern, i.e., the 48 | * remainder after dividing the pattern (when considering it as the vector 49 | * representation of a polynomial) by the generator polynomial, GENPOL. 50 | * In the program this pattern has several meanings: (1) pattern = information 51 | * bits, when constructing the encoding table; (2) pattern = error pattern, 52 | * when constructing the decoding table; and (3) pattern = received vector, to 53 | * obtain its syndrome in decoding. 54 | */ 55 | static uint32_t getSyndrome1576(uint32_t pattern); 56 | }; 57 | } // namespace edac 58 | 59 | #endif // __QR1676_H__ 60 | -------------------------------------------------------------------------------- /src/common/edac/RS129.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2015 Jonathan Naylor, G4KLX 8 | * 9 | */ 10 | /** 11 | * @file RS129.h 12 | * @ingroup edac 13 | * @file RS129.cpp 14 | * @ingroup edac 15 | */ 16 | #if !defined(__RS129_H__) 17 | #define __RS129_H__ 18 | 19 | #include "common/Defines.h" 20 | 21 | namespace edac 22 | { 23 | // --------------------------------------------------------------------------- 24 | // Class Declaration 25 | // --------------------------------------------------------------------------- 26 | 27 | /** 28 | * @brief Implements Reed-Solomon (12,9) forward error correction. 29 | * @ingroup edac 30 | */ 31 | class HOST_SW_API RS129 { 32 | public: 33 | /** 34 | * @brief Check RS (12,9) FEC. 35 | * @param[in] in Buffer to check with RS (12,9). 36 | * @returns bool True, if parity is valid, otherwise false. 37 | */ 38 | static bool check(const uint8_t* in); 39 | 40 | /** 41 | * @brief Encode RS (12,9) FEC. 42 | * Simulate a LFSR with generator polynomial for n byte RS code. 43 | * Pass in a pointer to the data array, and amount of data. 44 | * 45 | * The parity bytes are deposited into parity. 46 | * @param[in] msg Buffer to protect. 47 | * @param nbytes Length of buffer. 48 | * @param[out] parity RS (12,9) parity. 49 | */ 50 | static void encode(const uint8_t* msg, uint32_t nbytes, uint8_t* parity); 51 | 52 | private: 53 | /** 54 | * @brief 55 | */ 56 | static uint8_t gmult(uint8_t a, uint8_t b); 57 | }; 58 | } // namespace edac 59 | 60 | #endif // __RS129_H__ 61 | -------------------------------------------------------------------------------- /src/common/lookups/RSSIInterpolator.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2016 Jonathan Naylor, G4KLX 8 | * 9 | */ 10 | /** 11 | * @file RSSIInterpolator.h 12 | * @ingroup lookups 13 | * @file RSSIInterpolator.cpp 14 | * @ingroup lookups 15 | */ 16 | #if !defined(__RSSI_INTERPOLATOR_H__) 17 | #define __RSSI_INTERPOLATOR_H__ 18 | 19 | #include "common/Defines.h" 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | namespace lookups 26 | { 27 | // --------------------------------------------------------------------------- 28 | // Class Declaration 29 | // 30 | // --------------------------------------------------------------------------- 31 | 32 | /** 33 | * @brief RSSI interpolated lookup for RSSI values returned from the modem. 34 | * @ingroup lookups 35 | */ 36 | class HOST_SW_API RSSIInterpolator { 37 | public: 38 | /** 39 | * @brief Initializes a new instance of the RSSIInterpolator class. 40 | */ 41 | RSSIInterpolator(); 42 | /** 43 | * @brief Finalizes a instance of the RSSIInterpolator class. 44 | */ 45 | ~RSSIInterpolator(); 46 | 47 | /** 48 | * @brief Loads the table from the passed RSSI mapping file. 49 | * @param filename Full-path to the RSSI mapping file. 50 | * @returns bool True, if RSSI mapping was loaded, otherwise false. 51 | */ 52 | bool load(const std::string& filename); 53 | 54 | /** 55 | * @brief Interpolates the given raw RSSI value with the lookup map. 56 | * @param raw Raw RSSI value from modem DSP. 57 | * @returns int Interpolated RSSI value. 58 | */ 59 | int interpolate(uint16_t raw) const; 60 | 61 | private: 62 | std::map m_map; 63 | }; 64 | } // namespace lookups 65 | 66 | #endif // __RSSI_INTERPOLATOR_H__ 67 | -------------------------------------------------------------------------------- /src/common/network/RPCHeader.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2025 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "Defines.h" 11 | #include "network/RPCHeader.h" 12 | #include "Utils.h" 13 | 14 | using namespace network::frame; 15 | 16 | #include 17 | 18 | // --------------------------------------------------------------------------- 19 | // Public Class Members 20 | // --------------------------------------------------------------------------- 21 | 22 | /* Initializes a new instance of the RPCHeader class. */ 23 | 24 | RPCHeader::RPCHeader() : 25 | m_crc16(0U), 26 | m_func(0U), 27 | m_messageLength(0U) 28 | { 29 | /* stub */ 30 | } 31 | 32 | /* Finalizes a instance of the RPCHeader class. */ 33 | 34 | RPCHeader::~RPCHeader() = default; 35 | 36 | /* Decode a RTP header. */ 37 | 38 | bool RPCHeader::decode(const uint8_t* data) 39 | { 40 | assert(data != nullptr); 41 | 42 | m_crc16 = (data[0U] << 8) | (data[1U] << 0); // CRC-16 43 | m_func = GET_UINT16(data, 2U); // Function 44 | m_messageLength = GET_UINT32(data, 4U); // Message Length 45 | 46 | return true; 47 | } 48 | 49 | /* Encode a RTP header. */ 50 | 51 | void RPCHeader::encode(uint8_t* data) 52 | { 53 | assert(data != nullptr); 54 | 55 | data[0U] = (m_crc16 >> 8) & 0xFFU; // CRC-16 MSB 56 | data[1U] = (m_crc16 >> 0) & 0xFFU; // CRC-16 LSB 57 | SET_UINT16(m_func, data, 2U); // Function 58 | 59 | SET_UINT32(m_messageLength, data, 4U); // Message Length 60 | } 61 | -------------------------------------------------------------------------------- /src/common/network/RTPExtensionHeader.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2023 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "Defines.h" 11 | #include "network/RTPExtensionHeader.h" 12 | 13 | using namespace network::frame; 14 | 15 | #include 16 | 17 | // --------------------------------------------------------------------------- 18 | // Public Class Members 19 | // --------------------------------------------------------------------------- 20 | 21 | /* Initializes a new instance of the RTPExtensionHeader class. */ 22 | 23 | RTPExtensionHeader::RTPExtensionHeader() : 24 | m_payloadType(0U), 25 | m_payloadLength(0U) 26 | { 27 | /* stub */ 28 | } 29 | 30 | /* Finalizes a instance of the RTPExtensionHeader class. */ 31 | 32 | RTPExtensionHeader::~RTPExtensionHeader() = default; 33 | 34 | /* Decode a RTP header. */ 35 | 36 | bool RTPExtensionHeader::decode(const uint8_t* data) 37 | { 38 | assert(data != nullptr); 39 | 40 | m_payloadType = (data[0U] << 8) | (data[1U] << 0); // Payload Type 41 | m_payloadLength = (data[2U] << 8) | (data[3U] << 0); // Payload Length 42 | 43 | return true; 44 | } 45 | 46 | /* Encode a RTP header. */ 47 | 48 | void RTPExtensionHeader::encode(uint8_t* data) 49 | { 50 | assert(data != nullptr); 51 | 52 | data[0U] = (m_payloadType >> 8) & 0xFFU; // Payload Type MSB 53 | data[1U] = (m_payloadType >> 0) & 0xFFU; // Payload Type LSB 54 | data[2U] = (m_payloadLength >> 8) & 0xFFU; // Payload Length MSB 55 | data[3U] = (m_payloadLength >> 0) & 0xFFU; // Payload Length LSB 56 | } 57 | -------------------------------------------------------------------------------- /src/common/network/tcp/SecureTcpClient.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2024 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "common/Defines.h" 11 | #include "common/network/tcp/SecureTcpClient.h" 12 | 13 | #if defined(ENABLE_SSL) 14 | 15 | using namespace network::tcp; 16 | 17 | // --------------------------------------------------------------------------- 18 | // Static Class Members 19 | // --------------------------------------------------------------------------- 20 | 21 | std::string SecureTcpClient::m_sslHostname = std::string(); 22 | 23 | #endif // ENABLE_SSL -------------------------------------------------------------------------------- /src/common/nxdn/NXDNUtils.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2020 Jonathan Naylor, G4KLX 8 | * Copyright (C) 2022,2024 Bryan Biedenkapp, N2PLL 9 | * 10 | */ 11 | #include "Defines.h" 12 | #include "nxdn/NXDNDefines.h" 13 | #include "nxdn/NXDNUtils.h" 14 | #include "Utils.h" 15 | 16 | using namespace nxdn; 17 | using namespace nxdn::defines; 18 | 19 | #include 20 | 21 | // --------------------------------------------------------------------------- 22 | // Constants 23 | // --------------------------------------------------------------------------- 24 | 25 | const uint8_t SCRAMBLER[] = { 26 | 0x00U, 0x00U, 0x00U, 0x82U, 0xA0U, 0x88U, 0x8AU, 0x00U, 0xA2U, 0xA8U, 0x82U, 0x8AU, 0x82U, 0x02U, 27 | 0x20U, 0x08U, 0x8AU, 0x20U, 0xAAU, 0xA2U, 0x82U, 0x08U, 0x22U, 0x8AU, 0xAAU, 0x08U, 0x28U, 0x88U, 28 | 0x28U, 0x28U, 0x00U, 0x0AU, 0x02U, 0x82U, 0x20U, 0x28U, 0x82U, 0x2AU, 0xAAU, 0x20U, 0x22U, 0x80U, 29 | 0xA8U, 0x8AU, 0x08U, 0xA0U, 0xAAU, 0x02U }; 30 | 31 | // --------------------------------------------------------------------------- 32 | // Static Class Members 33 | // --------------------------------------------------------------------------- 34 | 35 | /* Helper to scramble the NXDN frame data. */ 36 | 37 | void NXDNUtils::scrambler(uint8_t* data) 38 | { 39 | assert(data != nullptr); 40 | 41 | for (uint32_t i = 0U; i < NXDN_FRAME_LENGTH_BYTES; i++) 42 | data[i] ^= SCRAMBLER[i]; 43 | } 44 | 45 | /* Helper to add the post field bits on NXDN frame data. */ 46 | 47 | void NXDNUtils::addPostBits(uint8_t* data) 48 | { 49 | assert(data != nullptr); 50 | 51 | // post field 52 | for (uint32_t i = 0U; i < NXDN_CAC_E_POST_FIELD_BITS; i++) { 53 | uint32_t n = i + NXDN_FSW_LENGTH_BITS + NXDN_LICH_LENGTH_BITS + NXDN_CAC_FEC_LENGTH_BITS + NXDN_CAC_E_POST_FIELD_BITS; 54 | bool b = READ_BIT(NXDN_PREAMBLE, i); 55 | WRITE_BIT(data, n, b); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/common/nxdn/NXDNUtils.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2020 Jonathan Naylor, G4KLX 8 | * Copyright (C) 2022 Bryan Biedenkapp, N2PLL 9 | * 10 | */ 11 | /** 12 | * @file NXDNUtils.h 13 | * @ingroup nxdn 14 | * @file NXDNUtils.cpp 15 | * @ingroup nxdn 16 | */ 17 | #if !defined(__NXDN_UTILS_H__) 18 | #define __NXDN_UTILS_H__ 19 | 20 | #include "common/Defines.h" 21 | 22 | namespace nxdn 23 | { 24 | // --------------------------------------------------------------------------- 25 | // Class Declaration 26 | // --------------------------------------------------------------------------- 27 | 28 | /** 29 | * @brief This class implements various helper functions for scrambling NXDN data. 30 | * @ingroup nxdn 31 | */ 32 | class HOST_SW_API NXDNUtils { 33 | public: 34 | /** 35 | * @brief Helper to scramble the NXDN frame data. 36 | * @param data Buffer to apply scrambling to. 37 | */ 38 | static void scrambler(uint8_t* data); 39 | /** 40 | * @brief Helper to add the post field bits on NXDN frame data. 41 | * @param data Buffer to apply post field bits to. 42 | */ 43 | static void addPostBits(uint8_t* data); 44 | }; 45 | } // namespace nxdn 46 | 47 | #endif // __NXDN_UTILS_H__ 48 | -------------------------------------------------------------------------------- /src/common/nxdn/Sync.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2020 Jonathan Naylor, G4KLX 8 | * Copyright (C) 2024 Bryan Biedenkapp, N2PLL 9 | * 10 | */ 11 | #include "Defines.h" 12 | #include "nxdn/NXDNDefines.h" 13 | #include "nxdn/Sync.h" 14 | 15 | using namespace nxdn; 16 | using namespace nxdn::defines; 17 | 18 | #include 19 | 20 | // --------------------------------------------------------------------------- 21 | // Static Class Members 22 | // --------------------------------------------------------------------------- 23 | 24 | /* Helper to append NXDN sync bytes to the passed buffer. */ 25 | 26 | void Sync::addNXDNSync(uint8_t* data) 27 | { 28 | assert(data != nullptr); 29 | 30 | for (uint32_t i = 0U; i < NXDN_FSW_BYTES_LENGTH; i++) 31 | data[i] = (data[i] & ~NXDN_FSW_BYTES_MASK[i]) | NXDN_FSW_BYTES[i]; 32 | } 33 | -------------------------------------------------------------------------------- /src/common/nxdn/Sync.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2020 Jonathan Naylor, G4KLX 8 | * 9 | */ 10 | /** 11 | * @file Sync.h 12 | * @ingroup nxdn 13 | * @file Sync.cpp 14 | * @ingroup nxdn 15 | */ 16 | #if !defined(__NXDN_SYNC_H__) 17 | #define __NXDN_SYNC_H__ 18 | 19 | #include "common/Defines.h" 20 | 21 | namespace nxdn 22 | { 23 | // --------------------------------------------------------------------------- 24 | // Class Declaration 25 | // --------------------------------------------------------------------------- 26 | 27 | /** 28 | * @brief Helper class for generating NXDN sync data. 29 | * @ingroup nxdn 30 | */ 31 | class HOST_SW_API Sync { 32 | public: 33 | /** 34 | * @brief Helper to append NXDN sync bytes to the passed buffer. 35 | * @param data Buffer to append P25 sync bytes to. 36 | */ 37 | static void addNXDNSync(uint8_t* data); 38 | }; 39 | } // namespace nxdn 40 | 41 | #endif // __NXDN_SYNC_H__ 42 | -------------------------------------------------------------------------------- /src/common/nxdn/lc/rcch/MESSAGE_TYPE_IDLE.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2022,2024 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "Defines.h" 11 | #include "nxdn/lc/rcch/MESSAGE_TYPE_IDLE.h" 12 | 13 | using namespace nxdn; 14 | using namespace nxdn::defines; 15 | using namespace nxdn::lc; 16 | using namespace nxdn::lc::rcch; 17 | 18 | #include 19 | 20 | // --------------------------------------------------------------------------- 21 | // Public Class Members 22 | // --------------------------------------------------------------------------- 23 | 24 | /* Initializes a new instance of the MESSAGE_TYPE_IDLE class. */ 25 | 26 | MESSAGE_TYPE_IDLE::MESSAGE_TYPE_IDLE() : RCCH() 27 | { 28 | m_messageType = MessageType::IDLE; 29 | } 30 | 31 | /* Decode RCCH data. */ 32 | 33 | void MESSAGE_TYPE_IDLE::decode(const uint8_t* data, uint32_t length, uint32_t offset) 34 | { 35 | assert(data != nullptr); 36 | 37 | uint8_t rcch[NXDN_RCCH_LC_LENGTH_BYTES + 4U]; 38 | ::memset(rcch, 0x00U, NXDN_RCCH_LC_LENGTH_BYTES + 4U); 39 | 40 | RCCH::decode(data, rcch, length, offset); 41 | } 42 | 43 | /* Encode RCCH data. */ 44 | 45 | void MESSAGE_TYPE_IDLE::encode(uint8_t* data, uint32_t length, uint32_t offset) 46 | { 47 | assert(data != nullptr); 48 | 49 | uint8_t rcch[NXDN_RCCH_LC_LENGTH_BYTES + 4U]; 50 | ::memset(rcch, 0x00U, NXDN_RCCH_LC_LENGTH_BYTES + 4U); 51 | 52 | RCCH::encode(data, rcch, length, offset); 53 | } 54 | 55 | /* Returns a string that represents the current RCCH. */ 56 | 57 | std::string MESSAGE_TYPE_IDLE::toString(bool isp) 58 | { 59 | return std::string("IDLE (Idle)"); 60 | } 61 | -------------------------------------------------------------------------------- /src/common/p25/Audio.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2016 Jonathan Naylor, G4KLX 8 | * 9 | */ 10 | /** 11 | * @file Audio.h 12 | * @ingroup p25 13 | * @file Audio.cpp 14 | * @ingroup p25 15 | */ 16 | #if !defined(__P25_AUDIO_H__) 17 | #define __P25_AUDIO_H__ 18 | 19 | #include "common/Defines.h" 20 | #include "common/edac/AMBEFEC.h" 21 | 22 | namespace p25 23 | { 24 | // --------------------------------------------------------------------------- 25 | // Class Declaration 26 | // --------------------------------------------------------------------------- 27 | 28 | /** 29 | * @brief Implements P25 audio processing and interleaving. 30 | * @ingroup p25 31 | */ 32 | class HOST_SW_API Audio { 33 | public: 34 | /** 35 | * @brief Initializes a new instance of the Audio class. 36 | */ 37 | Audio(); 38 | /** 39 | * @brief Finalizes a instance of the Audio class. 40 | */ 41 | ~Audio(); 42 | 43 | /** 44 | * @brief Process P25 IMBE audio data. 45 | * @param data IMBE audio buffer. 46 | * @returns uint32_t Number of errors in the audio buffer. 47 | */ 48 | uint32_t process(uint8_t* data); 49 | 50 | /** 51 | * @brief Decode a P25 IMBE audio frame. 52 | * @param data Interleaved IMBE audio buffer. 53 | * @param imbe Raw IMBE buffer. 54 | * @param n Audio sequence. 55 | */ 56 | void decode(const uint8_t* data, uint8_t* imbe, uint32_t n); 57 | /** 58 | * @brief Encode a P25 IMBE audio frame. 59 | * @param data Interleaved IMBE audio buffer. 60 | * @param imbe Raw IMBE buffer. 61 | * @param n Audio sequence. 62 | */ 63 | void encode(uint8_t* data, const uint8_t* imbe, uint32_t n); 64 | 65 | private: 66 | edac::AMBEFEC m_fec; 67 | }; 68 | } // namespace p25 69 | 70 | #endif // __P25_AUDIO_H__ 71 | -------------------------------------------------------------------------------- /src/common/p25/Sync.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2015,2016 Jonathan Naylor, G4KLX 8 | * Copyright (C) 2024 Bryan Biedenkapp, N2PLL 9 | * 10 | */ 11 | #include "Defines.h" 12 | #include "p25/P25Defines.h" 13 | #include "p25/Sync.h" 14 | 15 | using namespace p25; 16 | using namespace p25::defines; 17 | 18 | #include 19 | #include 20 | 21 | // --------------------------------------------------------------------------- 22 | // Static Class Members 23 | // --------------------------------------------------------------------------- 24 | 25 | /* Helper to append P25 sync bytes to the passed buffer. */ 26 | 27 | void Sync::addP25Sync(uint8_t* data) 28 | { 29 | assert(data != nullptr); 30 | 31 | ::memcpy(data, P25_SYNC_BYTES, P25_SYNC_LENGTH_BYTES); 32 | } 33 | -------------------------------------------------------------------------------- /src/common/p25/Sync.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2015,2016 Jonathan Naylor, G4KLX 8 | * 9 | */ 10 | /** 11 | * @file Sync.h 12 | * @ingroup p25 13 | * @file Sync.cpp 14 | * @ingroup p25 15 | */ 16 | #if !defined(__P25_SYNC_H__) 17 | #define __P25_SYNC_H__ 18 | 19 | #include "common/Defines.h" 20 | 21 | namespace p25 22 | { 23 | // --------------------------------------------------------------------------- 24 | // Class Declaration 25 | // --------------------------------------------------------------------------- 26 | 27 | /** 28 | * @brief Helper class for generating P25 sync data. 29 | * @ingroup p25 30 | */ 31 | class HOST_SW_API Sync { 32 | public: 33 | /** 34 | * @brief Helper to append P25 sync bytes to the passed buffer. 35 | * @param data Buffer to append P25 sync bytes to. 36 | */ 37 | static void addP25Sync(uint8_t* data); 38 | }; 39 | } // namespace p25 40 | 41 | #endif // __P25_SYNC_H__ 42 | -------------------------------------------------------------------------------- /src/common/p25/dfsi/frames/ControlOctet.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2024 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "common/p25/dfsi/frames/ControlOctet.h" 11 | #include "common/p25/dfsi/DFSIDefines.h" 12 | #include "common/Utils.h" 13 | #include "common/Log.h" 14 | 15 | #include 16 | #include 17 | 18 | using namespace p25; 19 | using namespace p25::dfsi; 20 | using namespace p25::dfsi::frames; 21 | 22 | // --------------------------------------------------------------------------- 23 | // Public Class Members 24 | // --------------------------------------------------------------------------- 25 | 26 | /* Initializes a instance of the ControlOctet class. */ 27 | 28 | ControlOctet::ControlOctet() : 29 | m_signal(false), 30 | m_compact(true), 31 | m_blockHeaderCnt(0U) 32 | { 33 | /* stub */ 34 | } 35 | 36 | /* Initializes a instance of the ControlOctet class. */ 37 | 38 | ControlOctet::ControlOctet(uint8_t* data) : 39 | m_signal(false), 40 | m_compact(true), 41 | m_blockHeaderCnt(0U) 42 | { 43 | decode(data); 44 | } 45 | 46 | /* Decode a control octet frame. */ 47 | 48 | bool ControlOctet::decode(const uint8_t* data) 49 | { 50 | assert(data != nullptr); 51 | 52 | m_signal = (data[0U] & 0x80U) == 0x80U; // Signal Flag 53 | m_compact = (data[0U] & 0x40U) == 0x40U; // Compact Flag 54 | m_blockHeaderCnt = (uint8_t)(data[0U] & 0x3FU); // Block Header Count 55 | 56 | return true; 57 | } 58 | 59 | /* Encode a control octet frame. */ 60 | 61 | void ControlOctet::encode(uint8_t* data) 62 | { 63 | assert(data != nullptr); 64 | 65 | data[0U] = (uint8_t)((m_signal ? 0x80U : 0x00U) + // Signal Flag 66 | (m_compact ? 0x40U : 0x00U) + // Control Flag 67 | (m_blockHeaderCnt & 0x3F)); 68 | } 69 | -------------------------------------------------------------------------------- /src/common/p25/dfsi/frames/Frames.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2024 Patrick McDonnell, W3AXL 8 | * Copyright (C) 2024 Bryan Biedenkapp, N2PLL 9 | * 10 | */ 11 | #if !defined(__DFSI_FRAMES_H__) 12 | #define __DFSI_FRAMES_H__ 13 | 14 | #include "Defines.h" 15 | 16 | // TIA 17 | #include "common/p25/dfsi/frames/StartOfStream.h" 18 | #include "common/p25/dfsi/frames/ControlOctet.h" 19 | #include "common/p25/dfsi/frames/BlockHeader.h" 20 | #include "common/p25/dfsi/frames/FullRateVoice.h" 21 | 22 | // "The" Manufacturer 23 | #include "common/p25/dfsi/frames/MotFullRateVoice.h" 24 | #include "common/p25/dfsi/frames/MotStartOfStream.h" 25 | #include "common/p25/dfsi/frames/MotStartVoiceFrame.h" 26 | #include "common/p25/dfsi/frames/MotVoiceHeader1.h" 27 | #include "common/p25/dfsi/frames/MotVoiceHeader2.h" 28 | #include "common/p25/dfsi/frames/MotTSBKFrame.h" 29 | #include "common/p25/dfsi/frames/MotPDUFrame.h" 30 | 31 | // FSC 32 | #include "common/p25/dfsi/frames/fsc/FSCMessage.h" 33 | #include "common/p25/dfsi/frames/fsc/FSCACK.h" 34 | #include "common/p25/dfsi/frames/fsc/FSCConnect.h" 35 | #include "common/p25/dfsi/frames/fsc/FSCReportSelModes.h" 36 | #include "common/p25/dfsi/frames/fsc/FSCDisconnect.h" 37 | #include "common/p25/dfsi/frames/fsc/FSCHeartbeat.h" 38 | #include "common/p25/dfsi/frames/fsc/FSCSelChannel.h" 39 | 40 | #endif // __DFSI_FRAMES_H__ -------------------------------------------------------------------------------- /src/common/p25/dfsi/frames/MotStartOfStream.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2024 Patrick McDonnell, W3AXL 8 | * Copyright (C) 2024 Bryan Biedenkapp, N2PLL 9 | * 10 | */ 11 | #include "common/p25/dfsi/frames/MotStartOfStream.h" 12 | #include "common/p25/dfsi/DFSIDefines.h" 13 | #include "common/Utils.h" 14 | #include "common/Log.h" 15 | 16 | #include 17 | #include 18 | 19 | using namespace p25; 20 | using namespace p25::dfsi; 21 | using namespace p25::dfsi::defines; 22 | using namespace p25::dfsi::frames; 23 | 24 | // --------------------------------------------------------------------------- 25 | // Public Class Members 26 | // --------------------------------------------------------------------------- 27 | 28 | /* Initializes a instance of the MotStartOfStream class. */ 29 | 30 | MotStartOfStream::MotStartOfStream() : 31 | m_marker(FIXED_MARKER), 32 | m_rt(RTFlag::DISABLED), 33 | m_startStop(StartStopFlag::START), 34 | m_streamType(StreamTypeFlag::VOICE) 35 | { 36 | /* stub */ 37 | } 38 | 39 | /* Initializes a instance of the MotStartOfStream class. */ 40 | 41 | MotStartOfStream::MotStartOfStream(uint8_t* data) : 42 | m_marker(FIXED_MARKER), 43 | m_rt(RTFlag::DISABLED), 44 | m_startStop(StartStopFlag::START), 45 | m_streamType(StreamTypeFlag::VOICE) 46 | { 47 | decode(data); 48 | } 49 | 50 | /* Decode a start of stream frame. */ 51 | 52 | bool MotStartOfStream::decode(const uint8_t* data) 53 | { 54 | assert(data != nullptr); 55 | 56 | m_rt = (RTFlag::E)data[2U]; 57 | m_startStop = (StartStopFlag::E)data[3U]; 58 | m_streamType = (StreamTypeFlag::E)data[4U]; 59 | 60 | return true; 61 | } 62 | 63 | /* Encode a start of stream frame. */ 64 | 65 | void MotStartOfStream::encode(uint8_t* data) 66 | { 67 | assert(data != nullptr); 68 | 69 | data[0U] = DFSIFrameType::MOT_START_STOP; 70 | data[1U] = FIXED_MARKER; 71 | data[2U] = m_rt; 72 | data[3U] = m_startStop; 73 | data[4U] = m_streamType; 74 | } 75 | -------------------------------------------------------------------------------- /src/common/p25/dfsi/frames/StartOfStream.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2024 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "common/p25/dfsi/frames/StartOfStream.h" 11 | #include "common/p25/dfsi/DFSIDefines.h" 12 | #include "common/Utils.h" 13 | #include "common/Log.h" 14 | 15 | #include 16 | #include 17 | 18 | using namespace p25; 19 | using namespace p25::dfsi; 20 | using namespace p25::dfsi::frames; 21 | 22 | // --------------------------------------------------------------------------- 23 | // Public Class Members 24 | // --------------------------------------------------------------------------- 25 | 26 | /* Initializes a instance of the StartOfStream class. */ 27 | 28 | StartOfStream::StartOfStream() : 29 | m_nid(0U), 30 | m_errorCount(0U) 31 | { 32 | /* stub */ 33 | } 34 | 35 | /* Initializes a instance of the StartOfStream class. */ 36 | 37 | StartOfStream::StartOfStream(uint8_t* data) : 38 | m_nid(0U), 39 | m_errorCount(0U) 40 | { 41 | decode(data); 42 | } 43 | 44 | /* Decode a start of stream frame. */ 45 | 46 | bool StartOfStream::decode(const uint8_t* data) 47 | { 48 | assert(data != nullptr); 49 | 50 | m_nid = GET_UINT16(data, 0U); // Network Identifier 51 | m_errorCount = (data[2U] & 0x0FU); // Error Count 52 | 53 | return true; 54 | } 55 | 56 | /* Encode a start of stream frame. */ 57 | 58 | void StartOfStream::encode(uint8_t* data) 59 | { 60 | assert(data != nullptr); 61 | 62 | SET_UINT16(m_nid, data, 0U); // Network Identifier 63 | data[2U] = m_errorCount & 0x0FU; // Error Count 64 | } 65 | -------------------------------------------------------------------------------- /src/common/p25/dfsi/frames/fsc/FSCDisconnect.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2024-2025 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "common/p25/dfsi/frames/fsc/FSCDisconnect.h" 11 | #include "common/p25/dfsi/DFSIDefines.h" 12 | #include "common/Utils.h" 13 | #include "common/Log.h" 14 | 15 | #include 16 | #include 17 | 18 | using namespace p25::dfsi; 19 | using namespace p25::dfsi::frames; 20 | using namespace p25::dfsi::frames::fsc; 21 | 22 | // --------------------------------------------------------------------------- 23 | // Public Class Members 24 | // --------------------------------------------------------------------------- 25 | 26 | /* Initializes a instance of the FSCDisconnect class. */ 27 | 28 | FSCDisconnect::FSCDisconnect() : FSCMessage() 29 | { 30 | m_messageId = FSCMessageType::FSC_DISCONNECT; 31 | } 32 | -------------------------------------------------------------------------------- /src/common/p25/dfsi/frames/fsc/FSCDisconnect.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2024 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | /** 11 | * @file FSCDisconnect.h 12 | * @ingroup dfsi_fsc_frames 13 | * @file FSCDisconnect.cpp 14 | * @ingroup dfsi_fsc_frames 15 | */ 16 | #if !defined(__FSC_DISCONNECT_H__) 17 | #define __FSC_DISCONNECT_H__ 18 | 19 | #include "Defines.h" 20 | #include "common/Defines.h" 21 | #include "common/Log.h" 22 | #include "common/Utils.h" 23 | #include "common/p25/dfsi/frames/FrameDefines.h" 24 | #include "common/p25/dfsi/frames/fsc/FSCMessage.h" 25 | 26 | namespace p25 27 | { 28 | namespace dfsi 29 | { 30 | namespace frames 31 | { 32 | namespace fsc 33 | { 34 | // --------------------------------------------------------------------------- 35 | // Class Declaration 36 | // --------------------------------------------------------------------------- 37 | 38 | /** 39 | * @brief Implements the FSC Disconnect Message. 40 | * @ingroup dfsi_fsc_frames 41 | */ 42 | class HOST_SW_API FSCDisconnect : public FSCMessage { 43 | public: 44 | static const uint8_t LENGTH = 3U; 45 | 46 | /** 47 | * @brief Initializes a copy instance of the FSCDisconnect class. 48 | */ 49 | FSCDisconnect(); 50 | }; 51 | } // namespace fsc 52 | } // namespace frames 53 | } // namespace dfsi 54 | } // namespace p25 55 | 56 | #endif // __FSC_DISCONNECT_H__ -------------------------------------------------------------------------------- /src/common/p25/dfsi/frames/fsc/FSCHeartbeat.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2024-2025 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "common/p25/dfsi/frames/fsc/FSCHeartbeat.h" 11 | #include "common/p25/dfsi/DFSIDefines.h" 12 | #include "common/Utils.h" 13 | #include "common/Log.h" 14 | 15 | #include 16 | #include 17 | 18 | using namespace p25::dfsi; 19 | using namespace p25::dfsi::frames; 20 | using namespace p25::dfsi::frames::fsc; 21 | 22 | // --------------------------------------------------------------------------- 23 | // Public Class Members 24 | // --------------------------------------------------------------------------- 25 | 26 | /* Initializes a instance of the FSCHeartbeat class. */ 27 | 28 | FSCHeartbeat::FSCHeartbeat() : FSCMessage() 29 | { 30 | m_messageId = FSCMessageType::FSC_HEARTBEAT; 31 | } 32 | -------------------------------------------------------------------------------- /src/common/p25/dfsi/frames/fsc/FSCHeartbeat.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2024 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | /** 11 | * @file FSCHeartbeat.h 12 | * @ingroup dfsi_fsc_frames 13 | * @file FSCHeartbeat.cpp 14 | * @ingroup dfsi_fsc_frames 15 | */ 16 | #if !defined(__FSC_HEARTBEAT_H__) 17 | #define __FSC_HEARTBEAT_H__ 18 | 19 | #include "Defines.h" 20 | #include "common/Defines.h" 21 | #include "common/Log.h" 22 | #include "common/Utils.h" 23 | #include "common/p25/dfsi/frames/FrameDefines.h" 24 | #include "common/p25/dfsi/frames/fsc/FSCMessage.h" 25 | 26 | namespace p25 27 | { 28 | namespace dfsi 29 | { 30 | namespace frames 31 | { 32 | namespace fsc 33 | { 34 | // --------------------------------------------------------------------------- 35 | // Class Declaration 36 | // --------------------------------------------------------------------------- 37 | 38 | /** 39 | * @brief Implements the FSC Heartbeat Message. 40 | * @ingroup dfsi_fsc_frames 41 | */ 42 | class HOST_SW_API FSCHeartbeat : public FSCMessage { 43 | public: 44 | static const uint8_t LENGTH = 3U; 45 | 46 | /** 47 | * @brief Initializes a copy instance of the FSCHeartbeat class. 48 | */ 49 | FSCHeartbeat(); 50 | }; 51 | } // namespace fsc 52 | } // namespace frames 53 | } // namespace dfsi 54 | } // namespace p25 55 | 56 | #endif // __FSC_HEARTBEAT_H__ -------------------------------------------------------------------------------- /src/common/p25/dfsi/frames/fsc/FSCReportSelModes.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2025 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "common/p25/dfsi/frames/fsc/FSCReportSelModes.h" 11 | #include "common/p25/dfsi/DFSIDefines.h" 12 | #include "common/Utils.h" 13 | #include "common/Log.h" 14 | 15 | #include 16 | #include 17 | 18 | using namespace p25::dfsi; 19 | using namespace p25::dfsi::frames; 20 | using namespace p25::dfsi::frames::fsc; 21 | 22 | // --------------------------------------------------------------------------- 23 | // Public Class Members 24 | // --------------------------------------------------------------------------- 25 | 26 | /* Initializes a instance of the FSCReportSelModes class. */ 27 | 28 | FSCReportSelModes::FSCReportSelModes() : FSCMessage() 29 | { 30 | m_messageId = FSCMessageType::FSC_REPORT_SEL_MODES; 31 | } 32 | -------------------------------------------------------------------------------- /src/common/p25/dfsi/frames/fsc/FSCReportSelModes.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2025 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | /** 11 | * @file FSCReportSelModes.h 12 | * @ingroup dfsi_fsc_frames 13 | * @file FSCReportSelModes.cpp 14 | * @ingroup dfsi_fsc_frames 15 | */ 16 | #if !defined(__FSC_REPORT_SEL_MODES_H__) 17 | #define __FSC_REPORT_SEL_MODES_H__ 18 | 19 | #include "Defines.h" 20 | #include "common/Defines.h" 21 | #include "common/Log.h" 22 | #include "common/Utils.h" 23 | #include "common/p25/dfsi/frames/FrameDefines.h" 24 | #include "common/p25/dfsi/frames/fsc/FSCMessage.h" 25 | 26 | namespace p25 27 | { 28 | namespace dfsi 29 | { 30 | namespace frames 31 | { 32 | namespace fsc 33 | { 34 | // --------------------------------------------------------------------------- 35 | // Class Declaration 36 | // --------------------------------------------------------------------------- 37 | 38 | /** 39 | * @brief Implements the FSC Report Selected Modes Message. 40 | * @ingroup dfsi_fsc_frames 41 | */ 42 | class HOST_SW_API FSCReportSelModes : public FSCMessage { 43 | public: 44 | static const uint8_t LENGTH = 3U; 45 | 46 | /** 47 | * @brief Initializes a copy instance of the FSCReportSelModes class. 48 | */ 49 | FSCReportSelModes(); 50 | }; 51 | } // namespace fsc 52 | } // namespace frames 53 | } // namespace dfsi 54 | } // namespace p25 55 | 56 | #endif // __FSC_REPORT_SEL_MODES_H__ -------------------------------------------------------------------------------- /src/common/p25/dfsi/frames/fsc/FSCSelChannel.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2025 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "common/p25/dfsi/frames/fsc/FSCSelChannel.h" 11 | #include "common/p25/dfsi/DFSIDefines.h" 12 | #include "common/Utils.h" 13 | #include "common/Log.h" 14 | 15 | #include 16 | #include 17 | 18 | using namespace p25::dfsi; 19 | using namespace p25::dfsi::frames; 20 | using namespace p25::dfsi::frames::fsc; 21 | 22 | // --------------------------------------------------------------------------- 23 | // Public Class Members 24 | // --------------------------------------------------------------------------- 25 | 26 | /* Initializes a instance of the FSCSelChannel class. */ 27 | 28 | FSCSelChannel::FSCSelChannel() : FSCMessage(), 29 | m_rxChan(1U), 30 | m_txChan(1U) 31 | { 32 | m_messageId = FSCMessageType::FSC_SEL_CHAN; 33 | } 34 | 35 | /* Decode a FSC select channel frame. */ 36 | 37 | bool FSCSelChannel::decode(const uint8_t* data) 38 | { 39 | assert(data != nullptr); 40 | FSCMessage::decode(data); 41 | 42 | m_rxChan = data[3U]; // Receive Channel 43 | m_txChan = data[4U]; // Transmit Channel 44 | 45 | return true; 46 | } 47 | 48 | /* Encode a FSC select channel frame. */ 49 | 50 | void FSCSelChannel::encode(uint8_t* data) 51 | { 52 | assert(data != nullptr); 53 | FSCMessage::encode(data); 54 | 55 | data[3U] = m_rxChan; // Receive Channel 56 | data[4U] = m_txChan; // Transmit Channel 57 | } 58 | -------------------------------------------------------------------------------- /src/common/p25/kmm/KMMHello.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2025 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "Defines.h" 11 | #include "p25/P25Defines.h" 12 | #include "p25/kmm/KMMHello.h" 13 | #include "Log.h" 14 | 15 | using namespace p25; 16 | using namespace p25::defines; 17 | using namespace p25::kmm; 18 | 19 | #include 20 | 21 | // --------------------------------------------------------------------------- 22 | // Public Class Members 23 | // --------------------------------------------------------------------------- 24 | 25 | /* Initializes a new instance of the KMMHello class. */ 26 | 27 | KMMHello::KMMHello() : KMMFrame(), 28 | m_flag(KMM_HelloFlag::IDENT_ONLY) 29 | { 30 | m_messageId = KMM_MessageType::HELLO; 31 | m_respKind = KMM_ResponseKind::DELAYED; 32 | } 33 | 34 | /* Finalizes a instance of the KMMHello class. */ 35 | 36 | KMMHello::~KMMHello() = default; 37 | 38 | /* Decode a KMM modify key. */ 39 | 40 | bool KMMHello::decode(const uint8_t* data) 41 | { 42 | assert(data != nullptr); 43 | 44 | KMMFrame::decodeHeader(data); 45 | 46 | m_flag = data[10U]; // Hello Flag 47 | 48 | return true; 49 | } 50 | 51 | /* Encode a KMM modify key. */ 52 | 53 | void KMMHello::encode(uint8_t* data) 54 | { 55 | assert(data != nullptr); 56 | m_messageLength = KMM_HELLO_LENGTH; 57 | 58 | KMMFrame::encodeHeader(data); 59 | 60 | data[10U] = m_flag; // Hello Flag 61 | } 62 | 63 | // --------------------------------------------------------------------------- 64 | // Protected Class Members 65 | // --------------------------------------------------------------------------- 66 | 67 | /* Internal helper to copy the the class. */ 68 | 69 | void KMMHello::copy(const KMMHello& data) 70 | { 71 | KMMFrame::copy(data); 72 | 73 | m_flag = data.m_flag; 74 | } 75 | -------------------------------------------------------------------------------- /src/common/p25/kmm/KMMNoService.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2025 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "Defines.h" 11 | #include "p25/P25Defines.h" 12 | #include "p25/kmm/KMMNoService.h" 13 | #include "Log.h" 14 | 15 | using namespace p25; 16 | using namespace p25::defines; 17 | using namespace p25::kmm; 18 | 19 | #include 20 | 21 | // --------------------------------------------------------------------------- 22 | // Public Class Members 23 | // --------------------------------------------------------------------------- 24 | 25 | /* Initializes a new instance of the KMMNoService class. */ 26 | 27 | KMMNoService::KMMNoService() : KMMFrame() 28 | { 29 | m_messageId = KMM_MessageType::NO_SERVICE; 30 | m_respKind = KMM_ResponseKind::NONE; 31 | } 32 | 33 | /* Finalizes a instance of the KMMNoService class. */ 34 | 35 | KMMNoService::~KMMNoService() = default; 36 | 37 | /* Decode a KMM modify key. */ 38 | 39 | bool KMMNoService::decode(const uint8_t* data) 40 | { 41 | assert(data != nullptr); 42 | 43 | KMMFrame::decodeHeader(data); 44 | 45 | return true; 46 | } 47 | 48 | /* Encode a KMM modify key. */ 49 | 50 | void KMMNoService::encode(uint8_t* data) 51 | { 52 | assert(data != nullptr); 53 | m_messageLength = KMM_NO_SERVICE_LENGTH; 54 | 55 | KMMFrame::encodeHeader(data); 56 | } 57 | 58 | // --------------------------------------------------------------------------- 59 | // Protected Class Members 60 | // --------------------------------------------------------------------------- 61 | 62 | /* Internal helper to copy the the class. */ 63 | 64 | void KMMNoService::copy(const KMMNoService& data) 65 | { 66 | KMMFrame::copy(data); 67 | } 68 | -------------------------------------------------------------------------------- /src/common/p25/kmm/KMMZeroize.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2025 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "Defines.h" 11 | #include "p25/P25Defines.h" 12 | #include "p25/kmm/KMMZeroize.h" 13 | #include "Log.h" 14 | 15 | using namespace p25; 16 | using namespace p25::defines; 17 | using namespace p25::kmm; 18 | 19 | #include 20 | 21 | // --------------------------------------------------------------------------- 22 | // Public Class Members 23 | // --------------------------------------------------------------------------- 24 | 25 | /* Initializes a new instance of the KMMZeroize class. */ 26 | 27 | KMMZeroize::KMMZeroize() : KMMFrame() 28 | { 29 | m_messageId = KMM_MessageType::ZEROIZE_CMD; 30 | m_respKind = KMM_ResponseKind::NONE; 31 | } 32 | 33 | /* Finalizes a instance of the KMMZeroize class. */ 34 | 35 | KMMZeroize::~KMMZeroize() = default; 36 | 37 | /* Decode a KMM modify key. */ 38 | 39 | bool KMMZeroize::decode(const uint8_t* data) 40 | { 41 | assert(data != nullptr); 42 | 43 | KMMFrame::decodeHeader(data); 44 | 45 | return true; 46 | } 47 | 48 | /* Encode a KMM modify key. */ 49 | 50 | void KMMZeroize::encode(uint8_t* data) 51 | { 52 | assert(data != nullptr); 53 | m_messageLength = KMM_ZEROIZE_LENGTH; 54 | 55 | KMMFrame::encodeHeader(data); 56 | } 57 | 58 | // --------------------------------------------------------------------------- 59 | // Protected Class Members 60 | // --------------------------------------------------------------------------- 61 | 62 | /* Internal helper to copy the the class. */ 63 | 64 | void KMMZeroize::copy(const KMMZeroize& data) 65 | { 66 | KMMFrame::copy(data); 67 | } 68 | -------------------------------------------------------------------------------- /src/common/p25/lc/tdulc/LC_CALL_TERM.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2022,2024,2025 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "Defines.h" 11 | #include "p25/lc/tdulc/LC_CALL_TERM.h" 12 | 13 | using namespace p25; 14 | using namespace p25::defines; 15 | using namespace p25::lc; 16 | using namespace p25::lc::tdulc; 17 | 18 | #include 19 | 20 | // --------------------------------------------------------------------------- 21 | // Public Class Members 22 | // --------------------------------------------------------------------------- 23 | 24 | /* Initializes a new instance of the LC_CALL_TERM class. */ 25 | 26 | LC_CALL_TERM::LC_CALL_TERM() : TDULC() 27 | { 28 | m_lco = LCO::CALL_TERM; 29 | } 30 | 31 | /* Decode a terminator data unit w/ link control. */ 32 | 33 | bool LC_CALL_TERM::decode(const uint8_t* data) 34 | { 35 | assert(data != nullptr); 36 | 37 | uint8_t rs[P25_TDULC_LENGTH_BYTES + 1U]; 38 | ::memset(rs, 0x00U, P25_TDULC_LENGTH_BYTES); 39 | 40 | bool ret = TDULC::decode(data, rs); 41 | if (!ret) 42 | return false; 43 | 44 | ulong64_t rsValue = TDULC::toValue(rs); 45 | 46 | m_implicit = true; 47 | m_dstId = (uint32_t)(rsValue & 0xFFFFFFU); // Target Address 48 | 49 | return true; 50 | } 51 | 52 | /* Encode a terminator data unit w/ link control. */ 53 | 54 | void LC_CALL_TERM::encode(uint8_t* data) 55 | { 56 | assert(data != nullptr); 57 | 58 | ulong64_t rsValue = 0U; 59 | 60 | m_implicit = true; 61 | 62 | rsValue = 0U; 63 | rsValue = (rsValue << 24) + m_dstId; // Target Address 64 | 65 | std::unique_ptr rs = TDULC::fromValue(rsValue); 66 | TDULC::encode(data, rs.get()); 67 | } 68 | -------------------------------------------------------------------------------- /src/common/p25/lc/tdulc/LC_CALL_TERM.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2022 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | /** 11 | * @file LC_CALL_TERM.h 12 | * @ingroup p25_lc 13 | * @file LC_CALL_TERM.cpp 14 | * @ingroup p25_lc 15 | */ 16 | #if !defined(__P25_LC_TSBK__LC_CALL_TERM_H__) 17 | #define __P25_LC_TSBK__LC_CALL_TERM_H__ 18 | 19 | #include "common/Defines.h" 20 | #include "common/p25/lc/TDULC.h" 21 | 22 | namespace p25 23 | { 24 | namespace lc 25 | { 26 | namespace tdulc 27 | { 28 | // --------------------------------------------------------------------------- 29 | // Class Declaration 30 | // --------------------------------------------------------------------------- 31 | 32 | /** 33 | * @brief Implements CALL TERM - Call Termination or Cancellation 34 | * @ingroup p25_lc 35 | */ 36 | class HOST_SW_API LC_CALL_TERM : public TDULC { 37 | public: 38 | /** 39 | * @brief Initializes a new instance of the LC_CALL_TERM class. 40 | */ 41 | LC_CALL_TERM(); 42 | 43 | /** 44 | * @brief Decode a terminator data unit w/ link control. 45 | * @param[in] data Buffer containing a TDULC to decode. 46 | * @returns bool True, if TDULC decoded, otherwise false. 47 | */ 48 | bool decode(const uint8_t* data) override; 49 | /** 50 | * @brief Encode a terminator data unit w/ link control. 51 | * @param[out] data Buffer to encode a TDULC. 52 | */ 53 | void encode(uint8_t* data) override; 54 | }; 55 | } // namespace tdulc 56 | } // namespace lc 57 | } // namespace p25 58 | 59 | #endif // __P25_LC_TSBK__LC_CALL_TERM_H__ 60 | -------------------------------------------------------------------------------- /src/common/p25/lc/tdulc/LC_CONV_FALLBACK.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2022,2024 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "Defines.h" 11 | #include "p25/lc/tdulc/LC_CONV_FALLBACK.h" 12 | 13 | using namespace p25; 14 | using namespace p25::defines; 15 | using namespace p25::lc; 16 | using namespace p25::lc::tdulc; 17 | 18 | #include 19 | 20 | // --------------------------------------------------------------------------- 21 | // Public Class Members 22 | // --------------------------------------------------------------------------- 23 | 24 | /* Initializes a new instance of the LC_CONV_FALLBACK class. */ 25 | 26 | LC_CONV_FALLBACK::LC_CONV_FALLBACK() : TDULC() 27 | { 28 | m_lco = LCO::CONV_FALLBACK; 29 | } 30 | 31 | /* Decode a terminator data unit w/ link control. */ 32 | 33 | bool LC_CONV_FALLBACK::decode(const uint8_t* data) 34 | { 35 | assert(data != nullptr); 36 | 37 | /* stub */ 38 | 39 | return true; 40 | } 41 | 42 | /* Encode a terminator data unit w/ link control. */ 43 | 44 | void LC_CONV_FALLBACK::encode(uint8_t* data) 45 | { 46 | assert(data != nullptr); 47 | 48 | ulong64_t rsValue = 0U; 49 | 50 | rsValue = (rsValue << 48) + m_siteData.channelId(); // Channel ID 6 51 | rsValue = (rsValue << 40) + m_siteData.channelId(); // Channel ID 5 52 | rsValue = (rsValue << 32) + m_siteData.channelId(); // Channel ID 4 53 | rsValue = (rsValue << 24) + m_siteData.channelId(); // Channel ID 3 54 | rsValue = (rsValue << 16) + m_siteData.channelId(); // Channel ID 2 55 | rsValue = (rsValue << 8) + m_siteData.channelId(); // Channel ID 1 56 | 57 | std::unique_ptr rs = TDULC::fromValue(rsValue); 58 | TDULC::encode(data, rs.get()); 59 | } 60 | -------------------------------------------------------------------------------- /src/common/p25/lc/tdulc/LC_CONV_FALLBACK.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2022 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | /** 11 | * @file LC_CONV_FALLBACK.h 12 | * @ingroup p25_lc 13 | * @file LC_CONV_FALLBACK.cpp 14 | * @ingroup p25_lc 15 | */ 16 | #if !defined(__P25_LC_TSBK__LC_CONV_FALLBACK_H__) 17 | #define __P25_LC_TSBK__LC_CONV_FALLBACK_H__ 18 | 19 | #include "common/Defines.h" 20 | #include "common/p25/lc/TDULC.h" 21 | 22 | namespace p25 23 | { 24 | namespace lc 25 | { 26 | namespace tdulc 27 | { 28 | // --------------------------------------------------------------------------- 29 | // Class Declaration 30 | // --------------------------------------------------------------------------- 31 | 32 | /** 33 | * @brief Implements CONV FALLBACK - Conventional Fallback 34 | * @ingroup p25_lc 35 | */ 36 | class HOST_SW_API LC_CONV_FALLBACK : public TDULC { 37 | public: 38 | /** 39 | * @brief Initializes a new instance of the LC_CONV_FALLBACK class. 40 | */ 41 | LC_CONV_FALLBACK(); 42 | 43 | /** 44 | * @brief Decode a terminator data unit w/ link control. 45 | * @param[in] data Buffer containing a TDULC to decode. 46 | * @returns bool True, if TDULC decoded, otherwise false. 47 | */ 48 | bool decode(const uint8_t* data) override; 49 | /** 50 | * @brief Encode a terminator data unit w/ link control. 51 | * @param[out] data Buffer to encode a TDULC. 52 | */ 53 | void encode(uint8_t* data) override; 54 | }; 55 | } // namespace tdulc 56 | } // namespace lc 57 | } // namespace p25 58 | 59 | #endif // __P25_LC_TSBK__LC_CONV_FALLBACK_H__ 60 | -------------------------------------------------------------------------------- /src/common/p25/lc/tdulc/LC_FAILSOFT.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2023,2024 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "Defines.h" 11 | #include "p25/lc/tdulc/LC_FAILSOFT.h" 12 | 13 | using namespace p25; 14 | using namespace p25::defines; 15 | using namespace p25::lc; 16 | using namespace p25::lc::tdulc; 17 | 18 | #include 19 | 20 | // --------------------------------------------------------------------------- 21 | // Public Class Members 22 | // --------------------------------------------------------------------------- 23 | 24 | /* Initializes a new instance of the LC_FAILSOFT class. */ 25 | 26 | LC_FAILSOFT::LC_FAILSOFT() : TDULC() 27 | { 28 | m_lco = LCO::FAILSOFT; 29 | m_mfId = MFG_MOT; 30 | } 31 | 32 | /* Decode a terminator data unit w/ link control. */ 33 | 34 | bool LC_FAILSOFT::decode(const uint8_t* data) 35 | { 36 | assert(data != nullptr); 37 | 38 | /* stub */ 39 | 40 | return true; 41 | } 42 | 43 | /* Encode a terminator data unit w/ link control. */ 44 | 45 | void LC_FAILSOFT::encode(uint8_t* data) 46 | { 47 | assert(data != nullptr); 48 | 49 | ulong64_t rsValue = 0U; 50 | 51 | rsValue = m_mfId; 52 | rsValue = (rsValue << 56); 53 | 54 | std::unique_ptr rs = TDULC::fromValue(rsValue); 55 | TDULC::encode(data, rs.get()); 56 | } 57 | -------------------------------------------------------------------------------- /src/common/p25/lc/tdulc/LC_FAILSOFT.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2023 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | /** 11 | * @file LC_FAILSOFT.h 12 | * @ingroup p25_lc 13 | * @file LC_FAILSOFT.cpp 14 | * @ingroup p25_lc 15 | */ 16 | #if !defined(__P25_LC_TSBK__LC_FAILSOFT_H__) 17 | #define __P25_LC_TSBK__LC_FAILSOFT_H__ 18 | 19 | #include "common/Defines.h" 20 | #include "common/p25/lc/TDULC.h" 21 | 22 | namespace p25 23 | { 24 | namespace lc 25 | { 26 | namespace tdulc 27 | { 28 | // --------------------------------------------------------------------------- 29 | // Class Declaration 30 | // --------------------------------------------------------------------------- 31 | 32 | /** 33 | * @brief Implements FAILSOFT - Failsoft 34 | * @ingroup p25_lc 35 | */ 36 | class HOST_SW_API LC_FAILSOFT : public TDULC { 37 | public: 38 | /** 39 | * @brief Initializes a new instance of the LC_FAILSOFT class. 40 | */ 41 | LC_FAILSOFT(); 42 | 43 | /** 44 | * @brief Decode a terminator data unit w/ link control. 45 | * @param[in] data Buffer containing a TDULC to decode. 46 | * @returns bool True, if TDULC decoded, otherwise false. 47 | */ 48 | bool decode(const uint8_t* data) override; 49 | /** 50 | * @brief Encode a terminator data unit w/ link control. 51 | * @param[out] data Buffer to encode a TDULC. 52 | */ 53 | void encode(uint8_t* data) override; 54 | }; 55 | } // namespace tdulc 56 | } // namespace lc 57 | } // namespace p25 58 | 59 | #endif // __P25_LC_TSBK__LC_FAILSOFT_H__ 60 | -------------------------------------------------------------------------------- /src/common/p25/lc/tdulc/LC_GROUP.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2022 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | /** 11 | * @file LC_GROUP.h 12 | * @ingroup p25_lc 13 | * @file LC_GROUP.cpp 14 | * @ingroup p25_lc 15 | */ 16 | #if !defined(__P25_LC_TSBK__LC_GROUP_H__) 17 | #define __P25_LC_TSBK__LC_GROUP_H__ 18 | 19 | #include "common/Defines.h" 20 | #include "common/p25/lc/TDULC.h" 21 | 22 | namespace p25 23 | { 24 | namespace lc 25 | { 26 | namespace tdulc 27 | { 28 | // --------------------------------------------------------------------------- 29 | // Class Declaration 30 | // --------------------------------------------------------------------------- 31 | 32 | /** 33 | * @brief Implements GRP VCH USER - Group Voice Channel User 34 | * @ingroup p25_lc 35 | */ 36 | class HOST_SW_API LC_GROUP : public TDULC { 37 | public: 38 | /** 39 | * @brief Initializes a new instance of the LC_GROUP class. 40 | */ 41 | LC_GROUP(); 42 | 43 | /** 44 | * @brief Decode a terminator data unit w/ link control. 45 | * @param[in] data Buffer containing a TDULC to decode. 46 | * @returns bool True, if TDULC decoded, otherwise false. 47 | */ 48 | bool decode(const uint8_t* data) override; 49 | /** 50 | * @brief Encode a terminator data unit w/ link control. 51 | * @param[out] data Buffer to encode a TDULC. 52 | */ 53 | void encode(uint8_t* data) override; 54 | }; 55 | } // namespace tdulc 56 | } // namespace lc 57 | } // namespace p25 58 | 59 | #endif // __P25_LC_TSBK__LC_GROUP_H__ 60 | -------------------------------------------------------------------------------- /src/common/p25/lc/tdulc/LC_GROUP_UPDT.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2022,2024 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "Defines.h" 11 | #include "p25/lc/tdulc/LC_GROUP_UPDT.h" 12 | 13 | using namespace p25; 14 | using namespace p25::defines; 15 | using namespace p25::lc; 16 | using namespace p25::lc::tdulc; 17 | 18 | #include 19 | 20 | // --------------------------------------------------------------------------- 21 | // Public Class Members 22 | // --------------------------------------------------------------------------- 23 | 24 | /* Initializes a new instance of the LC_GROUP_UPDT class. */ 25 | 26 | LC_GROUP_UPDT::LC_GROUP_UPDT() : TDULC() 27 | { 28 | m_lco = LCO::GROUP_UPDT; 29 | } 30 | 31 | /* Decode a terminator data unit w/ link control. */ 32 | 33 | bool LC_GROUP_UPDT::decode(const uint8_t* data) 34 | { 35 | assert(data != nullptr); 36 | 37 | /* stub */ 38 | 39 | return true; 40 | } 41 | 42 | /* Encode a terminator data unit w/ link control. */ 43 | 44 | void LC_GROUP_UPDT::encode(uint8_t* data) 45 | { 46 | assert(data != nullptr); 47 | 48 | ulong64_t rsValue = 0U; 49 | 50 | m_implicit = true; 51 | 52 | rsValue = m_siteData.channelId(); // Group A - Channel ID 53 | rsValue = (rsValue << 12) + m_grpVchNo; // Group A - Channel Number 54 | rsValue = (rsValue << 16) + m_dstId; // Group A - Talkgroup Address 55 | rsValue = (rsValue << 4) + m_siteData.channelId(); // Group B - Channel ID 56 | rsValue = (rsValue << 12) + m_grpVchNo; // Group B - Channel Number 57 | rsValue = (rsValue << 16) + m_dstId; // Group B - Talkgroup Address 58 | 59 | std::unique_ptr rs = TDULC::fromValue(rsValue); 60 | TDULC::encode(data, rs.get()); 61 | } 62 | -------------------------------------------------------------------------------- /src/common/p25/lc/tdulc/LC_GROUP_UPDT.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2022 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | /** 11 | * @file LC_GROUP_UPDT.h 12 | * @ingroup p25_lc 13 | * @file LC_GROUP_UPDT.cpp 14 | * @ingroup p25_lc 15 | */ 16 | #if !defined(__P25_LC_TSBK__LC_GROUP_UPDT_H__) 17 | #define __P25_LC_TSBK__LC_GROUP_UPDT_H__ 18 | 19 | #include "common/Defines.h" 20 | #include "common/p25/lc/TDULC.h" 21 | 22 | namespace p25 23 | { 24 | namespace lc 25 | { 26 | namespace tdulc 27 | { 28 | // --------------------------------------------------------------------------- 29 | // Class Declaration 30 | // --------------------------------------------------------------------------- 31 | 32 | /** 33 | * @brief Implements GRP VCH UPDT - Group Voice Channel Update 34 | * @ingroup p25_lc 35 | */ 36 | class HOST_SW_API LC_GROUP_UPDT : public TDULC { 37 | public: 38 | /** 39 | * @brief Initializes a new instance of the LC_GROUP_UPDT class. 40 | */ 41 | LC_GROUP_UPDT(); 42 | 43 | /** 44 | * @brief Decode a terminator data unit w/ link control. 45 | * @param[in] data Buffer containing a TDULC to decode. 46 | * @returns bool True, if TDULC decoded, otherwise false. 47 | */ 48 | bool decode(const uint8_t* data) override; 49 | /** 50 | * @brief Encode a terminator data unit w/ link control. 51 | * @param[out] data Buffer to encode a TDULC. 52 | */ 53 | void encode(uint8_t* data) override; 54 | }; 55 | } // namespace tdulc 56 | } // namespace lc 57 | } // namespace p25 58 | 59 | #endif // __P25_LC_TSBK__LC_GROUP_UPDT_H__ 60 | -------------------------------------------------------------------------------- /src/common/p25/lc/tdulc/LC_IDEN_UP.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /** 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2022 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | /** 11 | * @file LC_IDEN_UP.h 12 | * @ingroup p25_lc 13 | * @file LC_IDEN_UP.cpp 14 | * @ingroup p25_lc 15 | */ 16 | #if !defined(__P25_LC_TSBK__LC_IDEN_UP_H__) 17 | #define __P25_LC_TSBK__LC_IDEN_UP_H__ 18 | 19 | #include "common/Defines.h" 20 | #include "common/p25/lc/TDULC.h" 21 | 22 | namespace p25 23 | { 24 | namespace lc 25 | { 26 | namespace tdulc 27 | { 28 | // --------------------------------------------------------------------------- 29 | // Class Declaration 30 | // --------------------------------------------------------------------------- 31 | 32 | /** 33 | * @brief Implements IDEN UP - Channel Identifier Update 34 | * @ingroup p25_lc 35 | */ 36 | class HOST_SW_API LC_IDEN_UP : public TDULC { 37 | public: 38 | /** 39 | * @brief Initializes a new instance of the LC_IDEN_UP class. 40 | */ 41 | LC_IDEN_UP(); 42 | 43 | /** 44 | * @brief Decode a terminator data unit w/ link control. 45 | * @param[in] data Buffer containing a TDULC to decode. 46 | * @returns bool True, if TDULC decoded, otherwise false. 47 | */ 48 | bool decode(const uint8_t* data) override; 49 | /** 50 | * @brief Encode a terminator data unit w/ link control. 51 | * @param[out] data Buffer to encode a TDULC. 52 | */ 53 | void encode(uint8_t* data) override; 54 | }; 55 | } // namespace tdulc 56 | } // namespace lc 57 | } // namespace p25 58 | 59 | #endif // __P25_LC_TSBK__LC_IDEN_UP_H__ 60 | -------------------------------------------------------------------------------- /src/common/p25/lc/tdulc/LC_NET_STS_BCAST.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2022,2024 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "Defines.h" 11 | #include "p25/lc/tdulc/LC_NET_STS_BCAST.h" 12 | 13 | using namespace p25; 14 | using namespace p25::defines; 15 | using namespace p25::lc; 16 | using namespace p25::lc::tdulc; 17 | 18 | #include 19 | 20 | // --------------------------------------------------------------------------- 21 | // Public Class Members 22 | // --------------------------------------------------------------------------- 23 | 24 | /* Initializes a new instance of the LC_NET_STS_BCAST class. */ 25 | 26 | LC_NET_STS_BCAST::LC_NET_STS_BCAST() : TDULC() 27 | { 28 | m_lco = LCO::NET_STS_BCAST; 29 | } 30 | 31 | /* Decode a terminator data unit w/ link control. */ 32 | 33 | bool LC_NET_STS_BCAST::decode(const uint8_t* data) 34 | { 35 | assert(data != nullptr); 36 | 37 | /* stub */ 38 | 39 | return true; 40 | } 41 | 42 | /* Encode a terminator data unit w/ link control. */ 43 | 44 | void LC_NET_STS_BCAST::encode(uint8_t* data) 45 | { 46 | assert(data != nullptr); 47 | 48 | ulong64_t rsValue = 0U; 49 | 50 | m_implicit = true; 51 | 52 | rsValue = (rsValue << 20) + m_siteData.netId(); // Network ID 53 | rsValue = (rsValue << 12) + m_siteData.sysId(); // System ID 54 | rsValue = (rsValue << 4) + m_siteData.channelId(); // Channel ID 55 | rsValue = (rsValue << 12) + m_siteData.channelNo(); // Channel Number 56 | rsValue = (rsValue << 8) + m_siteData.serviceClass(); // System Service Class 57 | 58 | std::unique_ptr rs = TDULC::fromValue(rsValue); 59 | TDULC::encode(data, rs.get()); 60 | } 61 | -------------------------------------------------------------------------------- /src/common/p25/lc/tdulc/LC_NET_STS_BCAST.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2022 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | /** 11 | * @file LC_NET_STS_BCAST.h 12 | * @ingroup p25_lc 13 | * @file LC_NET_STS_BCAST.cpp 14 | * @ingroup p25_lc 15 | */ 16 | #if !defined(__P25_LC_TSBK__LC_NET_STS_BCAST_H__) 17 | #define __P25_LC_TSBK__LC_NET_STS_BCAST_H__ 18 | 19 | #include "common/Defines.h" 20 | #include "common/p25/lc/TDULC.h" 21 | 22 | namespace p25 23 | { 24 | namespace lc 25 | { 26 | namespace tdulc 27 | { 28 | // --------------------------------------------------------------------------- 29 | // Class Declaration 30 | // --------------------------------------------------------------------------- 31 | 32 | /** 33 | * @brief Implements NET STS BCAST - Network Status Broadcast 34 | * @ingroup p25_lc 35 | */ 36 | class HOST_SW_API LC_NET_STS_BCAST : public TDULC { 37 | public: 38 | /** 39 | * @brief Initializes a new instance of the LC_NET_STS_BCAST class. 40 | */ 41 | LC_NET_STS_BCAST(); 42 | 43 | /** 44 | * @brief Decode a terminator data unit w/ link control. 45 | * @param[in] data Buffer containing a TDULC to decode. 46 | * @returns bool True, if TDULC decoded, otherwise false. 47 | */ 48 | bool decode(const uint8_t* data) override; 49 | /** 50 | * @brief Encode a terminator data unit w/ link control. 51 | * @param[out] data Buffer to encode a TDULC. 52 | */ 53 | void encode(uint8_t* data) override; 54 | }; 55 | } // namespace tdulc 56 | } // namespace lc 57 | } // namespace p25 58 | 59 | #endif // __P25_LC_TSBK__LC_NET_STS_BCAST_H__ 60 | -------------------------------------------------------------------------------- /src/common/p25/lc/tdulc/LC_PRIVATE.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2022 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | /** 11 | * @file LC_PRIVATE.h 12 | * @ingroup p25_lc 13 | * @file LC_PRIVATE.cpp 14 | * @ingroup p25_lc 15 | */ 16 | #if !defined(__P25_LC_TSBK__LC_PRIVATE_H__) 17 | #define __P25_LC_TSBK__LC_PRIVATE_H__ 18 | 19 | #include "common/Defines.h" 20 | #include "common/p25/lc/TDULC.h" 21 | 22 | namespace p25 23 | { 24 | namespace lc 25 | { 26 | namespace tdulc 27 | { 28 | // --------------------------------------------------------------------------- 29 | // Class Declaration 30 | // --------------------------------------------------------------------------- 31 | 32 | /** 33 | * @brief Implements UU VCH USER - Unit-to-Unit Voice Channel User 34 | * @ingroup p25_lc 35 | */ 36 | class HOST_SW_API LC_PRIVATE : public TDULC { 37 | public: 38 | /** 39 | * @brief Initializes a new instance of the LC_PRIVATE class. 40 | */ 41 | LC_PRIVATE(); 42 | 43 | /** 44 | * @brief Decode a terminator data unit w/ link control. 45 | * @param[in] data Buffer containing a TDULC to decode. 46 | * @returns bool True, if TDULC decoded, otherwise false. 47 | */ 48 | bool decode(const uint8_t* data) override; 49 | /** 50 | * @brief Encode a terminator data unit w/ link control. 51 | * @param[out] data Buffer to encode a TDULC. 52 | */ 53 | void encode(uint8_t* data) override; 54 | }; 55 | } // namespace tdulc 56 | } // namespace lc 57 | } // namespace p25 58 | 59 | #endif // __P25_LC_TSBK__LC_PRIVATE_H__ 60 | -------------------------------------------------------------------------------- /src/common/p25/lc/tdulc/LC_RFSS_STS_BCAST.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2022 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | /** 11 | * @file LC_RFSS_STS_BCAST.h 12 | * @ingroup p25_lc 13 | * @file LC_RFSS_STS_BCAST.cpp 14 | * @ingroup p25_lc 15 | */ 16 | #if !defined(__P25_LC_TSBK__LC_RFSS_STS_BCAST_H__) 17 | #define __P25_LC_TSBK__LC_RFSS_STS_BCAST_H__ 18 | 19 | #include "common/Defines.h" 20 | #include "common/p25/lc/TDULC.h" 21 | 22 | namespace p25 23 | { 24 | namespace lc 25 | { 26 | namespace tdulc 27 | { 28 | // --------------------------------------------------------------------------- 29 | // Class Declaration 30 | // --------------------------------------------------------------------------- 31 | 32 | /** 33 | * @brief Implements RFSS STS BCAST - RFSS Status Broadcast 34 | * @ingroup p25_lc 35 | */ 36 | class HOST_SW_API LC_RFSS_STS_BCAST : public TDULC { 37 | public: 38 | /** 39 | * @brief Initializes a new instance of the LC_RFSS_STS_BCAST class. 40 | */ 41 | LC_RFSS_STS_BCAST(); 42 | 43 | /** 44 | * @brief Decode a terminator data unit w/ link control. 45 | * @param[in] data Buffer containing a TDULC to decode. 46 | * @returns bool True, if TDULC decoded, otherwise false. 47 | */ 48 | bool decode(const uint8_t* data) override; 49 | /** 50 | * @brief Encode a terminator data unit w/ link control. 51 | * @param[out] data Buffer to encode a TDULC. 52 | */ 53 | void encode(uint8_t* data) override; 54 | }; 55 | } // namespace tdulc 56 | } // namespace lc 57 | } // namespace p25 58 | 59 | #endif // __P25_LC_TSBK__LC_RFSS_STS_BCAST_H__ 60 | -------------------------------------------------------------------------------- /src/common/p25/lc/tdulc/LC_SYS_SRV_BCAST.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2022,2024 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "Defines.h" 11 | #include "p25/lc/tdulc/LC_SYS_SRV_BCAST.h" 12 | 13 | using namespace p25; 14 | using namespace p25::defines; 15 | using namespace p25::lc; 16 | using namespace p25::lc::tdulc; 17 | 18 | #include 19 | 20 | // --------------------------------------------------------------------------- 21 | // Public Class Members 22 | // --------------------------------------------------------------------------- 23 | 24 | /* Initializes a new instance of the LC_SYS_SRV_BCAST class. */ 25 | 26 | LC_SYS_SRV_BCAST::LC_SYS_SRV_BCAST() : TDULC() 27 | { 28 | m_lco = LCO::SYS_SRV_BCAST; 29 | } 30 | 31 | /* Decode a terminator data unit w/ link control. */ 32 | 33 | bool LC_SYS_SRV_BCAST::decode(const uint8_t* data) 34 | { 35 | assert(data != nullptr); 36 | 37 | /* stub */ 38 | 39 | return true; 40 | } 41 | 42 | /* Encode a terminator data unit w/ link control. */ 43 | 44 | void LC_SYS_SRV_BCAST::encode(uint8_t* data) 45 | { 46 | assert(data != nullptr); 47 | 48 | const uint32_t services = (m_siteData.netActive()) ? SystemService::NET_ACTIVE : 0U | SYS_SRV_DEFAULT; 49 | 50 | ulong64_t rsValue = 0U; 51 | 52 | m_implicit = true; 53 | 54 | rsValue = 0U; 55 | rsValue = (rsValue << 16) + services; // System Services Available 56 | rsValue = (rsValue << 24) + services; // System Services Supported 57 | 58 | std::unique_ptr rs = TDULC::fromValue(rsValue); 59 | TDULC::encode(data, rs.get()); 60 | } 61 | -------------------------------------------------------------------------------- /src/common/p25/lc/tdulc/LC_SYS_SRV_BCAST.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2022 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | /** 11 | * @file LC_SYS_SRV_BCAST.h 12 | * @ingroup p25_lc 13 | * @file LC_SYS_SRV_BCAST.cpp 14 | * @ingroup p25_lc 15 | */ 16 | #if !defined(__P25_LC_TSBK__LC_SYS_SRV_BCAST_H__) 17 | #define __P25_LC_TSBK__LC_SYS_SRV_BCAST_H__ 18 | 19 | #include "common/Defines.h" 20 | #include "common/p25/lc/TDULC.h" 21 | 22 | namespace p25 23 | { 24 | namespace lc 25 | { 26 | namespace tdulc 27 | { 28 | // --------------------------------------------------------------------------- 29 | // Class Declaration 30 | // --------------------------------------------------------------------------- 31 | 32 | /** 33 | * @brief Implements SYS SRV BCAST - System Service Broadcast 34 | * @ingroup p25_lc 35 | */ 36 | class HOST_SW_API LC_SYS_SRV_BCAST : public TDULC { 37 | public: 38 | /** 39 | * @brief Initializes a new instance of the LC_SYS_SRV_BCAST class. 40 | */ 41 | LC_SYS_SRV_BCAST(); 42 | 43 | /** 44 | * @brief Decode a terminator data unit w/ link control. 45 | * @param[in] data Buffer containing a TDULC to decode. 46 | * @returns bool True, if TDULC decoded, otherwise false. 47 | */ 48 | bool decode(const uint8_t* data) override; 49 | /** 50 | * @brief Encode a terminator data unit w/ link control. 51 | * @param[out] data Buffer to encode a TDULC. 52 | */ 53 | void encode(uint8_t* data) override; 54 | }; 55 | } // namespace tdulc 56 | } // namespace lc 57 | } // namespace p25 58 | 59 | #endif // __P25_LC_TSBK__LC_SYS_SRV_BCAST_H__ 60 | -------------------------------------------------------------------------------- /src/common/p25/lc/tdulc/LC_TEL_INT_VCH_USER.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2022 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | /** 11 | * @file LC_TEL_INT_VCH_USER.h 12 | * @ingroup p25_lc 13 | * @file LC_TEL_INT_VCH_USER.cpp 14 | * @ingroup p25_lc 15 | */ 16 | #if !defined(__P25_LC_TSBK__LC_TEL_INT_VCH_USER_H__) 17 | #define __P25_LC_TSBK__LC_TEL_INT_VCH_USER_H__ 18 | 19 | #include "common/Defines.h" 20 | #include "common/p25/lc/TDULC.h" 21 | 22 | namespace p25 23 | { 24 | namespace lc 25 | { 26 | namespace tdulc 27 | { 28 | // --------------------------------------------------------------------------- 29 | // Class Declaration 30 | // --------------------------------------------------------------------------- 31 | 32 | /** 33 | * @brief Implements TEL INT VCH USER - Telephone Interconnect Voice Channel User 34 | * @ingroup p25_lc 35 | */ 36 | class HOST_SW_API LC_TEL_INT_VCH_USER : public TDULC { 37 | public: 38 | /** 39 | * @brief Initializes a new instance of the LC_TEL_INT_VCH_USER class. 40 | */ 41 | LC_TEL_INT_VCH_USER(); 42 | 43 | /** 44 | * @brief Decode a terminator data unit w/ link control. 45 | * @param[in] data Buffer containing a TDULC to decode. 46 | * @returns bool True, if TDULC decoded, otherwise false. 47 | */ 48 | bool decode(const uint8_t* data) override; 49 | /** 50 | * @brief Encode a terminator data unit w/ link control. 51 | * @param[out] data Buffer to encode a TDULC. 52 | */ 53 | void encode(uint8_t* data) override; 54 | }; 55 | } // namespace tdulc 56 | } // namespace lc 57 | } // namespace p25 58 | 59 | #endif // __P25_LC_TSBK__LC_TEL_INT_VCH_USER_H__ 60 | -------------------------------------------------------------------------------- /src/common/p25/lc/tsbk/ISP_AUTH_SU_DMD.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2022,2024 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "Defines.h" 11 | #include "p25/lc/tsbk/ISP_AUTH_SU_DMD.h" 12 | 13 | using namespace p25; 14 | using namespace p25::defines; 15 | using namespace p25::lc; 16 | using namespace p25::lc::tsbk; 17 | 18 | #include 19 | 20 | // --------------------------------------------------------------------------- 21 | // Public Class Members 22 | // --------------------------------------------------------------------------- 23 | 24 | /* Initializes a new instance of the ISP_AUTH_SU_DMD class. */ 25 | 26 | ISP_AUTH_SU_DMD::ISP_AUTH_SU_DMD() : TSBK() 27 | { 28 | m_lco = TSBKO::ISP_AUTH_SU_DMD; 29 | } 30 | 31 | /* Decode a trunking signalling block. */ 32 | 33 | bool ISP_AUTH_SU_DMD::decode(const uint8_t* data, bool rawTSBK) 34 | { 35 | assert(data != nullptr); 36 | 37 | uint8_t tsbk[P25_TSBK_LENGTH_BYTES + 1U]; 38 | ::memset(tsbk, 0x00U, P25_TSBK_LENGTH_BYTES); 39 | 40 | bool ret = TSBK::decode(data, tsbk, rawTSBK); 41 | if (!ret) 42 | return false; 43 | 44 | ulong64_t tsbkValue = TSBK::toValue(tsbk); 45 | 46 | m_srcId = (uint32_t)(tsbkValue & 0xFFFFFFU); // Source Radio Address 47 | 48 | return true; 49 | } 50 | 51 | /* Encode a trunking signalling block. */ 52 | 53 | void ISP_AUTH_SU_DMD::encode(uint8_t* data, bool rawTSBK, bool noTrellis) 54 | { 55 | assert(data != nullptr); 56 | 57 | /* stub */ 58 | } 59 | 60 | /* Returns a string that represents the current TSBK. */ 61 | 62 | std::string ISP_AUTH_SU_DMD::toString(bool isp) 63 | { 64 | return std::string("TSBKO, ISP_AUTH_SU_DMD (Authentication SU Demand)"); 65 | } 66 | -------------------------------------------------------------------------------- /src/common/p25/lc/tsbk/ISP_U_DEREG_REQ.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2022,2024 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "Defines.h" 11 | #include "p25/lc/tsbk/ISP_U_DEREG_REQ.h" 12 | 13 | using namespace p25; 14 | using namespace p25::defines; 15 | using namespace p25::lc; 16 | using namespace p25::lc::tsbk; 17 | 18 | #include 19 | 20 | // --------------------------------------------------------------------------- 21 | // Public Class Members 22 | // --------------------------------------------------------------------------- 23 | 24 | /* Initializes a new instance of the ISP_U_DEREG_REQ class. */ 25 | 26 | ISP_U_DEREG_REQ::ISP_U_DEREG_REQ() : TSBK() 27 | { 28 | m_lco = TSBKO::ISP_U_DEREG_REQ; 29 | } 30 | 31 | /* Decode a trunking signalling block. */ 32 | 33 | bool ISP_U_DEREG_REQ::decode(const uint8_t* data, bool rawTSBK) 34 | { 35 | assert(data != nullptr); 36 | 37 | uint8_t tsbk[P25_TSBK_LENGTH_BYTES + 1U]; 38 | ::memset(tsbk, 0x00U, P25_TSBK_LENGTH_BYTES); 39 | 40 | bool ret = TSBK::decode(data, tsbk, rawTSBK); 41 | if (!ret) 42 | return false; 43 | 44 | ulong64_t tsbkValue = TSBK::toValue(tsbk); 45 | 46 | m_netId = (uint32_t)((tsbkValue >> 36) & 0xFFFFFU); // Network ID 47 | m_sysId = (uint32_t)((tsbkValue >> 24) & 0xFFFU); // System ID 48 | m_srcId = (uint32_t)(tsbkValue & 0xFFFFFFU); // Source Radio Address 49 | 50 | return true; 51 | } 52 | 53 | /* Encode a trunking signalling block. */ 54 | 55 | void ISP_U_DEREG_REQ::encode(uint8_t* data, bool rawTSBK, bool noTrellis) 56 | { 57 | assert(data != nullptr); 58 | 59 | /* stub */ 60 | } 61 | 62 | /* Returns a string that represents the current TSBK. */ 63 | 64 | std::string ISP_U_DEREG_REQ::toString(bool isp) 65 | { 66 | return std::string("TSBKO, ISP_U_DEREG_REQ (Unit De-Registration Request)"); 67 | } 68 | -------------------------------------------------------------------------------- /src/common/p25/lc/tsbk/OSP_GRP_AFF_Q.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2022,2024 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "Defines.h" 11 | #include "p25/lc/tsbk/OSP_GRP_AFF_Q.h" 12 | 13 | using namespace p25; 14 | using namespace p25::defines; 15 | using namespace p25::lc; 16 | using namespace p25::lc::tsbk; 17 | 18 | #include 19 | 20 | // --------------------------------------------------------------------------- 21 | // Public Class Members 22 | // --------------------------------------------------------------------------- 23 | 24 | /* Initializes a new instance of the OSP_GRP_AFF_Q class. */ 25 | 26 | OSP_GRP_AFF_Q::OSP_GRP_AFF_Q() : TSBK() 27 | { 28 | m_lco = TSBKO::OSP_GRP_AFF_Q; 29 | } 30 | 31 | /* Decode a trunking signalling block. */ 32 | 33 | bool OSP_GRP_AFF_Q::decode(const uint8_t* data, bool rawTSBK) 34 | { 35 | assert(data != nullptr); 36 | 37 | /* stub */ 38 | 39 | return true; 40 | } 41 | 42 | /* Encode a trunking signalling block. */ 43 | 44 | void OSP_GRP_AFF_Q::encode(uint8_t* data, bool rawTSBK, bool noTrellis) 45 | { 46 | assert(data != nullptr); 47 | 48 | ulong64_t tsbkValue = 0U; 49 | 50 | tsbkValue = (tsbkValue << 24) + m_dstId; // Target Radio Address 51 | tsbkValue = (tsbkValue << 24) + m_srcId; // Source Radio Address 52 | 53 | std::unique_ptr tsbk = TSBK::fromValue(tsbkValue); 54 | TSBK::encode(data, tsbk.get(), rawTSBK, noTrellis); 55 | } 56 | 57 | /* Returns a string that represents the current TSBK. */ 58 | 59 | std::string OSP_GRP_AFF_Q::toString(bool isp) 60 | { 61 | return std::string("TSBKO, OSP_GRP_AFF_Q (Group Affiliation Query)"); 62 | } 63 | -------------------------------------------------------------------------------- /src/common/p25/lc/tsbk/OSP_MOT_PSH_CCH.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2022,2024 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "Defines.h" 11 | #include "p25/lc/tsbk/OSP_MOT_PSH_CCH.h" 12 | 13 | using namespace p25; 14 | using namespace p25::defines; 15 | using namespace p25::lc; 16 | using namespace p25::lc::tsbk; 17 | 18 | #include 19 | 20 | // --------------------------------------------------------------------------- 21 | // Public Class Members 22 | // --------------------------------------------------------------------------- 23 | 24 | /* Initializes a new instance of the OSP_MOT_PSH_CCH class. */ 25 | 26 | OSP_MOT_PSH_CCH::OSP_MOT_PSH_CCH() : TSBK() 27 | { 28 | m_lco = TSBKO::OSP_MOT_PSH_CCH; 29 | } 30 | 31 | /* Decode a trunking signalling block. */ 32 | 33 | bool OSP_MOT_PSH_CCH::decode(const uint8_t* data, bool rawTSBK) 34 | { 35 | assert(data != nullptr); 36 | 37 | /* stub */ 38 | 39 | return true; 40 | } 41 | 42 | /* Encode a trunking signalling block. */ 43 | 44 | void OSP_MOT_PSH_CCH::encode(uint8_t* data, bool rawTSBK, bool noTrellis) 45 | { 46 | assert(data != nullptr); 47 | 48 | ulong64_t tsbkValue = 0U; 49 | 50 | m_mfId = MFG_MOT; 51 | 52 | std::unique_ptr tsbk = TSBK::fromValue(tsbkValue); 53 | TSBK::encode(data, tsbk.get(), rawTSBK, noTrellis); 54 | } 55 | 56 | /* Returns a string that represents the current TSBK. */ 57 | 58 | std::string OSP_MOT_PSH_CCH::toString(bool isp) 59 | { 60 | return std::string("TSBKO, OSP_MOT_PSH_CCH (Motorola / Planned Control Channel Shutdown)"); 61 | } 62 | -------------------------------------------------------------------------------- /src/common/p25/lc/tsbk/OSP_SYS_SRV_BCAST.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2022,2024 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "Defines.h" 11 | #include "p25/lc/tsbk/OSP_SYS_SRV_BCAST.h" 12 | 13 | using namespace p25; 14 | using namespace p25::defines; 15 | using namespace p25::lc; 16 | using namespace p25::lc::tsbk; 17 | 18 | #include 19 | 20 | // --------------------------------------------------------------------------- 21 | // Public Class Members 22 | // --------------------------------------------------------------------------- 23 | 24 | /* Initializes a new instance of the OSP_SYS_SRV_BCAST class. */ 25 | 26 | OSP_SYS_SRV_BCAST::OSP_SYS_SRV_BCAST() : TSBK() 27 | { 28 | m_lco = TSBKO::OSP_SYS_SRV_BCAST; 29 | } 30 | 31 | /* Decode a trunking signalling block. */ 32 | 33 | bool OSP_SYS_SRV_BCAST::decode(const uint8_t* data, bool rawTSBK) 34 | { 35 | assert(data != nullptr); 36 | 37 | /* stub */ 38 | 39 | return true; 40 | } 41 | 42 | /* Encode a trunking signalling block. */ 43 | 44 | void OSP_SYS_SRV_BCAST::encode(uint8_t* data, bool rawTSBK, bool noTrellis) 45 | { 46 | assert(data != nullptr); 47 | 48 | const uint32_t services = (m_siteData.netActive()) ? SystemService::NET_ACTIVE : 0U | SYS_SRV_DEFAULT; 49 | 50 | ulong64_t tsbkValue = 0U; 51 | 52 | tsbkValue = (tsbkValue << 16) + services; // System Services Available 53 | tsbkValue = (tsbkValue << 24) + services; // System Services Supported 54 | 55 | std::unique_ptr tsbk = TSBK::fromValue(tsbkValue); 56 | TSBK::encode(data, tsbk.get(), rawTSBK, noTrellis); 57 | } 58 | 59 | /* Returns a string that represents the current TSBK. */ 60 | 61 | std::string OSP_SYS_SRV_BCAST::toString(bool isp) 62 | { 63 | return std::string("TSBKO, OSP_SYS_SRV_BCAST (System Service Broadcast)"); 64 | } 65 | -------------------------------------------------------------------------------- /src/common/p25/lc/tsbk/OSP_U_REG_CMD.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * @package DVM / Common Library 8 | * @license GPLv2 License (https://opensource.org/licenses/GPL-2.0) 9 | * 10 | * Copyright (C) 2022,2024 Bryan Biedenkapp, N2PLL 11 | * 12 | */ 13 | #include "Defines.h" 14 | #include "p25/lc/tsbk/OSP_U_REG_CMD.h" 15 | 16 | using namespace p25; 17 | using namespace p25::defines; 18 | using namespace p25::lc; 19 | using namespace p25::lc::tsbk; 20 | 21 | #include 22 | 23 | // --------------------------------------------------------------------------- 24 | // Public Class Members 25 | // --------------------------------------------------------------------------- 26 | 27 | /* Initializes a new instance of the OSP_U_REG_CMD class. */ 28 | 29 | OSP_U_REG_CMD::OSP_U_REG_CMD() : TSBK() 30 | { 31 | m_lco = TSBKO::OSP_U_REG_CMD; 32 | } 33 | 34 | /* Decode a trunking signalling block. */ 35 | 36 | bool OSP_U_REG_CMD::decode(const uint8_t* data, bool rawTSBK) 37 | { 38 | assert(data != nullptr); 39 | 40 | /* stub */ 41 | 42 | return true; 43 | } 44 | 45 | /* Encode a trunking signalling block. */ 46 | 47 | void OSP_U_REG_CMD::encode(uint8_t* data, bool rawTSBK, bool noTrellis) 48 | { 49 | assert(data != nullptr); 50 | 51 | ulong64_t tsbkValue = 0U; 52 | 53 | tsbkValue = (tsbkValue << 24) + m_dstId; // Target Radio Address 54 | tsbkValue = (tsbkValue << 24) + m_srcId; // Source Radio Address 55 | 56 | std::unique_ptr tsbk = TSBK::fromValue(tsbkValue); 57 | TSBK::encode(data, tsbk.get(), rawTSBK, noTrellis); 58 | } 59 | 60 | /* Returns a string that represents the current TSBK. */ 61 | 62 | std::string OSP_U_REG_CMD::toString(bool isp) 63 | { 64 | return std::string("TSBKO, OSP_U_REG_CMD (Unit Registration Command)"); 65 | } 66 | -------------------------------------------------------------------------------- /src/common/p25/sndcp/SNDCPCtxActReject.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2024 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "Defines.h" 11 | #include "p25/P25Defines.h" 12 | #include "p25/sndcp/SNDCPCtxActReject.h" 13 | #include "Log.h" 14 | 15 | using namespace p25; 16 | using namespace p25::defines; 17 | using namespace p25::sndcp; 18 | 19 | #include 20 | 21 | // --------------------------------------------------------------------------- 22 | // Public Class Members 23 | // --------------------------------------------------------------------------- 24 | 25 | /* Initializes a new instance of the SNDCPCtxActReject class. */ 26 | 27 | SNDCPCtxActReject::SNDCPCtxActReject() : SNDCPPacket(), 28 | m_rejectCode(SNDCPRejectReason::ANY_REASON) 29 | { 30 | m_pduType = SNDCP_PDUType::ACT_TDS_CTX_REJECT; 31 | } 32 | 33 | /* Decode a SNDCP context activation reject packet. */ 34 | 35 | bool SNDCPCtxActReject::decode(const uint8_t* data) 36 | { 37 | assert(data != nullptr); 38 | 39 | /* stub */ 40 | 41 | return true; 42 | } 43 | 44 | /* Encode a SNDCP context activation reject packet. */ 45 | 46 | void SNDCPCtxActReject::encode(uint8_t* data) 47 | { 48 | assert(data != nullptr); 49 | 50 | SNDCPPacket::encodeHeader(data, true); 51 | 52 | data[1U] = m_rejectCode; // Reject Code 53 | } 54 | 55 | /* Internal helper to copy the the class. */ 56 | 57 | void SNDCPCtxActReject::copy(const SNDCPCtxActReject& data) 58 | { 59 | m_rejectCode = data.m_rejectCode; 60 | } 61 | -------------------------------------------------------------------------------- /src/common/p25/sndcp/SNDCPCtxDeactivation.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2024 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "Defines.h" 11 | #include "p25/P25Defines.h" 12 | #include "p25/sndcp/SNDCPCtxDeactivation.h" 13 | #include "Log.h" 14 | 15 | using namespace p25; 16 | using namespace p25::defines; 17 | using namespace p25::sndcp; 18 | 19 | #include 20 | 21 | // --------------------------------------------------------------------------- 22 | // Public Class Members 23 | // --------------------------------------------------------------------------- 24 | 25 | /* Initializes a new instance of the SNDCPCtxDeactivation class. */ 26 | 27 | SNDCPCtxDeactivation::SNDCPCtxDeactivation() : SNDCPPacket(), 28 | m_deactType(SNDCPDeactivationType::DEACT_ALL) 29 | { 30 | m_pduType = SNDCP_PDUType::DEACT_TDS_CTX_REQ; 31 | } 32 | 33 | /* Decode a SNDCP context deactivation packet. */ 34 | 35 | bool SNDCPCtxDeactivation::decode(const uint8_t* data) 36 | { 37 | assert(data != nullptr); 38 | 39 | SNDCPPacket::decodeHeader(data, false); 40 | 41 | m_deactType = data[1U]; // Deactivation Type 42 | 43 | return true; 44 | } 45 | 46 | /* Encode a SNDCP context deactivation packet. */ 47 | 48 | void SNDCPCtxDeactivation::encode(uint8_t* data) 49 | { 50 | assert(data != nullptr); 51 | 52 | SNDCPPacket::encodeHeader(data, true); 53 | 54 | data[1U] = m_deactType; // Deactivation Type 55 | } 56 | 57 | /* Internal helper to copy the the class. */ 58 | 59 | void SNDCPCtxDeactivation::copy(const SNDCPCtxDeactivation& data) 60 | { 61 | m_deactType = data.m_deactType; 62 | } 63 | -------------------------------------------------------------------------------- /src/common/zlib/Compression.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Common Library 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2025 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | /** 11 | * @defgroup compression Compression Routines 12 | * @brief Defines and implements common compression routines. 13 | * @ingroup common 14 | * 15 | * @file Compression.h 16 | * @ingroup compression 17 | * @file Compression.cpp 18 | * @ingroup compression 19 | */ 20 | #if !defined(__COMPRESSION_H__) 21 | #define __COMPRESSION_H__ 22 | 23 | #include "common/Defines.h" 24 | 25 | namespace compress 26 | { 27 | // --------------------------------------------------------------------------- 28 | // Class Declaration 29 | // --------------------------------------------------------------------------- 30 | 31 | /** 32 | * @brief zlib Compression Helper. 33 | * @ingroup compression 34 | */ 35 | class HOST_SW_API Compression { 36 | public: 37 | /** 38 | * @brief Compress the given input buffer using zlib compression. 39 | * @param[in] buffer Buffer containing data to zlib compress. 40 | * @param[in] len Length of data to compress. 41 | * @param[out] compressedLen Length of compressed data. 42 | * @returns uint8_t* Buffer containing compressed data. 43 | */ 44 | static uint8_t* compress(const uint8_t* buffer, uint32_t len, uint32_t* compressedLen); 45 | 46 | /** 47 | * @brief Decompress the given input buffer using zlib compression. 48 | * @param[in] buffer Buffer containing zlib compressed data. 49 | * @param[in] len Length of compressed data. 50 | * @param[out] decompressedLen Length of decompressed data. 51 | * @returns uint8_t* Buffer containing decompressed data. 52 | */ 53 | static uint8_t* decompress(const uint8_t* buffer, uint32_t len, uint32_t* decompressedLen); 54 | }; 55 | } // namespace compress 56 | 57 | #endif // __COMPRESSION_H__ 58 | -------------------------------------------------------------------------------- /src/common/zlib/inffast.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Zlib 2 | /* inffast.h -- header to use inffast.c 3 | * Copyright (C) 1995-2003, 2010 Mark Adler 4 | * For conditions of distribution and use, see copyright notice in zlib.h 5 | */ 6 | 7 | /* WARNING: this file should *not* be used by applications. It is 8 | part of the implementation of the compression library and is 9 | subject to change. Applications should only use zlib.h. 10 | */ 11 | 12 | void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start); 13 | -------------------------------------------------------------------------------- /src/fne/ActivityLog.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Converged FNE Software 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2024 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | /** 11 | * @file ActivityLog.h 12 | * @ingroup fne 13 | * @file ActivityLog.cpp 14 | * @ingroup fne 15 | */ 16 | #if !defined(__ACTIVITY_LOG_H__) 17 | #define __ACTIVITY_LOG_H__ 18 | 19 | #include "Defines.h" 20 | 21 | #include 22 | 23 | // --------------------------------------------------------------------------- 24 | // Global Functions 25 | // --------------------------------------------------------------------------- 26 | 27 | /** 28 | * @brief Initializes the activity log. 29 | * @param filePath File path for the log file. 30 | * @param fileRoot Root name for log file. 31 | */ 32 | extern HOST_SW_API bool ActivityLogInitialise(const std::string& filePath, const std::string& fileRoot); 33 | /** 34 | * @brief Finalizes the activity log. 35 | */ 36 | extern HOST_SW_API void ActivityLogFinalise(); 37 | /** 38 | * @brief Writes a new entry to the activity log. 39 | * @param msg String format. 40 | * 41 | * This is a variable argument function. 42 | */ 43 | extern HOST_SW_API void ActivityLog(const char* msg, ...); 44 | 45 | #endif // __ACTIVITY_LOG_H__ 46 | -------------------------------------------------------------------------------- /src/fne/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0-only 2 | #/* 3 | # * Digital Voice Modem - Converged FNE Software 4 | # * GPLv2 Open Source. Use is subject to license terms. 5 | # * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | # * 7 | # * Copyright (C) 2024 Bryan Biedenkapp, N2PLL 8 | # * 9 | # */ 10 | file(GLOB dvmfne_SRC 11 | "src/fne/network/callhandler/*.h" 12 | "src/fne/network/callhandler/*.cpp" 13 | "src/fne/network/callhandler/packetdata/*.h" 14 | "src/fne/network/callhandler/packetdata/*.cpp" 15 | "src/fne/network/influxdb/*.h" 16 | "src/fne/network/influxdb/*.cpp" 17 | "src/fne/network/*.h" 18 | "src/fne/network/*.cpp" 19 | "src/fne/xml/*.h" 20 | "src/fne/*.h" 21 | "src/fne/*.cpp" 22 | ) 23 | -------------------------------------------------------------------------------- /src/fne/Defines.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Converged FNE Software 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2024 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | /** 11 | * @defgroup fne Fixed Network Equipment (dvmfne) 12 | * @brief Digital Voice Modem - Converged FNE Software 13 | * @details Network "core", this provides a central server for `dvmhost` instances to connect to and be networked with, allowing relay of traffic and other data between `dvmhost` instances and other `dvmfne` instances. 14 | * @ingroup fne 15 | * 16 | * @file Defines.h 17 | * @ingroup fne 18 | */ 19 | #if !defined(__DEFINES_H__) 20 | #define __DEFINES_H__ 21 | 22 | #include "common/Defines.h" 23 | 24 | // --------------------------------------------------------------------------- 25 | // Constants 26 | // --------------------------------------------------------------------------- 27 | 28 | #undef __PROG_NAME__ 29 | #define __PROG_NAME__ "Digital Voice Modem (DVM) Converged FNE" 30 | #undef __EXE_NAME__ 31 | #define __EXE_NAME__ "dvmfne" 32 | 33 | #undef __NETVER__ 34 | #define __NETVER__ "FNE_R" VERSION_MAJOR VERSION_REV VERSION_MINOR 35 | 36 | #undef DEFAULT_CONF_FILE 37 | #define DEFAULT_CONF_FILE "fne-config.yml" 38 | #undef DEFAULT_LOCK_FILE 39 | #define DEFAULT_LOCK_FILE "/tmp/dvmfne.lock" 40 | 41 | #endif // __DEFINES_H__ 42 | -------------------------------------------------------------------------------- /src/fne/FNEMain.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Converged FNE Software 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2020-2024 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | /** 11 | * @file FNEMain.h 12 | * @ingroup fne 13 | * @file FNEMain.cpp 14 | * @ingroup fne 15 | */ 16 | #if !defined(__FNE_MAIN_H__) 17 | #define __FNE_MAIN_H__ 18 | 19 | #include "Defines.h" 20 | 21 | #include 22 | 23 | // --------------------------------------------------------------------------- 24 | // Externs 25 | // --------------------------------------------------------------------------- 26 | 27 | /** @brief */ 28 | extern int g_signal; 29 | /** @brief */ 30 | extern std::string g_progExe; 31 | /** @brief */ 32 | extern std::string g_iniFile; 33 | /** @brief */ 34 | extern std::string g_lockFile; 35 | 36 | /** @brief (Global) Flag indicating foreground operation. */ 37 | extern bool g_foreground; 38 | /** @brief (Global) Flag indicating the FNE should stop immediately. */ 39 | extern bool g_killed; 40 | 41 | extern uint8_t* g_gitHashBytes; 42 | 43 | /** 44 | * @brief Helper to trigger a fatal error message. This will cause the program to terminate 45 | * immediately with an error message. 46 | * 47 | * @param msg String format. 48 | * 49 | * This is a variable argument function. 50 | */ 51 | extern HOST_SW_API void fatal(const char* msg, ...); 52 | 53 | #endif // __FNE_MAIN_H__ 54 | -------------------------------------------------------------------------------- /src/fne/network/RESTDefines.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Converged FNE Software 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2024 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | /** 11 | * @defgroup fne_rest FNE REST API 12 | * @brief Implementation for the FNE REST API. 13 | * @ingroup fne 14 | * 15 | * @file RESTDefines.h 16 | * @ingroup fne_rest 17 | */ 18 | #if !defined(__FNE_REST_DEFINES_H__) 19 | #define __FNE_REST_DEFINES_H__ 20 | 21 | #include "fne/Defines.h" 22 | #include "host/network/RESTDefines.h" 23 | 24 | // --------------------------------------------------------------------------- 25 | // Constants 26 | // --------------------------------------------------------------------------- 27 | 28 | #define FNE_GET_PEER_QUERY "/peer/query" 29 | #define FNE_GET_PEER_COUNT "/peer/count" 30 | #define FNE_PUT_PEER_RESET "/peer/reset" 31 | 32 | #define FNE_GET_RID_QUERY "/rid/query" 33 | #define FNE_PUT_RID_ADD "/rid/add" 34 | #define FNE_PUT_RID_DELETE "/rid/delete" 35 | #define FNE_GET_RID_COMMIT "/rid/commit" 36 | 37 | #define FNE_GET_TGID_QUERY "/tg/query" 38 | #define FNE_PUT_TGID_ADD "/tg/add" 39 | #define FNE_PUT_TGID_DELETE "/tg/delete" 40 | #define FNE_GET_TGID_COMMIT "/tg/commit" 41 | 42 | #define FNE_GET_PEER_LIST "/peer/list" 43 | #define FNE_PUT_PEER_ADD "/peer/add" 44 | #define FNE_PUT_PEER_DELETE "/peer/delete" 45 | #define FNE_GET_PEER_COMMIT "/peer/commit" 46 | 47 | #define FNE_GET_FORCE_UPDATE "/force-update" 48 | 49 | #define FNE_GET_RELOAD_TGS "/reload-tgs" 50 | #define FNE_GET_RELOAD_RIDS "/reload-rids" 51 | 52 | #define FNE_GET_AFF_LIST "/report-affiliations" 53 | 54 | #endif // __FNE_REST_DEFINES_H__ 55 | -------------------------------------------------------------------------------- /src/host/ActivityLog.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Modem Host Software 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2024 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | /** 11 | * @file ActivityLog.h 12 | * @ingroup host 13 | * @file ActivityLog.cpp 14 | * @ingroup host 15 | */ 16 | #if !defined(__ACTIVITY_LOG_H__) 17 | #define __ACTIVITY_LOG_H__ 18 | 19 | #include "Defines.h" 20 | 21 | #include 22 | 23 | // --------------------------------------------------------------------------- 24 | // Global Functions 25 | // --------------------------------------------------------------------------- 26 | 27 | /** 28 | * @brief Initializes the activity log. 29 | * @param filePath File path for the log file. 30 | * @param fileRoot Root name for log file. 31 | */ 32 | extern HOST_SW_API bool ActivityLogInitialise(const std::string& filePath, const std::string& fileRoot); 33 | /** 34 | * @brief Finalizes the activity log. 35 | */ 36 | extern HOST_SW_API void ActivityLogFinalise(); 37 | /** 38 | * @brief Writes a new entry to the activity log. 39 | * @param mode Activity mode. 40 | * @param sourceRf Flag indicating whether or not the activity entry came from RF. 41 | * @param msg String format. 42 | * 43 | * This is a variable argument function. 44 | */ 45 | extern HOST_SW_API void ActivityLog(const char* mode, const bool sourceRf, const char* msg, ...); 46 | 47 | #endif // __ACTIVITY_LOG_H__ 48 | -------------------------------------------------------------------------------- /src/host/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0-only 2 | #/* 3 | # * Digital Voice Modem - Modem Host Software 4 | # * GPLv2 Open Source. Use is subject to license terms. 5 | # * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | # * 7 | # * Copyright (C) 2022,2024 Bryan Biedenkapp, N2PLL 8 | # * Copyright (C) 2022 Natalie Moore 9 | # * 10 | # */ 11 | file(GLOB dvmhost_SRC 12 | # DMR module 13 | "src/host/dmr/*.h" 14 | "src/host/dmr/*.cpp" 15 | "src/host/dmr/lc/csbk/*.h" 16 | "src/host/dmr/lc/csbk/*.cpp" 17 | "src/host/dmr/lookups/*.h" 18 | "src/host/dmr/lookups/*.cpp" 19 | "src/host/dmr/packet*.h" 20 | "src/host/dmr/packet/*.cpp" 21 | 22 | # P25 module 23 | "src/host/p25/*.h" 24 | "src/host/p25/*.cpp" 25 | "src/host/p25/lc/tsbk/*.h" 26 | "src/host/p25/lc/tsbk/*.cpp" 27 | "src/host/p25/lookups/*.h" 28 | "src/host/p25/lookups/*.cpp" 29 | "src/host/p25/packet/*.h" 30 | "src/host/p25/packet/*.cpp" 31 | 32 | # NXDN module 33 | "src/host/nxdn/*.h" 34 | "src/host/nxdn/*.cpp" 35 | "src/host/nxdn/packet/*.h" 36 | "src/host/nxdn/packet/*.cpp" 37 | 38 | # Core 39 | "src/host/*.h" 40 | "src/host/*.cpp" 41 | "src/host/calibrate/*.h" 42 | "src/host/calibrate/*.cpp" 43 | "src/host/setup/*.h" 44 | "src/host/setup/*.cpp" 45 | "src/host/modem/*.h" 46 | "src/host/modem/*.cpp" 47 | "src/host/modem/port/*.h" 48 | "src/host/modem/port/*.cpp" 49 | "src/host/modem/port/specialized/*.h" 50 | "src/host/modem/port/specialized/*.cpp" 51 | "src/host/network/*.h" 52 | "src/host/network/*.cpp" 53 | ) 54 | -------------------------------------------------------------------------------- /src/host/Console.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Modem Host Software 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2015,2016 Jonathan Naylor, G4KLX 8 | * 9 | */ 10 | /** 11 | * @file Console.h 12 | * @ingroup host 13 | * @file Console.cpp 14 | * @ingroup host 15 | */ 16 | #if !defined(__CONSOLE_H__) 17 | #define __CONSOLE_H__ 18 | 19 | #include "Defines.h" 20 | 21 | #if !defined(_WIN32) 22 | #include 23 | #endif // !defined(_WIN32) 24 | 25 | // --------------------------------------------------------------------------- 26 | // Class Declaration 27 | // --------------------------------------------------------------------------- 28 | 29 | /** 30 | * @brief Implements cross-platform handling of the terminal console. This is 31 | * mainly used for the calibration mode. 32 | * @ingroup host 33 | */ 34 | class HOST_SW_API Console { 35 | public: 36 | /** 37 | * @brief Initializes a new instance of the Console class. 38 | */ 39 | Console(); 40 | /** 41 | * @brief Finalizes a instance of the Console class. 42 | */ 43 | ~Console(); 44 | 45 | /** 46 | * @brief Opens the terminal console. 47 | * @returns bool True, if the console was opened, otherwise false. 48 | */ 49 | bool open(); 50 | 51 | /** 52 | * @brief Closes the terminal console. 53 | */ 54 | void close(); 55 | 56 | /** 57 | * @brief Retrieves a character input on the keyboard. 58 | * @returns int Character input on the keyboard. 59 | */ 60 | int getChar(); 61 | 62 | /** 63 | * @brief Retrieves an array of characters input on the keyboard. 64 | * @param line 65 | * @param max 66 | * @param mask 67 | * @returns int 68 | */ 69 | int getLine(char line[], int max, char mask); 70 | 71 | private: 72 | #if !defined(_WIN32) 73 | termios m_termios; 74 | #endif // !defined(_WIN32) 75 | }; 76 | 77 | #endif // __CONSOLE_H__ 78 | -------------------------------------------------------------------------------- /src/host/Defines.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Modem Host Software 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2023 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | /** 11 | * @defgroup host Modem Host Software (dvmhost) 12 | * @brief Digital Voice Modem - Modem Host Software 13 | * @details Host software that connects to the DVM modems (both repeater and hotspot) and is the primary data processing application for digital modes. 14 | * @ingroup host 15 | * 16 | * @file Defines.h 17 | * @ingroup host 18 | */ 19 | #if !defined(__DEFINES_H__) 20 | #define __DEFINES_H__ 21 | 22 | #include "common/Defines.h" 23 | 24 | // --------------------------------------------------------------------------- 25 | // Constants 26 | // --------------------------------------------------------------------------- 27 | 28 | #undef __PROG_NAME__ 29 | #define __PROG_NAME__ "Digital Voice Modem (DVM) Host" 30 | #undef __EXE_NAME__ 31 | #define __EXE_NAME__ "dvmhost" 32 | 33 | #endif // __DEFINES_H__ 34 | -------------------------------------------------------------------------------- /src/host/modem/port/IModemPort.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Modem Host Software 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2016,2021 Jonathan Naylor, G4KLX 8 | * 9 | */ 10 | #include "modem/port/IModemPort.h" 11 | 12 | using namespace modem::port; 13 | 14 | // --------------------------------------------------------------------------- 15 | // Public Class Members 16 | // --------------------------------------------------------------------------- 17 | 18 | /* Finalizes a instance of the IModemPort class. */ 19 | 20 | IModemPort::~IModemPort() = default; 21 | -------------------------------------------------------------------------------- /src/host/modem/port/ISerialPort.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Modem Host Software 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2016,2021 Jonathan Naylor, G4KLX 8 | * 9 | */ 10 | #include "modem/port/ISerialPort.h" 11 | 12 | using namespace modem::port; 13 | 14 | // --------------------------------------------------------------------------- 15 | // Public Class Members 16 | // --------------------------------------------------------------------------- 17 | 18 | /* Finalizes a instance of the ISerialPort class. */ 19 | 20 | ISerialPort::~ISerialPort() = default; 21 | -------------------------------------------------------------------------------- /src/host/network/RPCDefines.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Modem Host Software 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2025 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | /** 11 | * @defgroup host_rpc Host RPC 12 | * @brief Implementation for the host RPC. 13 | * @ingroup host 14 | * 15 | * @file RPCDefines.h 16 | * @ingroup host_prc 17 | */ 18 | #if !defined(__RPC_DEFINES_H__) 19 | #define __RPC_DEFINES_H__ 20 | 21 | #include "Defines.h" 22 | 23 | /** 24 | * @addtogroup host_rpc 25 | * @{ 26 | */ 27 | 28 | // --------------------------------------------------------------------------- 29 | // Constants 30 | // --------------------------------------------------------------------------- 31 | 32 | #define RPC_REGISTER_CC_VC 0x1000U 33 | 34 | #define RPC_RELEASE_P25_TG 0x0101U 35 | #define RPC_RELEASE_DMR_TG 0x0102U 36 | #define RPC_RELEASE_NXDN_TG 0x0103U 37 | #define RPC_TOUCH_P25_TG 0x0201U 38 | #define RPC_TOUCH_DMR_TG 0x0202U 39 | #define RPC_TOUCH_NXDN_TG 0x0203U 40 | #define RPC_PERMIT_P25_TG 0x0001U 41 | #define RPC_PERMIT_DMR_TG 0x0002U 42 | #define RPC_PERMIT_NXDN_TG 0x0003U 43 | 44 | #define RPC_DMR_TSCC_PAYLOAD_ACT 0x0010U 45 | #define RPC_ACTIVE_P25_TG 0x0020U 46 | #define RPC_CLEAR_ACTIVE_P25_TG 0x0021U 47 | 48 | /** @} */ 49 | 50 | #endif // __RPC_DEFINES_H__ 51 | -------------------------------------------------------------------------------- /src/host/p25/lookups/P25AffiliationLookup.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Modem Host Software 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2022,2024 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "common/Log.h" 11 | #include "p25/lookups/P25AffiliationLookup.h" 12 | #include "p25/Control.h" 13 | 14 | using namespace p25::lookups; 15 | 16 | // --------------------------------------------------------------------------- 17 | // Public Class Members 18 | // --------------------------------------------------------------------------- 19 | 20 | /* Initializes a new instance of the P25AffiliationLookup class. */ 21 | 22 | P25AffiliationLookup::P25AffiliationLookup(Control* p25, ::lookups::ChannelLookup* chLookup, bool verbose) : ::lookups::AffiliationLookup("P25 Affiliation", chLookup, verbose), 23 | m_p25(p25) 24 | { 25 | /* stub */ 26 | } 27 | 28 | /* Finalizes a instance of the P25AffiliationLookup class. */ 29 | 30 | P25AffiliationLookup::~P25AffiliationLookup() = default; 31 | 32 | /* Helper to release group affiliations. */ 33 | 34 | std::vector P25AffiliationLookup::clearGroupAff(uint32_t dstId, bool releaseAll) 35 | { 36 | std::vector srcToRel = ::lookups::AffiliationLookup::clearGroupAff(dstId, releaseAll); 37 | if (srcToRel.size() > 0U) { 38 | // release affiliations 39 | for (uint32_t srcId : srcToRel) { 40 | m_p25->m_control->writeRF_TSDU_U_Dereg_Ack(srcId); 41 | } 42 | } 43 | 44 | return srcToRel; 45 | } 46 | 47 | /* Helper to release the channel grant for the destination ID. */ 48 | 49 | bool P25AffiliationLookup::releaseGrant(uint32_t dstId, bool releaseAll) 50 | { 51 | bool ret = ::lookups::AffiliationLookup::releaseGrant(dstId, releaseAll); 52 | if (ret) { 53 | if (m_rfGrantChCnt > 0U) { 54 | m_p25->m_siteData.setChCnt(m_chLookup->rfChSize() + m_rfGrantChCnt); 55 | } 56 | else { 57 | m_p25->m_siteData.setChCnt(m_chLookup->rfChSize()); 58 | } 59 | } 60 | 61 | return ret; 62 | } 63 | -------------------------------------------------------------------------------- /src/monitor/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0-only 2 | #/* 3 | # * Digital Voice Modem - Host Monitor Software 4 | # * GPLv2 Open Source. Use is subject to license terms. 5 | # * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | # * 7 | # * Copyright (C) 2024 Bryan Biedenkapp, N2PLL 8 | # * 9 | # */ 10 | file(GLOB dvmmon_SRC 11 | "src/host/modem/Modem.h" 12 | 13 | "src/remote/RESTClient.cpp" 14 | "src/remote/RESTClient.h" 15 | 16 | "src/monitor/*.h" 17 | "src/monitor/*.cpp" 18 | ) 19 | -------------------------------------------------------------------------------- /src/monitor/Defines.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Host Monitor Software 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2023 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | /** 11 | * @defgroup monitor Host Monitor Software (dvmmon) 12 | * @brief Digital Voice Modem - Host Monitor Software 13 | * @details Montior software that connects to the DVM hosts and is a quick TUI for monitoring activity on them. 14 | * @ingroup monitor 15 | * 16 | * @file Defines.h 17 | * @ingroup monitor 18 | */ 19 | #if !defined(__DEFINES_H__) 20 | #define __DEFINES_H__ 21 | 22 | #include "common/Defines.h" 23 | 24 | // --------------------------------------------------------------------------- 25 | // Constants 26 | // --------------------------------------------------------------------------- 27 | 28 | #undef __PROG_NAME__ 29 | #define __PROG_NAME__ "Digital Voice Modem (DVM) Monitor" 30 | #undef __EXE_NAME__ 31 | #define __EXE_NAME__ "dvmmon" 32 | 33 | #endif // __DEFINES_H__ 34 | -------------------------------------------------------------------------------- /src/monitor/MonitorMain.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Host Monitor Software 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2023 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | /** 11 | * @file MonitorMain.h 12 | * @ingroup monitor 13 | * @file MonitorMain.cpp 14 | * @ingroup monitor 15 | */ 16 | #if !defined(__MONITOR_MAIN_H__) 17 | #define __MONITOR_MAIN_H__ 18 | 19 | #include "Defines.h" 20 | #include "common/lookups/IdenTableLookup.h" 21 | #include "common/yaml/Yaml.h" 22 | 23 | #include 24 | 25 | // --------------------------------------------------------------------------- 26 | // Constants 27 | // --------------------------------------------------------------------------- 28 | 29 | #undef __PROG_NAME__ 30 | #define __PROG_NAME__ "Digital Voice Modem (DVM) Monitor Tool" 31 | #undef __EXE_NAME__ 32 | #define __EXE_NAME__ "dvmmon" 33 | 34 | // --------------------------------------------------------------------------- 35 | // Externs 36 | // --------------------------------------------------------------------------- 37 | 38 | /** @brief */ 39 | extern std::string g_progExe; 40 | /** @brief */ 41 | extern std::string g_iniFile; 42 | /** @brief */ 43 | extern yaml::Node g_conf; 44 | /** @brief */ 45 | extern bool g_debug; 46 | 47 | /** @brief */ 48 | extern bool g_hideLoggingWnd; 49 | 50 | /** @brief */ 51 | extern lookups::IdenTableLookup* g_idenTable; 52 | 53 | #endif // __MONITOR_MAIN_H__ 54 | -------------------------------------------------------------------------------- /src/patch/ActivityLog.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - TG Patch 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2025 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | /** 11 | * @file ActivityLog.h 12 | * @ingroup patch 13 | * @file ActivityLog.cpp 14 | * @ingroup patch 15 | */ 16 | #if !defined(__ACTIVITY_LOG_H__) 17 | #define __ACTIVITY_LOG_H__ 18 | 19 | #include "Defines.h" 20 | 21 | #include 22 | 23 | // --------------------------------------------------------------------------- 24 | // Global Functions 25 | // --------------------------------------------------------------------------- 26 | 27 | /** 28 | * @brief Initializes the activity log. 29 | * @param filePath File path for the log file. 30 | * @param fileRoot Root name for log file. 31 | */ 32 | extern HOST_SW_API bool ActivityLogInitialise(const std::string& filePath, const std::string& fileRoot); 33 | /** 34 | * @brief Finalizes the activity log. 35 | */ 36 | extern HOST_SW_API void ActivityLogFinalise(); 37 | /** 38 | * @brief Writes a new entry to the activity log. 39 | * @param msg String format. 40 | * 41 | * This is a variable argument function. 42 | */ 43 | extern HOST_SW_API void ActivityLog(const char* msg, ...); 44 | 45 | #endif // __ACTIVITY_LOG_H__ 46 | -------------------------------------------------------------------------------- /src/patch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0-only 2 | #/* 3 | # * Digital Voice Modem - TG Patch 4 | # * GPLv2 Open Source. Use is subject to license terms. 5 | # * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | # * 7 | # * Copyright (C) 2025 Bryan Biedenkapp, N2PLL 8 | # * 9 | # */ 10 | file(GLOB patch_SRC 11 | "src/patch/network/*.h" 12 | "src/patch/network/*.cpp" 13 | "src/patch/*.h" 14 | "src/patch/*.cpp" 15 | ) 16 | -------------------------------------------------------------------------------- /src/patch/Defines.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - TG Patch 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2025 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | /** 11 | * @defgroup patch TG Patch 12 | * @brief Digital Voice Modem - TG Patch 13 | * @details Talkgroup patching utility, this provides facilities to patch two talkgroups together. 14 | * @ingroup patch 15 | * 16 | * @file Defines.h 17 | * @ingroup patch 18 | */ 19 | #if !defined(__DEFINES_H__) 20 | #define __DEFINES_H__ 21 | 22 | #include "common/Defines.h" 23 | 24 | // --------------------------------------------------------------------------- 25 | // Constants 26 | // --------------------------------------------------------------------------- 27 | 28 | #undef __PROG_NAME__ 29 | #define __PROG_NAME__ "Digital Voice Modem (DVM) TG Patch" 30 | #undef __EXE_NAME__ 31 | #define __EXE_NAME__ "patch" 32 | 33 | #undef __NETVER__ 34 | #define __NETVER__ "PATCH_R" VERSION_MAJOR VERSION_REV VERSION_MINOR 35 | 36 | #undef DEFAULT_CONF_FILE 37 | #define DEFAULT_CONF_FILE "patch-config.yml" 38 | #undef DEFAULT_LOCK_FILE 39 | #define DEFAULT_LOCK_FILE "/tmp/dvmpatch.lock" 40 | 41 | #endif // __DEFINES_H__ 42 | -------------------------------------------------------------------------------- /src/patch/PatchMain.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - TG Patch 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2025 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | /** 11 | * @file PatchMain.h 12 | * @ingroup bridge 13 | * @file PatchMain.cpp 14 | * @ingroup bridge 15 | */ 16 | #if !defined(__PATCH_MAIN_H__) 17 | #define __PATCH_MAIN_H__ 18 | 19 | #include "Defines.h" 20 | 21 | #include 22 | 23 | // --------------------------------------------------------------------------- 24 | // Externs 25 | // --------------------------------------------------------------------------- 26 | 27 | /** @brief */ 28 | extern int g_signal; 29 | /** @brief */ 30 | extern std::string g_progExe; 31 | /** @brief */ 32 | extern std::string g_iniFile; 33 | /** @brief */ 34 | extern std::string g_lockFile; 35 | 36 | /** @brief (Global) Flag indicating foreground operation. */ 37 | extern bool g_foreground; 38 | /** @brief (Global) Flag indicating the FNE should stop immediately. */ 39 | extern bool g_killed; 40 | 41 | extern uint8_t* g_gitHashBytes; 42 | 43 | /** 44 | * @brief Helper to trigger a fatal error message. This will cause the program to terminate 45 | * immediately with an error message. 46 | * 47 | * @param msg String format. 48 | * 49 | * This is a variable argument function. 50 | */ 51 | extern HOST_SW_API void fatal(const char* msg, ...); 52 | 53 | #endif // __PATCH_MAIN_H__ 54 | -------------------------------------------------------------------------------- /src/peered/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0-only 2 | #/* 3 | # * Digital Voice Modem - Peer ID Editor 4 | # * GPLv2 Open Source. Use is subject to license terms. 5 | # * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | # * 7 | # * Copyright (C) 2024 Bryan Biedenkapp, N2PLL 8 | # * 9 | # */ 10 | file(GLOB peered_SRC 11 | "src/peered/*.h" 12 | "src/peered/*.cpp" 13 | ) 14 | -------------------------------------------------------------------------------- /src/peered/Defines.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Peer ID Editor 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2023,2024 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | /** 11 | * @defgroup peered Peer ID Editor (peered) 12 | * @brief Digital Voice Modem - Peer ID Editor 13 | * @details Helper software that edits peer ID files with a graphical TUI. 14 | * @ingroup peered 15 | * 16 | * @file Defines.h 17 | * @ingroup peered 18 | */ 19 | #if !defined(__DEFINES_H__) 20 | #define __DEFINES_H__ 21 | 22 | #include "common/Defines.h" 23 | 24 | // --------------------------------------------------------------------------- 25 | // Constants 26 | // --------------------------------------------------------------------------- 27 | 28 | #undef __PROG_NAME__ 29 | #define __PROG_NAME__ "Digital Voice Modem (DVM) Peer ID Editor" 30 | #undef __EXE_NAME__ 31 | #define __EXE_NAME__ "peered" 32 | 33 | #endif // __DEFINES_H__ 34 | -------------------------------------------------------------------------------- /src/remote/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0-only 2 | #/* 3 | # * Digital Voice Modem - Remote Command Client 4 | # * GPLv2 Open Source. Use is subject to license terms. 5 | # * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | # * 7 | # * Copyright (C) 2024 Bryan Biedenkapp, N2PLL 8 | # * 9 | # */ 10 | file(GLOB dvmcmd_SRC 11 | "src/remote/*.h" 12 | "src/remote/*.cpp" 13 | ) 14 | -------------------------------------------------------------------------------- /src/remote/Defines.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Remote Command Client 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2024 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | /** 11 | * @defgroup remote Remote Command Software (dvmcmd) 12 | * @brief Digital Voice Modem - Remote Command Client 13 | * @details Helper to to preform CLI REST API operations against the dvmhost and dvmfne. 14 | * @ingroup remote 15 | * 16 | * @file Defines.h 17 | * @ingroup remote 18 | */ 19 | #if !defined(__DEFINES_H__) 20 | #define __DEFINES_H__ 21 | 22 | #include "common/Defines.h" 23 | 24 | // --------------------------------------------------------------------------- 25 | // Constants 26 | // --------------------------------------------------------------------------- 27 | 28 | #undef __PROG_NAME__ 29 | #define __PROG_NAME__ "Digital Voice Modem (DVM) Remote Command Client" 30 | #undef __EXE_NAME__ 31 | #define __EXE_NAME__ "dvmcmd" 32 | 33 | #endif // __DEFINES_H__ 34 | -------------------------------------------------------------------------------- /src/sysview/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0-only 2 | #/* 3 | # * Digital Voice Modem - FNE System View 4 | # * GPLv2 Open Source. Use is subject to license terms. 5 | # * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | # * 7 | # * Copyright (C) 2024 Bryan Biedenkapp, N2PLL 8 | # * 9 | # */ 10 | file(GLOB sysView_SRC 11 | "src/host/modem/Modem.h" 12 | 13 | "src/remote/RESTClient.cpp" 14 | "src/remote/RESTClient.h" 15 | 16 | "src/sysview/p25/tsbk/*.h" 17 | "src/sysview/p25/tsbk/*.cpp" 18 | "src/sysview/network/*.h" 19 | "src/sysview/network/*.cpp" 20 | "src/sysview/*.h" 21 | "src/sysview/*.cpp" 22 | ) 23 | -------------------------------------------------------------------------------- /src/sysview/Defines.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - FNE System View 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2023 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | /** 11 | * @defgroup fneSysView FNE System View (dvmmon) 12 | * @brief Digital Voice Modem - FNE System View 13 | * @details Monitor software that connects to the DVM FNE and is a quick TUI for monitoring affiliations on them. 14 | * @ingroup fneSysView 15 | * 16 | * @file Defines.h 17 | * @ingroup fneSysView 18 | */ 19 | #if !defined(__DEFINES_H__) 20 | #define __DEFINES_H__ 21 | 22 | #include "common/Defines.h" 23 | 24 | // --------------------------------------------------------------------------- 25 | // Constants 26 | // --------------------------------------------------------------------------- 27 | 28 | #undef __PROG_NAME__ 29 | #define __PROG_NAME__ "Digital Voice Modem (DVM) FNE System View" 30 | #undef __EXE_NAME__ 31 | #define __EXE_NAME__ "sysview" 32 | 33 | #undef __NETVER__ 34 | #define __NETVER__ "SYSVIEW_R" VERSION_MAJOR VERSION_REV VERSION_MINOR 35 | 36 | #endif // __DEFINES_H__ 37 | -------------------------------------------------------------------------------- /src/tged/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0-only 2 | #/* 3 | # * Digital Voice Modem - Talkgroup Editor 4 | # * GPLv2 Open Source. Use is subject to license terms. 5 | # * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | # * 7 | # * Copyright (C) 2024 Bryan Biedenkapp, N2PLL 8 | # * 9 | # */ 10 | file(GLOB tged_SRC 11 | "src/tged/*.h" 12 | "src/tged/*.cpp" 13 | ) 14 | -------------------------------------------------------------------------------- /src/tged/Defines.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Talkgroup Editor 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2023,2024 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | /** 11 | * @defgroup tged Talkgroup Editor (tged) 12 | * @brief Digital Voice Modem - Talkgroup Editor 13 | * @details Helper software that edits talkgroup rules files with a graphical TUI. 14 | * @ingroup tged 15 | * 16 | * @file Defines.h 17 | * @ingroup tged 18 | */ 19 | #if !defined(__DEFINES_H__) 20 | #define __DEFINES_H__ 21 | 22 | #include "common/Defines.h" 23 | 24 | // --------------------------------------------------------------------------- 25 | // Constants 26 | // --------------------------------------------------------------------------- 27 | 28 | #undef __PROG_NAME__ 29 | #define __PROG_NAME__ "Digital Voice Modem (DVM) Talkgroup Rules Editor" 30 | #undef __EXE_NAME__ 31 | #define __EXE_NAME__ "tged" 32 | 33 | #endif // __DEFINES_H__ 34 | -------------------------------------------------------------------------------- /src/vocoder/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0-only 2 | #/* 3 | # * Digital Voice Modem - Remote Command Client 4 | # * GPLv2 Open Source. Use is subject to license terms. 5 | # * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | # * 7 | # * Copyright (C) 2024 Bryan Biedenkapp, N2PLL 8 | # * 9 | # */ 10 | file(GLOB vocoder_SRC 11 | "src/vocoder/imbe/*.cpp" 12 | "src/vocoder/*.cpp" 13 | "src/vocoder/*.c" 14 | ) 15 | 16 | file(GLOB vocoder_INCLUDE 17 | "src/vocoder/imbe/*.h" 18 | "src/vocoder/*.h" 19 | ) 20 | -------------------------------------------------------------------------------- /src/vocoder/imbe/ch_decode.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Project 25 IMBE Encoder/Decoder Fixed-Point implementation 3 | * Developed by Pavel Yazev E-mail: pyazev@gmail.com 4 | * Version 1.0 (c) Copyright 2009 5 | * 6 | * This is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3, or (at your option) 9 | * any later version. 10 | * 11 | * The software is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 14 | * See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this; see the file COPYING. If not, write to the Free 18 | * Software Foundation, Inc., 51 Franklin Street, Boston, MA 19 | * 02110-1301, USA. 20 | */ 21 | #ifndef __CH_DECODE_H__ 22 | #define __CH_DECODE_H__ 23 | 24 | #include "vocoder/imbe/typedef.h" 25 | 26 | // --------------------------------------------------------------------------- 27 | // Macros 28 | // --------------------------------------------------------------------------- 29 | 30 | #define BIT_STREAM_LEN (3 + 3*12 + 3*11 + 3) 31 | 32 | // --------------------------------------------------------------------------- 33 | // Global Functions 34 | // --------------------------------------------------------------------------- 35 | 36 | void decode_frame_vector(IMBE_PARAM *imbe_param, Word16 *frame_vector); 37 | void v_uv_decode(IMBE_PARAM *imbe_param); 38 | 39 | #endif // __CH_DECODE_H__ 40 | -------------------------------------------------------------------------------- /src/vocoder/imbe/ch_encode.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Project 25 IMBE Encoder/Decoder Fixed-Point implementation 3 | * Developed by Pavel Yazev E-mail: pyazev@gmail.com 4 | * Version 1.0 (c) Copyright 2009 5 | * 6 | * This is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3, or (at your option) 9 | * any later version. 10 | * 11 | * The software is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 14 | * See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this; see the file COPYING. If not, write to the Free 18 | * Software Foundation, Inc., 51 Franklin Street, Boston, MA 19 | * 02110-1301, USA. 20 | */ 21 | #ifndef __CH_ENCODE_H__ 22 | #define __CH_ENCODE_H__ 23 | 24 | // --------------------------------------------------------------------------- 25 | // Macros 26 | // --------------------------------------------------------------------------- 27 | 28 | #define EN_BIT_STREAM_LEN (3 + 3*12 + 6 + 2*11 + 3) 29 | 30 | // --------------------------------------------------------------------------- 31 | // Global Functions 32 | // --------------------------------------------------------------------------- 33 | 34 | void encode_frame_vector(IMBE_PARAM *imbe_param, Word16 *frame_vector); 35 | 36 | #endif // __CH_ENCODE_H__ 37 | -------------------------------------------------------------------------------- /src/vocoder/imbe/dc_rmv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Project 25 IMBE Encoder/Decoder Fixed-Point implementation 3 | * Developed by Pavel Yazev E-mail: pyazev@gmail.com 4 | * Version 1.0 (c) Copyright 2009 5 | * 6 | * This is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3, or (at your option) 9 | * any later version. 10 | * 11 | * The software is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 14 | * See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this; see the file COPYING. If not, write to the Free 18 | * Software Foundation, Inc., 51 Franklin Street, Boston, MA 19 | * 02110-1301, USA. 20 | */ 21 | #ifndef __DC_RMV_H__ 22 | #define __DC_RMV_H__ 23 | 24 | // --------------------------------------------------------------------------- 25 | // Global Functions 26 | // --------------------------------------------------------------------------- 27 | 28 | //----------------------------------------------------------------------------- 29 | // PURPOSE: 30 | // High-pass filter to remove DC 31 | // 32 | // 33 | // INPUT: 34 | // *sigin - pointer to input signal buffer 35 | // *sigout - pointer to output signal buffer 36 | // *mem - pointer to filter's memory element 37 | // len - number of input signal samples 38 | // 39 | // OUTPUT: 40 | // None 41 | // 42 | // RETURN: 43 | // Saved filter state in mem 44 | // 45 | //----------------------------------------------------------------------------- 46 | void dc_rmv(Word16 *sigin, Word16 *sigout, Word32 *mem, Word16 len); 47 | 48 | #endif // __DC_RMV_H__ 49 | -------------------------------------------------------------------------------- /src/vocoder/imbe/pe_lpf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Project 25 IMBE Encoder/Decoder Fixed-Point implementation 3 | * Developed by Pavel Yazev E-mail: pyazev@gmail.com 4 | * Version 1.0 (c) Copyright 2009 5 | * 6 | * This is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3, or (at your option) 9 | * any later version. 10 | * 11 | * The software is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 14 | * See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this; see the file COPYING. If not, write to the Free 18 | * Software Foundation, Inc., 51 Franklin Street, Boston, MA 19 | * 02110-1301, USA. 20 | */ 21 | #ifndef __PE_LPF_H__ 22 | #define __PE_LPF_H__ 23 | 24 | // --------------------------------------------------------------------------- 25 | // Global Functions 26 | // --------------------------------------------------------------------------- 27 | 28 | //----------------------------------------------------------------------------- 29 | // PURPOSE: 30 | // Low-pass filter for pitch estimator 31 | // 32 | // 33 | // INPUT: 34 | // *sigin - pointer to input signal buffer 35 | // *sigout - pointer to output signal buffer 36 | // *mem - pointer to filter's memory element 37 | // len - number of input signal samples 38 | // 39 | // OUTPUT: 40 | // None 41 | // 42 | // RETURN: 43 | // Saved filter state in mem 44 | // 45 | //----------------------------------------------------------------------------- 46 | void pe_lpf(Word16 *sigin, Word16 *sigout, Word16 *mem, Word16 len); 47 | 48 | #endif // __PE_LPF_H__ 49 | -------------------------------------------------------------------------------- /src/vocoder/imbe/pitch_est.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Project 25 IMBE Encoder/Decoder Fixed-Point implementation 3 | * Developed by Pavel Yazev E-mail: pyazev@gmail.com 4 | * Version 1.0 (c) Copyright 2009 5 | * 6 | * This is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3, or (at your option) 9 | * any later version. 10 | * 11 | * The software is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 14 | * See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this; see the file COPYING. If not, write to the Free 18 | * Software Foundation, Inc., 51 Franklin Street, Boston, MA 19 | * 02110-1301, USA. 20 | */ 21 | #ifndef __PITCH_EST__ 22 | #define __PITCH_EST__ 23 | 24 | // --------------------------------------------------------------------------- 25 | // Global Functions 26 | // --------------------------------------------------------------------------- 27 | 28 | void pitch_est_init(void); 29 | void pitch_est(IMBE_PARAM *imbe_param, Word16 *frames_buf); 30 | 31 | #endif // __PITCH_EST__ 32 | -------------------------------------------------------------------------------- /src/vocoder/imbe/pitch_ref.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Project 25 IMBE Encoder/Decoder Fixed-Point implementation 3 | * Developed by Pavel Yazev E-mail: pyazev@gmail.com 4 | * Version 1.0 (c) Copyright 2009 5 | * 6 | * This is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3, or (at your option) 9 | * any later version. 10 | * 11 | * The software is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 14 | * See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this; see the file COPYING. If not, write to the Free 18 | * Software Foundation, Inc., 51 Franklin Street, Boston, MA 19 | * 02110-1301, USA. 20 | */ 21 | #ifndef __PITCH_REF_H__ 22 | #define __PITCH_REF_H__ 23 | 24 | // --------------------------------------------------------------------------- 25 | // Global Functions 26 | // --------------------------------------------------------------------------- 27 | 28 | void pitch_ref(IMBE_PARAM *imbe_param, Cmplx16 *fft_buf); 29 | 30 | #endif // __PITCH_REF_H__ 31 | -------------------------------------------------------------------------------- /src/vocoder/imbe/rand_gen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Project 25 IMBE Encoder/Decoder Fixed-Point implementation 3 | * Developed by Pavel Yazev E-mail: pyazev@gmail.com 4 | * Version 1.0 (c) Copyright 2009 5 | * 6 | * This is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3, or (at your option) 9 | * any later version. 10 | * 11 | * The software is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 14 | * See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this; see the file COPYING. If not, write to the Free 18 | * Software Foundation, Inc., 51 Franklin Street, Boston, MA 19 | * 02110-1301, USA. 20 | */ 21 | 22 | #include "vocoder/imbe/typedef.h" 23 | #include "vocoder/imbe/basic_op.h" 24 | 25 | // --------------------------------------------------------------------------- 26 | // Constants 27 | // --------------------------------------------------------------------------- 28 | 29 | static UWord32 seed = 1; 30 | 31 | // --------------------------------------------------------------------------- 32 | // Global Functions 33 | // --------------------------------------------------------------------------- 34 | 35 | //----------------------------------------------------------------------------- 36 | // PURPOSE: 37 | // Generate pseudo-random numbers in range -1...1 38 | // 39 | // 40 | // INPUT: 41 | // None 42 | // 43 | // OUTPUT: 44 | // None 45 | // 46 | // RETURN: 47 | // Pseudo-random number in signed Q1.16 format 48 | // 49 | //----------------------------------------------------------------------------- 50 | Word16 rand_gen(void) 51 | { 52 | UWord32 hi, lo; 53 | 54 | lo = 16807 * (seed & 0xFFFF); 55 | hi = 16807 * (seed >> 16); 56 | 57 | lo += (Word32)(hi & 0x7FFF) << 16; 58 | lo += (hi >> 15); 59 | 60 | if (lo > 0x7FFFFFFF) 61 | lo -= 0x7FFFFFFF; 62 | 63 | seed = lo; 64 | 65 | return (Word16)lo; 66 | } 67 | -------------------------------------------------------------------------------- /src/vocoder/imbe/rand_gen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Project 25 IMBE Encoder/Decoder Fixed-Point implementation 3 | * Developed by Pavel Yazev E-mail: pyazev@gmail.com 4 | * Version 1.0 (c) Copyright 2009 5 | * 6 | * This is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3, or (at your option) 9 | * any later version. 10 | * 11 | * The software is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 14 | * See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this; see the file COPYING. If not, write to the Free 18 | * Software Foundation, Inc., 51 Franklin Street, Boston, MA 19 | * 02110-1301, USA. 20 | */ 21 | #ifndef __RAND_GEN_H__ 22 | #define __RAND_GEN_H__ 23 | 24 | // --------------------------------------------------------------------------- 25 | // Global Functions 26 | // --------------------------------------------------------------------------- 27 | 28 | //----------------------------------------------------------------------------- 29 | // PURPOSE: 30 | // Generate pseudo-random numbers in range -1...1 31 | // 32 | // 33 | // INPUT: 34 | // None 35 | // 36 | // OUTPUT: 37 | // None 38 | // 39 | // RETURN: 40 | // Pseudo-random number in signed Q1.16 format 41 | // 42 | //----------------------------------------------------------------------------- 43 | Word16 rand_gen(void); 44 | 45 | #endif // __RAND_GEN_H__ 46 | -------------------------------------------------------------------------------- /src/vocoder/imbe/sa_enh.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Project 25 IMBE Encoder/Decoder Fixed-Point implementation 3 | * Developed by Pavel Yazev E-mail: pyazev@gmail.com 4 | * Version 1.0 (c) Copyright 2009 5 | * 6 | * This is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3, or (at your option) 9 | * any later version. 10 | * 11 | * The software is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 14 | * See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this; see the file COPYING. If not, write to the Free 18 | * Software Foundation, Inc., 51 Franklin Street, Boston, MA 19 | * 02110-1301, USA. 20 | */ 21 | #ifndef __SA_ENH_H__ 22 | #define __SA_ENH_H__ 23 | 24 | // --------------------------------------------------------------------------- 25 | // Constants 26 | // --------------------------------------------------------------------------- 27 | 28 | #define CNST_0_9898_Q1_15 0x7EB3 29 | #define CNST_0_5_Q2_14 0x2000 30 | #define CNST_1_2_Q2_14 0x4CCC 31 | 32 | // --------------------------------------------------------------------------- 33 | // Global Functions 34 | // --------------------------------------------------------------------------- 35 | 36 | //----------------------------------------------------------------------------- 37 | // PURPOSE: 38 | // Perform Spectral Amplitude Enhancement 39 | // 40 | // 41 | // INPUT: 42 | // IMBE_PARAM *imbe_param - pointer to IMBE_PARAM structure with 43 | // valid num_harms, sa and fund_freq items 44 | // 45 | // OUTPUT: 46 | // None 47 | // 48 | // RETURN: 49 | // Enhanced Spectral Amplitudes 50 | // 51 | //----------------------------------------------------------------------------- 52 | void sa_enh(IMBE_PARAM *imbe_param); 53 | 54 | #endif // __SA_ENH_H__ 55 | -------------------------------------------------------------------------------- /tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0-only 2 | #/* 3 | # * Digital Voice Modem - Test Suite 4 | # * GPLv2 Open Source. Use is subject to license terms. 5 | # * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | # * 7 | # * Copyright (C) 2022,2024 Bryan Biedenkapp, N2PLL 8 | # * Copyright (C) 2022 Natalie Moore 9 | # * 10 | # */ 11 | file(GLOB dvmtests_SRC 12 | "tests/*.h" 13 | "tests/*.cpp" 14 | "tests/crypto/*.cpp" 15 | "tests/edac/*.cpp" 16 | "tests/p25/*.cpp" 17 | "tests/nxdn/*.cpp" 18 | ) 19 | -------------------------------------------------------------------------------- /tests/Defines.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Test Suite 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2024 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #if !defined(__DEFINES_H__) 11 | #define __DEFINES_H__ 12 | 13 | #include "common/Defines.h" 14 | 15 | // --------------------------------------------------------------------------- 16 | // Constants 17 | // --------------------------------------------------------------------------- 18 | 19 | #undef __PROG_NAME__ 20 | #define __PROG_NAME__ "Digital Voice Modem (DVM) Tests" 21 | #undef __EXE_NAME__ 22 | #define __EXE_NAME__ "dvmtest" 23 | 24 | #endif // __DEFINES_H__ 25 | -------------------------------------------------------------------------------- /tests/edac/CRC_12_Test.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Test Suite 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2023 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "host/Defines.h" 11 | #include "common/edac/CRC.h" 12 | #include "common/Log.h" 13 | #include "common/Utils.h" 14 | 15 | using namespace edac; 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | TEST_CASE("CRC", "[12-bit Test]") { 22 | SECTION("12_Sanity_Test") { 23 | bool failed = false; 24 | 25 | INFO("CRC 12-bit CRC Test"); 26 | 27 | srand((unsigned int)time(NULL)); 28 | 29 | const uint32_t len = 32U; 30 | const uint32_t lenBits = len * 8U; 31 | uint8_t* random = (uint8_t*)malloc(len); 32 | 33 | for (size_t i = 0; i < len - 2U; i++) { 34 | random[i] = rand(); 35 | } 36 | 37 | CRC::addCRC12(random, lenBits); 38 | 39 | uint16_t inCrc = (random[len - 2U] << 8) | (random[len - 1U] << 0); 40 | ::LogDebug("T", "CRC::checkCRC12(), crc = $%04X", inCrc); 41 | 42 | Utils::dump(2U, "12_Sanity_Test CRC", random, len); 43 | 44 | bool ret = CRC::checkCRC12(random, lenBits); 45 | if (!ret) { 46 | ::LogDebug("T", "12_Sanity_Test, failed CRC12 check"); 47 | failed = true; 48 | goto cleanup; 49 | } 50 | 51 | random[10U] >>= 8; 52 | random[11U] >>= 8; 53 | 54 | ret = CRC::checkCRC12(random, lenBits); 55 | if (ret) { 56 | ::LogDebug("T", "12_Sanity_Test, failed CRC12 error check"); 57 | failed = true; 58 | goto cleanup; 59 | } 60 | 61 | cleanup: 62 | delete random; 63 | REQUIRE(failed==false); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /tests/edac/CRC_15_Test.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Test Suite 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2023 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "host/Defines.h" 11 | #include "common/edac/CRC.h" 12 | #include "common/Log.h" 13 | #include "common/Utils.h" 14 | 15 | using namespace edac; 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | TEST_CASE("CRC", "[15-bit Test]") { 22 | SECTION("15_Sanity_Test") { 23 | bool failed = false; 24 | 25 | INFO("CRC 15-bit CRC Test"); 26 | 27 | srand((unsigned int)time(NULL)); 28 | 29 | const uint32_t len = 32U; 30 | const uint32_t lenBits = len * 8U; 31 | uint8_t* random = (uint8_t*)malloc(len); 32 | 33 | for (size_t i = 0; i < len - 2U; i++) { 34 | random[i] = rand(); 35 | } 36 | 37 | CRC::addCRC15(random, lenBits); 38 | 39 | uint16_t inCrc = (random[len - 2U] << 8) | (random[len - 1U] << 0); 40 | ::LogDebug("T", "CRC::checkCRC15(), crc = $%04X", inCrc); 41 | 42 | Utils::dump(2U, "15_Sanity_Test CRC", random, len); 43 | 44 | bool ret = CRC::checkCRC15(random, lenBits); 45 | if (!ret) { 46 | ::LogDebug("T", "15_Sanity_Test, failed CRC15 check"); 47 | failed = true; 48 | goto cleanup; 49 | } 50 | 51 | random[10U] >>= 8; 52 | random[11U] >>= 8; 53 | 54 | ret = CRC::checkCRC15(random, lenBits); 55 | if (ret) { 56 | ::LogDebug("T", "15_Sanity_Test, failed CRC15 error check"); 57 | failed = true; 58 | goto cleanup; 59 | } 60 | 61 | cleanup: 62 | delete random; 63 | REQUIRE(failed==false); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /tests/edac/CRC_16_Test.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Test Suite 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2023 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "host/Defines.h" 11 | #include "common/edac/CRC.h" 12 | #include "common/Log.h" 13 | #include "common/Utils.h" 14 | 15 | using namespace edac; 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | TEST_CASE("CRC", "[16-bit Test]") { 22 | SECTION("16_Sanity_Test") { 23 | bool failed = false; 24 | 25 | INFO("CRC 16-bit CRC Test"); 26 | 27 | srand((unsigned int)time(NULL)); 28 | 29 | const uint32_t len = 32U; 30 | const uint32_t lenBits = len * 8U; 31 | uint8_t* random = (uint8_t*)malloc(len); 32 | 33 | for (size_t i = 0; i < len - 2U; i++) { 34 | random[i] = rand(); 35 | } 36 | 37 | CRC::addCRC16(random, lenBits); 38 | 39 | uint16_t inCrc = (random[len - 2U] << 8) | (random[len - 1U] << 0); 40 | ::LogDebug("T", "CRC::checkCRC16(), crc = $%04X", inCrc); 41 | 42 | Utils::dump(2U, "16_Sanity_Test CRC", random, len); 43 | 44 | bool ret = CRC::checkCRC16(random, lenBits); 45 | if (!ret) { 46 | ::LogDebug("T", "16_Sanity_Test, failed CRC16 check"); 47 | failed = true; 48 | goto cleanup; 49 | } 50 | 51 | random[10U] >>= 8; 52 | random[11U] >>= 8; 53 | 54 | ret = CRC::checkCRC16(random, lenBits); 55 | if (ret) { 56 | ::LogDebug("T", "16_Sanity_Test, failed CRC16 error check"); 57 | failed = true; 58 | goto cleanup; 59 | } 60 | 61 | cleanup: 62 | delete random; 63 | REQUIRE(failed==false); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /tests/edac/CRC_32_Test.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Test Suite 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2023 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "host/Defines.h" 11 | #include "common/edac/CRC.h" 12 | #include "common/Log.h" 13 | #include "common/Utils.h" 14 | 15 | using namespace edac; 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | TEST_CASE("CRC", "[32-bit Test]") { 22 | SECTION("32_Sanity_Test") { 23 | bool failed = false; 24 | 25 | INFO("CRC 32-bit CRC Test"); 26 | 27 | srand((unsigned int)time(NULL)); 28 | 29 | const uint32_t len = 32U; 30 | uint8_t* random = (uint8_t*)malloc(len); 31 | 32 | for (size_t i = 0; i < len - 4U; i++) { 33 | random[i] = rand(); 34 | } 35 | 36 | CRC::addCRC32(random, len); 37 | 38 | uint32_t inCrc = (random[len - 4U] << 24) | (random[len - 3U] << 16) | (random[len - 2U] << 8) | (random[len - 1U] << 0); 39 | ::LogDebug("T", "CRC::checkCRC32(), crc = $%08X", inCrc); 40 | 41 | Utils::dump(2U, "32_Sanity_Test CRC", random, len); 42 | 43 | bool ret = CRC::checkCRC32(random, len); 44 | if (!ret) { 45 | ::LogDebug("T", "32_Sanity_Test, failed CRC32 check"); 46 | failed = true; 47 | goto cleanup; 48 | } 49 | 50 | random[10U] >>= 8; 51 | random[11U] >>= 8; 52 | 53 | ret = CRC::checkCRC32(random, len); 54 | if (ret) { 55 | ::LogDebug("T", "32_Sanity_Test, failed CRC32 error check"); 56 | failed = true; 57 | goto cleanup; 58 | } 59 | 60 | cleanup: 61 | delete random; 62 | REQUIRE(failed==false); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /tests/edac/CRC_6_Test.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Test Suite 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2023 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "host/Defines.h" 11 | #include "common/edac/CRC.h" 12 | #include "common/Log.h" 13 | #include "common/Utils.h" 14 | 15 | using namespace edac; 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | TEST_CASE("CRC", "[6-bit Test]") { 22 | SECTION("6_Sanity_Test") { 23 | bool failed = false; 24 | 25 | INFO("CRC 6-bit CRC Test"); 26 | 27 | srand((unsigned int)time(NULL)); 28 | 29 | const uint32_t len = 32U; 30 | const uint32_t lenBits = len * 8U; 31 | uint8_t* random = (uint8_t*)malloc(len); 32 | 33 | for (size_t i = 0; i < len - 1U; i++) { 34 | random[i] = rand(); 35 | } 36 | 37 | CRC::addCRC6(random, lenBits); 38 | 39 | uint32_t inCrc = (random[len - 1U] << 0); 40 | ::LogDebug("T", "CRC::checkCRC6(), crc = $%02X", inCrc); 41 | 42 | Utils::dump(2U, "6_Sanity_Test CRC", random, len); 43 | 44 | bool ret = CRC::checkCRC6(random, lenBits); 45 | if (!ret) { 46 | ::LogDebug("T", "6_Sanity_Test, failed CRC6 check"); 47 | failed = true; 48 | goto cleanup; 49 | } 50 | 51 | random[10U] >>= 8; 52 | random[11U] >>= 8; 53 | 54 | ret = CRC::checkCRC6(random, lenBits); 55 | if (ret) { 56 | ::LogDebug("T", "6_Sanity_Test, failed CRC6 error check"); 57 | failed = true; 58 | goto cleanup; 59 | } 60 | 61 | cleanup: 62 | delete random; 63 | REQUIRE(failed==false); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /tests/edac/CRC_8_Test.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Test Suite 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2023 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "host/Defines.h" 11 | #include "common/edac/CRC.h" 12 | #include "common/Log.h" 13 | #include "common/Utils.h" 14 | 15 | using namespace edac; 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | TEST_CASE("CRC", "[8-bit Test]") { 22 | SECTION("8_Sanity_Test") { 23 | bool failed = false; 24 | 25 | INFO("CRC 8-bit CRC Test"); 26 | 27 | srand((unsigned int)time(NULL)); 28 | 29 | const uint32_t len = 32U; 30 | uint8_t* random = (uint8_t*)malloc(len); 31 | 32 | for (size_t i = 0; i < len; i++) { 33 | random[i] = rand(); 34 | } 35 | 36 | uint8_t crc = CRC::crc8(random, len); 37 | ::LogDebug("T", "crc = %02X", crc); 38 | 39 | Utils::dump(2U, "8_Sanity_Test CRC", random, len); 40 | 41 | random[10U] >>= 8; 42 | random[11U] >>= 8; 43 | 44 | uint8_t calc = CRC::crc8(random, len); 45 | ::LogDebug("T", "calc = %02X", calc); 46 | if (crc == calc) { 47 | ::LogDebug("T", "8_Sanity_Test, failed CRC8 error check"); 48 | failed = true; 49 | goto cleanup; 50 | } 51 | 52 | cleanup: 53 | delete random; 54 | REQUIRE(failed==false); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /tests/edac/CRC_9_Test.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Test Suite 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2023 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "host/Defines.h" 11 | #include "common/edac/CRC.h" 12 | #include "common/Log.h" 13 | #include "common/Utils.h" 14 | 15 | using namespace edac; 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | TEST_CASE("CRC", "[9-bit Test]") { 22 | SECTION("9_Sanity_Test") { 23 | bool failed = false; 24 | 25 | INFO("CRC 9-bit CRC Test"); 26 | 27 | srand((unsigned int)time(NULL)); 28 | 29 | const uint32_t len = 18U; 30 | uint8_t* random = (uint8_t*)malloc(len); 31 | 32 | for (size_t i = 0; i < len; i++) { 33 | random[i] = rand(); 34 | } 35 | 36 | random[0U] = 0; 37 | random[1U] = 0; 38 | 39 | uint16_t crc = edac::CRC::createCRC9(random, 144U); 40 | ::LogDebug("T", "crc = %04X", crc); 41 | 42 | random[0U] = random[0U] + ((crc >> 8) & 0x01U); 43 | random[1U] = (crc & 0xFFU); 44 | 45 | Utils::dump(2U, "9_Sanity_Test CRC", random, len); 46 | 47 | random[10U] >>= 8; 48 | random[11U] >>= 8; 49 | 50 | uint16_t calculated = edac::CRC::createCRC9(random, 144U); 51 | if (((crc ^ calculated) == 0)/*|| ((crc ^ calculated) == 0x1FFU)*/) { 52 | ::LogDebug("T", "9_Sanity_Test, failed CRC9 error check"); 53 | failed = true; 54 | goto cleanup; 55 | } 56 | 57 | cleanup: 58 | delete random; 59 | REQUIRE(failed==false); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /tests/edac/CRC_CCITT_161_Test.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Test Suite 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2023 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "host/Defines.h" 11 | #include "common/edac/CRC.h" 12 | #include "common/Log.h" 13 | #include "common/Utils.h" 14 | 15 | using namespace edac; 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | TEST_CASE("CRC", "[16-bit CCITT-161 Test]") { 22 | SECTION("CCITT-161_Sanity_Test") { 23 | bool failed = false; 24 | 25 | INFO("CRC CCITT-161 16-bit CRC Test"); 26 | 27 | srand((unsigned int)time(NULL)); 28 | 29 | const uint32_t len = 32U; 30 | uint8_t* random = (uint8_t*)malloc(len); 31 | 32 | for (size_t i = 0; i < len - 2U; i++) { 33 | random[i] = rand(); 34 | } 35 | 36 | CRC::addCCITT161(random, len); 37 | 38 | uint16_t inCrc = (random[len - 2U] << 8) | (random[len - 1U] << 0); 39 | ::LogDebug("T", "CRC::checkCCITT161(), crc = $%04X", inCrc); 40 | 41 | Utils::dump(2U, "CCITT-161_Sanity_Test CRC", random, len); 42 | 43 | bool ret = CRC::checkCCITT161(random, len); 44 | if (!ret) { 45 | ::LogDebug("T", "CCITT-161_Sanity_Test, failed CRC CCITT-162 check"); 46 | failed = true; 47 | goto cleanup; 48 | } 49 | 50 | random[10U] >>= 8; 51 | random[11U] >>= 8; 52 | 53 | ret = CRC::checkCCITT161(random, len); 54 | if (ret) { 55 | ::LogDebug("T", "CCITT-161_Sanity_Test, failed CRC CCITT-162 error check"); 56 | failed = true; 57 | goto cleanup; 58 | } 59 | 60 | cleanup: 61 | delete random; 62 | REQUIRE(failed==false); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /tests/edac/CRC_CCITT_162_Test.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Test Suite 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2023 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "host/Defines.h" 11 | #include "common/edac/CRC.h" 12 | #include "common/Log.h" 13 | #include "common/Utils.h" 14 | 15 | using namespace edac; 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | TEST_CASE("CRC", "[16-bit CCITT-162 Test]") { 22 | SECTION("CCITT-162_Sanity_Test") { 23 | bool failed = false; 24 | 25 | INFO("CRC CCITT-162 16-bit CRC Test"); 26 | 27 | srand((unsigned int)time(NULL)); 28 | 29 | const uint32_t len = 32U; 30 | uint8_t* random = (uint8_t*)malloc(len); 31 | 32 | for (size_t i = 0; i < len - 2U; i++) { 33 | random[i] = rand(); 34 | } 35 | 36 | CRC::addCCITT162(random, len); 37 | 38 | uint16_t inCrc = (random[len - 2U] << 8) | (random[len - 1U] << 0); 39 | ::LogDebug("T", "CRC::checkCCITT162(), crc = $%04X", inCrc); 40 | 41 | Utils::dump(2U, "CCITT-162_Sanity_Test CRC", random, len); 42 | 43 | bool ret = CRC::checkCCITT162(random, len); 44 | if (!ret) { 45 | ::LogDebug("T", "CCITT-162_Sanity_Test, failed CRC CCITT-162 check"); 46 | failed = true; 47 | goto cleanup; 48 | } 49 | 50 | random[10U] >>= 8; 51 | random[11U] >>= 8; 52 | 53 | ret = CRC::checkCCITT162(random, len); 54 | if (ret) { 55 | ::LogDebug("T", "CCITT-162_Sanity_Test, failed CRC CCITT-162 error check"); 56 | failed = true; 57 | goto cleanup; 58 | } 59 | 60 | cleanup: 61 | delete random; 62 | REQUIRE(failed==false); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /tests/nulltest.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Test Suite 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2022 Natalie Moore 8 | * 9 | */ 10 | #include "Defines.h" 11 | 12 | #include 13 | 14 | TEST_CASE("NullTest", "[NullTest]") { 15 | SECTION("Null") { 16 | REQUIRE(1==1); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /tests/nxdn/AMBE_FEC_Test.cpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-only 2 | /* 3 | * Digital Voice Modem - Test Suite 4 | * GPLv2 Open Source. Use is subject to license terms. 5 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 | * 7 | * Copyright (C) 2023 Bryan Biedenkapp, N2PLL 8 | * 9 | */ 10 | #include "host/Defines.h" 11 | #include "common/edac/AMBEFEC.h" 12 | #include "common/nxdn/NXDNDefines.h" 13 | #include "common/nxdn/NXDNUtils.h" 14 | #include "common/Log.h" 15 | #include "common/Utils.h" 16 | 17 | using namespace edac; 18 | using namespace nxdn; 19 | using namespace nxdn::defines; 20 | 21 | #include 22 | 23 | TEST_CASE("NXDN", "[AMBE FEC Test]") { 24 | SECTION("NXDN_AMBEFEC_Test") { 25 | bool failed = false; 26 | 27 | INFO("NXDN AMBE FEC FEC Test"); 28 | 29 | uint8_t testData[] = { 30 | 0xCDU, 0xF5U, 0x9DU, 0x5DU, 0xFCU, 0xFAU, 0x0AU, 0x6EU, 0x8AU, 0x23U, 0x56U, 0xE8U, 31 | 0x17U, 0x49U, 0xC6U, 0x58U, 0x89U, 0x30U, 0x1AU, 0xA5U, 0xF5U, 0xACU, 0x5AU, 0x6EU, 0xF8U, 0x09U, 0x3CU, 0x48U, 32 | 0x0FU, 0x4FU, 0xFDU, 0xCFU, 0x80U, 0xD5U, 0x77U, 0x0CU, 0xFEU, 0xE9U, 0x05U, 0xCEU, 0xE6U, 0x20U, 0xDFU, 0xFFU, 33 | 0x18U, 0x9CU, 0x2DU, 0xA9U 34 | }; 35 | 36 | NXDNUtils::scrambler(testData); 37 | 38 | Utils::dump(2U, "NXDN AMBE FEC Test, descrambled test data", testData, NXDN_FRAME_LENGTH_BYTES); 39 | 40 | AMBEFEC fec = AMBEFEC(); 41 | 42 | uint32_t errors = 0U; 43 | 44 | errors += fec.measureNXDNBER(testData + NXDN_FSW_LICH_SACCH_LENGTH_BYTES + 0U); 45 | errors += fec.measureNXDNBER(testData + NXDN_FSW_LICH_SACCH_LENGTH_BYTES + 9U); 46 | errors += fec.measureNXDNBER(testData + NXDN_FSW_LICH_SACCH_LENGTH_BYTES + 18U); 47 | errors += fec.measureNXDNBER(testData + NXDN_FSW_LICH_SACCH_LENGTH_BYTES + 27U); 48 | 49 | if (errors > 0) 50 | failed = true; 51 | 52 | cleanup: 53 | REQUIRE(failed==false); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /tools/colorize-fne.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # SPDX-License-Identifier: GPL-2.0-only 3 | #/** 4 | #* Digital Voice Modem - Host Software 5 | #* GPLv2 Open Source. Use is subject to license terms. 6 | #* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7 | #* 8 | #*/ 9 | #/* 10 | #* Copyright (C) 2022 by Bryan Biedenkapp N2PLL 11 | #* 12 | #* This program is free software; you can redistribute it and/or modify 13 | #* it under the terms of the GNU General Public License as published by 14 | #* the Free Software Foundation; either version 2 of the License, or 15 | #* (at your option) any later version. 16 | #* 17 | #* This program is distributed in the hope that it will be useful, 18 | #* but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | #* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | #* GNU General Public License for more details. 21 | #* 22 | #* You should have received a copy of the GNU General Public License 23 | #* along with this program; if not, write to the Free Software 24 | #* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 25 | #*/ 26 | LOG_COLOR="s#W:#\x1b[0m\x1b[1m\x1b[33m&#; s#E:#\x1b[0m\x1b[1m\x1b[31m&#; s#M:#\x1b[0m&#; s#I:#\x1b[0m&#; s#D:#\x1b[1m\x1b[34m&#; s#U:#\x1b[44m\x1b[1m\x1b[33m&#;" 27 | 28 | P25_COLOR="s#LDU#\x1b[36m&#; s#TDU#\x1b[0m\x1b[32m&#; s#HDU#\x1b[0m\x1b[32m&#; s#TSDU#\x1b[0m\x1b[35m&#" 29 | AFF_COLOR="s#Affiliations#\x1b[1m\x1b[36m&#;" 30 | 31 | RF_HIGHLIGHT="s#(RF)#\x1b[1m\x1b[34m&\x1b[0m#;" 32 | NET_HIGHLIGHT="s#(NET)#\x1b[1m\x1b[36m&\x1b[0m#;" 33 | 34 | sed "${LOG_COLOR}; ${RF_HIGHLIGHT}; ${NET_HIGHLIGHT}; ${P25_COLOR}; ${AFF_COLOR}" -------------------------------------------------------------------------------- /tools/dvm-watchdog.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # SPDX-License-Identifier: GPL-2.0-only 3 | #/** 4 | #* Digital Voice Modem - Host Software 5 | #* GPLv2 Open Source. Use is subject to license terms. 6 | #* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7 | #* 8 | #*/ 9 | #/* 10 | #* Copyright (C) 2022 by Bryan Biedenkapp N2PLL 11 | #* 12 | #* This program is free software; you can redistribute it and/or modify 13 | #* it under the terms of the GNU General Public License as published by 14 | #* the Free Software Foundation; either version 2 of the License, or 15 | #* (at your option) any later version. 16 | #* 17 | #* This program is distributed in the hope that it will be useful, 18 | #* but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | #* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | #* GNU General Public License for more details. 21 | #* 22 | #* You should have received a copy of the GNU General Public License 23 | #* along with this program; if not, write to the Free Software 24 | #* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 25 | #*/ 26 | R_PATH=/opt/dvm 27 | pushd ${R_PATH} >/dev/null 28 | 29 | if [ -z $1 ]; then exit 1; fi 30 | if [ -z $2 ]; then exit 1; fi 31 | 32 | PID_FILE=$1 33 | if [ ! -e $PID_FILE ]; then exit 98; fi 34 | CONFIG=$2 35 | if [ ! -f ${R_PATH}/${CONFIG} ]; then exit 3; fi 36 | 37 | PID=`cat $PID_FILE` 38 | while [ true ]; do 39 | PS_OUT=`ps --no-headers ${PID}` 40 | if [ ${#PS_OUT} -eq 0 ]; then 41 | logger "dvmhost PID ${PID} not running -- restarting ${PID_FILE} ${CONFIG}" 42 | ${R_PATH}/start-dvm.sh ${CONFIG} ${PID_FILE} >/dev/null 43 | ERRNO=$? 44 | if [ $ERRNO -ne 0 ]; then 45 | logger "dvmhost start-dvm.sh script failed to start; errno ${ERRNO}" 46 | fi 47 | PID=`cat $PID_FILE` 48 | fi 49 | sleep 5s 50 | done 51 | 52 | popd >/dev/null 53 | -------------------------------------------------------------------------------- /tools/fne-watchdog.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # SPDX-License-Identifier: GPL-2.0-only 3 | #/** 4 | #* Digital Voice Modem - Host Software 5 | #* GPLv2 Open Source. Use is subject to license terms. 6 | #* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7 | #* 8 | #*/ 9 | #/* 10 | #* Copyright (C) 2022 by Bryan Biedenkapp N2PLL 11 | #* 12 | #* This program is free software; you can redistribute it and/or modify 13 | #* it under the terms of the GNU General Public License as published by 14 | #* the Free Software Foundation; either version 2 of the License, or 15 | #* (at your option) any later version. 16 | #* 17 | #* This program is distributed in the hope that it will be useful, 18 | #* but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | #* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | #* GNU General Public License for more details. 21 | #* 22 | #* You should have received a copy of the GNU General Public License 23 | #* along with this program; if not, write to the Free Software 24 | #* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 25 | #*/ 26 | R_PATH=/opt/dvm 27 | pushd ${R_PATH} >/dev/null 28 | 29 | if [ -z $1 ]; then exit 1; fi 30 | if [ -z $2 ]; then exit 1; fi 31 | 32 | PID_FILE=$1 33 | if [ ! -e $PID_FILE ]; then exit 98; fi 34 | CONFIG=$2 35 | if [ ! -f ${R_PATH}/${CONFIG} ]; then exit 3; fi 36 | 37 | PID=`cat $PID_FILE` 38 | while [ true ]; do 39 | PS_OUT=`ps --no-headers ${PID}` 40 | if [ ${#PS_OUT} -eq 0 ]; then 41 | logger "dvmfne PID ${PID} not running -- restarting ${PID_FILE} ${CONFIG}" 42 | CURRENT_USER=$(whoami) 43 | if [ "$CURRENT_USER" == "root" ]; then 44 | wall -n "dvmfne PID ${PID} not running -- restarting ${PID_FILE} ${CONFIG}" 45 | fi 46 | ${R_PATH}/start-dvm-fne.sh ${CONFIG} ${PID_FILE} >/dev/null 47 | ERRNO=$? 48 | if [ $ERRNO -ne 0 ]; then 49 | logger "dvmfne start-dvm.sh script failed to start; errno ${ERRNO}" 50 | fi 51 | PID=`cat $PID_FILE` 52 | fi 53 | sleep 5s 54 | done 55 | 56 | popd >/dev/null 57 | -------------------------------------------------------------------------------- /tools/start-dvm-fne.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # SPDX-License-Identifier: GPL-2.0-only 3 | #/** 4 | #* Digital Voice Modem - Host Software 5 | #* GPLv2 Open Source. Use is subject to license terms. 6 | #* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7 | #* 8 | #*/ 9 | #/* 10 | #* Copyright (C) 2022 by Bryan Biedenkapp N2PLL 11 | #* 12 | #* This program is free software; you can redistribute it and/or modify 13 | #* it under the terms of the GNU General Public License as published by 14 | #* the Free Software Foundation; either version 2 of the License, or 15 | #* (at your option) any later version. 16 | #* 17 | #* This program is distributed in the hope that it will be useful, 18 | #* but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | #* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | #* GNU General Public License for more details. 21 | #* 22 | #* You should have received a copy of the GNU General Public License 23 | #* along with this program; if not, write to the Free Software 24 | #* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 25 | #*/ 26 | R_PATH=/opt/dvm 27 | pushd ${R_PATH} >/dev/null 28 | 29 | if [ "`pwd`" != "${R_PATH}" ]; then exit 99; fi 30 | if [ -z $1 ]; then exit 2; fi 31 | 32 | CONFIG=$1 33 | if [ ! -f ${R_PATH}/${CONFIG} ]; then exit 3; fi 34 | PID_FILE=$2 35 | if [ -z $2 ]; then 36 | STRIPPED_CONFIG=`basename ${CONFIG}` 37 | STRIPPED_CONFIG=${STRIPPED_CONFIG%.yml} 38 | PID_FILE=/tmp/dvmfne.${STRIPPED_CONFIG}.pid 39 | fi 40 | 41 | COMMAND="${R_PATH}/bin/dvmfne -c ${R_PATH}/${CONFIG}" 42 | nice -n -10 ${COMMAND} 43 | 44 | if [ -e /tmp/${CONFIG}.pid ]; then rm -f /tmp/${CONFIG}.pid; fi 45 | 46 | PID=`pgrep -f "${R_PATH}/${CONFIG}"` 47 | 48 | echo "${PID}" > $PID_FILE 49 | pgrep -f "[f]ne-watchdog.*${PID_FILE}" >/dev/null 50 | if [ $? -ne 0 ]; then 51 | ${R_PATH}/fne-watchdog.sh $PID_FILE $CONFIG & 52 | fi 53 | 54 | popd >/dev/null 55 | -------------------------------------------------------------------------------- /tools/start-dvm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # SPDX-License-Identifier: GPL-2.0-only 3 | #/** 4 | #* Digital Voice Modem - Host Software 5 | #* GPLv2 Open Source. Use is subject to license terms. 6 | #* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7 | #* 8 | #*/ 9 | #/* 10 | #* Copyright (C) 2022 by Bryan Biedenkapp N2PLL 11 | #* 12 | #* This program is free software; you can redistribute it and/or modify 13 | #* it under the terms of the GNU General Public License as published by 14 | #* the Free Software Foundation; either version 2 of the License, or 15 | #* (at your option) any later version. 16 | #* 17 | #* This program is distributed in the hope that it will be useful, 18 | #* but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | #* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | #* GNU General Public License for more details. 21 | #* 22 | #* You should have received a copy of the GNU General Public License 23 | #* along with this program; if not, write to the Free Software 24 | #* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 25 | #*/ 26 | R_PATH=/opt/dvm 27 | pushd ${R_PATH} >/dev/null 28 | 29 | if [ "`pwd`" != "${R_PATH}" ]; then exit 99; fi 30 | if [ -z $1 ]; then exit 2; fi 31 | 32 | CONFIG=$1 33 | if [ ! -f ${R_PATH}/${CONFIG} ]; then exit 3; fi 34 | PID_FILE=$2 35 | if [ -z $2 ]; then 36 | STRIPPED_CONFIG=`basename ${CONFIG}` 37 | STRIPPED_CONFIG=${STRIPPED_CONFIG%.yml} 38 | PID_FILE=/tmp/dvmhost.${STRIPPED_CONFIG}.pid 39 | fi 40 | 41 | COMMAND="${R_PATH}/bin/dvmhost -c ${R_PATH}/${CONFIG}" 42 | nice -n -20 ${COMMAND} 43 | 44 | if [ -e /tmp/${CONFIG}.pid ]; then rm -f /tmp/${CONFIG}.pid; fi 45 | 46 | PID=`pgrep -f "${R_PATH}/${CONFIG}"` 47 | 48 | echo "${PID}" > $PID_FILE 49 | pgrep -f "[d]vm-watchdog.*${PID_FILE}" >/dev/null 50 | if [ $? -ne 0 ]; then 51 | ${R_PATH}/dvm-watchdog.sh $PID_FILE $CONFIG & 52 | fi 53 | 54 | popd >/dev/null 55 | -------------------------------------------------------------------------------- /tools/stop-dvm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # SPDX-License-Identifier: GPL-2.0-only 3 | #/** 4 | #* Digital Voice Modem - Host Software 5 | #* GPLv2 Open Source. Use is subject to license terms. 6 | #* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7 | #* 8 | #*/ 9 | #/* 10 | #* Copyright (C) 2022 by Bryan Biedenkapp N2PLL 11 | #* 12 | #* This program is free software; you can redistribute it and/or modify 13 | #* it under the terms of the GNU General Public License as published by 14 | #* the Free Software Foundation; either version 2 of the License, or 15 | #* (at your option) any later version. 16 | #* 17 | #* This program is distributed in the hope that it will be useful, 18 | #* but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | #* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | #* GNU General Public License for more details. 21 | #* 22 | #* You should have received a copy of the GNU General Public License 23 | #* along with this program; if not, write to the Free Software 24 | #* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 25 | #*/ 26 | PID=`pgrep dvmhost` 27 | pgrep dvmhost >/dev/null 28 | if [ $? -eq 0 ]; then 29 | kill -15 $PID 30 | sleep 2s 31 | pgrep dvmhost >/dev/null 32 | if [ $? -eq 0 ]; then 33 | kill -9 $PID 34 | fi 35 | fi 36 | 37 | PID=`pgrep dvm-watchdog.sh` 38 | pgrep dvm-watchdog.sh >/dev/null 39 | if [ $? -eq 0 ]; then 40 | kill -9 $PID 41 | fi 42 | 43 | -------------------------------------------------------------------------------- /tools/stop-watchdog.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # SPDX-License-Identifier: GPL-2.0-only 3 | #/** 4 | #* Digital Voice Modem - Host Software 5 | #* GPLv2 Open Source. Use is subject to license terms. 6 | #* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7 | #* 8 | #*/ 9 | #/* 10 | #* Copyright (C) 2022 by Bryan Biedenkapp N2PLL 11 | #* 12 | #* This program is free software; you can redistribute it and/or modify 13 | #* it under the terms of the GNU General Public License as published by 14 | #* the Free Software Foundation; either version 2 of the License, or 15 | #* (at your option) any later version. 16 | #* 17 | #* This program is distributed in the hope that it will be useful, 18 | #* but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | #* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | #* GNU General Public License for more details. 21 | #* 22 | #* You should have received a copy of the GNU General Public License 23 | #* along with this program; if not, write to the Free Software 24 | #* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 25 | #*/ 26 | PID=`pgrep dvm-watchdog.sh` 27 | pgrep dvm-watchdog.sh >/dev/null 28 | if [ $? -eq 0 ]; then 29 | kill -9 $PID 30 | fi 31 | 32 | --------------------------------------------------------------------------------