More Decoding
This commit is contained in:
parent
ce29b8de2d
commit
8a378fe2c1
22
dmrlink.py
22
dmrlink.py
@ -949,6 +949,7 @@ class IPSC(DatagramProtocol):
|
|||||||
def datagramReceived(self, data, (host, port)):
|
def datagramReceived(self, data, (host, port)):
|
||||||
_packettype = data[0:1]
|
_packettype = data[0:1]
|
||||||
_peerid = data[1:5]
|
_peerid = data[1:5]
|
||||||
|
_ipsc_seq = data[5:6]
|
||||||
|
|
||||||
# AUTHENTICATE THE PACKET
|
# AUTHENTICATE THE PACKET
|
||||||
if not self.validate_auth(self._local['AUTH_KEY'], data):
|
if not self.validate_auth(self._local['AUTH_KEY'], data):
|
||||||
@ -966,12 +967,25 @@ class IPSC(DatagramProtocol):
|
|||||||
|
|
||||||
# ORIGINATED BY SUBSCRIBER UNITS - a.k.a someone transmitted
|
# ORIGINATED BY SUBSCRIBER UNITS - a.k.a someone transmitted
|
||||||
if _packettype in USER_PACKETS:
|
if _packettype in USER_PACKETS:
|
||||||
# Extract commonly used items from the packet header
|
# Extract IPSC header not already extracted
|
||||||
_src_sub = data[6:9]
|
_src_sub = data[6:9]
|
||||||
_dst_sub = data[9:12]
|
_dst_sub = data[9:12]
|
||||||
_call = int_id(data[17:18])
|
_call_type = data[12:13]
|
||||||
_ts = bool(_call & TS_CALL_MSK)
|
_unknown_1 = data[13:17]
|
||||||
_end = bool(_call & END_MSK)
|
_call_info = int_id(data[17:18])
|
||||||
|
_ts = bool(_call_info & TS_CALL_MSK)
|
||||||
|
_end = bool(_call_info & END_MSK)
|
||||||
|
|
||||||
|
# Extract RTP header fields
|
||||||
|
'''
|
||||||
|
Coming soon kids!!!
|
||||||
|
Looks like version, padding, extention, CSIC, payload type and SSID never change.
|
||||||
|
The things we might care about are below.
|
||||||
|
_rtp_byte_1 = int_id(data[18:19])
|
||||||
|
_rtp_byte_2 = int_id(data[19:20])
|
||||||
|
_rtp_seq = int_id(data[20:22])
|
||||||
|
_rtp_tmstmp = int_id(data[22:26])
|
||||||
|
'''
|
||||||
|
|
||||||
# User Voice and Data Call Types:
|
# User Voice and Data Call Types:
|
||||||
if _packettype == GROUP_VOICE:
|
if _packettype == GROUP_VOICE:
|
||||||
|
@ -6,6 +6,11 @@
|
|||||||
# Creative Commons, 444 Castro Street, Suite 900, Mountain View,
|
# Creative Commons, 444 Castro Street, Suite 900, Mountain View,
|
||||||
# California, 94041, USA.
|
# California, 94041, USA.
|
||||||
|
|
||||||
|
# MASKS FOR IPSC, RTP AND THE RTP PAYLOAD (DMR FRAME + FRIENDS) ARE LOCATED
|
||||||
|
# IN THIS FILE IN THIS ORDER: IPSC, RTP, PAYLOAD
|
||||||
|
|
||||||
|
# IPSC MASK VALUES
|
||||||
|
#
|
||||||
# LINKING STATUS:
|
# LINKING STATUS:
|
||||||
# Byte 1 - BIT FLAGS:
|
# Byte 1 - BIT FLAGS:
|
||||||
# xx.. .... = Peer Operational (01 only known valid value)
|
# xx.. .... = Peer Operational (01 only known valid value)
|
||||||
@ -53,11 +58,33 @@ VOICE_CALL_MSK = 0b00000100
|
|||||||
MSTR_PEER_MSK = 0b00000001
|
MSTR_PEER_MSK = 0b00000001
|
||||||
|
|
||||||
# TIMESLOT CALL & STATUS BYTE
|
# TIMESLOT CALL & STATUS BYTE
|
||||||
|
|
||||||
# Byte 17 of Group and Private Voice/Data Packets
|
# Byte 17 of Group and Private Voice/Data Packets
|
||||||
# ..x.. ....TS Value (0=TS1, 1=TS2)
|
# ..x.. ....TS Value (0=TS1, 1=TS2)
|
||||||
# .x... ....TS In Progress/End (0=In Progress, 1=End)
|
# .x... ....TS In Progress/End (0=In Progress, 1=End)
|
||||||
# Possible values: 0x00=TS1, 0x20=TS2, 0x40=TS1 End, 0x60=TS2 End
|
# Possible values: 0x00=TS1, 0x20=TS2, 0x40=TS1 End, 0x60=TS2 End
|
||||||
# MASK VALUE:
|
# MASK VALUE:
|
||||||
END_MSK = 0b01000000
|
END_MSK = 0b01000000
|
||||||
TS_CALL_MSK = 0b00100000
|
TS_CALL_MSK = 0b00100000
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# RTP MASK VALUES
|
||||||
|
# Bytes 1 and 2 of the RTP header are bit-fields, the rest
|
||||||
|
# are at least one byte long, and do not need masked
|
||||||
|
# Byte 1
|
||||||
|
RTP_VER_MSK = 0b11000000
|
||||||
|
RTP_PAD_MSK = 0b00100000
|
||||||
|
RTP_EXT_MSK = 0b00010000
|
||||||
|
RTP_CSIC_MSK = 0b00001111
|
||||||
|
# Byte 2
|
||||||
|
RTP_MRKR_MSK = 0b10000000
|
||||||
|
RTP_PAY_TYPE_MSK = 0b01111111
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# RTP PAYLOAD (DMR FRAME + FRIENDS) MASK VALUES
|
||||||
|
# This one is tricky. The DMR Frame contents are here
|
||||||
|
# and re-ordered from their position in the original DMR
|
||||||
|
# frame format. There are also some other friends in here
|
||||||
|
# that Motorla added.
|
||||||
|
#
|
Loading…
Reference in New Issue
Block a user