mirror of
https://github.com/g4klx/MMDVMHost.git
synced 2026-04-06 15:04:18 +00:00
Fix the P25 PDU transmit length.
This commit is contained in:
parent
082c2e1b1f
commit
2ffd831c98
3 changed files with 36 additions and 7 deletions
27
P25Utils.cpp
27
P25Utils.cpp
|
|
@ -87,6 +87,33 @@ unsigned int CP25Utils::encode(const unsigned char* in, unsigned char* out, unsi
|
|||
return n;
|
||||
}
|
||||
|
||||
unsigned int CP25Utils::encode(const unsigned char* in, unsigned char* out, unsigned int length)
|
||||
{
|
||||
assert(in != NULL);
|
||||
assert(out != NULL);
|
||||
|
||||
// Move the SSx positions to the range needed
|
||||
unsigned int ss0Pos = P25_SS0_START;
|
||||
unsigned int ss1Pos = P25_SS1_START;
|
||||
|
||||
unsigned int n = 0U;
|
||||
unsigned int pos = 0U;
|
||||
while (n < length) {
|
||||
if (pos == ss0Pos) {
|
||||
ss0Pos += P25_SS_INCREMENT;
|
||||
} else if (pos == ss1Pos) {
|
||||
ss1Pos += P25_SS_INCREMENT;
|
||||
} else {
|
||||
bool b = READ_BIT(in, n);
|
||||
WRITE_BIT(out, pos, b);
|
||||
n++;
|
||||
}
|
||||
pos++;
|
||||
}
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
unsigned int CP25Utils::compare(const unsigned char* data1, const unsigned char* data2, unsigned int length)
|
||||
{
|
||||
assert(data1 != NULL);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue