|
|
|
@ -898,12 +898,12 @@ void TSBK::encode(uint8_t* data, bool rawTSBK, bool noTrellis)
|
|
|
|
std::chrono::system_clock::time_point now = std::chrono::system_clock::now();
|
|
|
|
std::chrono::system_clock::time_point now = std::chrono::system_clock::now();
|
|
|
|
time_t tt = std::chrono::system_clock::to_time_t( now );
|
|
|
|
time_t tt = std::chrono::system_clock::to_time_t( now );
|
|
|
|
tm local_tm = *gmtime( &tt );
|
|
|
|
tm local_tm = *gmtime( &tt );
|
|
|
|
unsigned long tmM = 0b000;//Month; +1 to account for tm_mon being 0-11 and p25 being 1-12
|
|
|
|
unsigned long tmM = 0b000;
|
|
|
|
unsigned long tmMDAY = 0b00000;//Day of month
|
|
|
|
unsigned long tmMDAY = 0b00000;
|
|
|
|
unsigned int tmY = 0b0000000000000;//Year
|
|
|
|
uint32_t tmY = 0b0000000000000;
|
|
|
|
unsigned int tmH = 0b00000;//Hour
|
|
|
|
uint32_t tmH = 0b00000;
|
|
|
|
unsigned int tmMin = 0b000000;//Min
|
|
|
|
uint32_t tmMin = 0b000000;
|
|
|
|
unsigned int tmS = 0b000000;//Second
|
|
|
|
uint32_t tmS = 0b000000;
|
|
|
|
|
|
|
|
|
|
|
|
//Assign Values
|
|
|
|
//Assign Values
|
|
|
|
tmM |= (local_tm.tm_mon + 1);//Month; +1 to account for tm_mon being 0-11 and p25 being 1-12
|
|
|
|
tmM |= (local_tm.tm_mon + 1);//Month; +1 to account for tm_mon being 0-11 and p25 being 1-12
|
|
|
|
@ -911,16 +911,14 @@ void TSBK::encode(uint8_t* data, bool rawTSBK, bool noTrellis)
|
|
|
|
tmY |= local_tm.tm_year;//Year
|
|
|
|
tmY |= local_tm.tm_year;//Year
|
|
|
|
tmH |= local_tm.tm_hour;//Hour
|
|
|
|
tmH |= local_tm.tm_hour;//Hour
|
|
|
|
tmMin |= local_tm.tm_min;//Min
|
|
|
|
tmMin |= local_tm.tm_min;//Min
|
|
|
|
unsigned int i = local_tm.tm_sec;
|
|
|
|
uint32_t i = local_tm.tm_sec;
|
|
|
|
unsigned long VFLAGS = 0b11100000; // VL,VT,VD, Res(leave 0),LTO direction, LTO
|
|
|
|
unsigned long VFLAGS = 0xE0; // VL,VT,VD, Res(leave 0),LTO direction, LTO
|
|
|
|
unsigned long VLTO = 0b00000000; // LTO
|
|
|
|
unsigned long VLTO = 0b00000000; // LTO
|
|
|
|
|
|
|
|
|
|
|
|
//Catch Leap Seconds
|
|
|
|
//Catch Leap Seconds
|
|
|
|
if ( i > 59U )
|
|
|
|
if (i > 59U) {
|
|
|
|
{
|
|
|
|
|
|
|
|
tmS |= 59U;
|
|
|
|
tmS |= 59U;
|
|
|
|
} else
|
|
|
|
} else {
|
|
|
|
{
|
|
|
|
|
|
|
|
tmS |= i;
|
|
|
|
tmS |= i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -928,7 +926,7 @@ void TSBK::encode(uint8_t* data, bool rawTSBK, bool noTrellis)
|
|
|
|
tmY = tmY - 100U;
|
|
|
|
tmY = tmY - 100U;
|
|
|
|
|
|
|
|
|
|
|
|
//Shift Shift
|
|
|
|
//Shift Shift
|
|
|
|
VFLAGS = VFLAGS << 56 ;
|
|
|
|
VFLAGS = VFLAGS << 56 ; //Flags
|
|
|
|
VLTO = VLTO << 48; //LTO
|
|
|
|
VLTO = VLTO << 48; //LTO
|
|
|
|
tmM = tmM << 44; //Month
|
|
|
|
tmM = tmM << 44; //Month
|
|
|
|
tmMDAY = tmMDAY << 39; //Day of month
|
|
|
|
tmMDAY = tmMDAY << 39; //Day of month
|
|
|
|
@ -939,9 +937,9 @@ void TSBK::encode(uint8_t* data, bool rawTSBK, bool noTrellis)
|
|
|
|
|
|
|
|
|
|
|
|
//Build tsbkValue
|
|
|
|
//Build tsbkValue
|
|
|
|
tsbkValue = 0U; //Zero out tsbkValue
|
|
|
|
tsbkValue = 0U; //Zero out tsbkValue
|
|
|
|
|
|
|
|
//Flags
|
|
|
|
tsbkValue = tsbkValue + VFLAGS;
|
|
|
|
tsbkValue = tsbkValue + VFLAGS;
|
|
|
|
tsbkValue = tsbkValue + VLTO; //LTO
|
|
|
|
tsbkValue = tsbkValue + VLTO;
|
|
|
|
//Date
|
|
|
|
//Date
|
|
|
|
tsbkValue = tsbkValue + tmM;
|
|
|
|
tsbkValue = tsbkValue + tmM;
|
|
|
|
tsbkValue = tsbkValue + tmMDAY;
|
|
|
|
tsbkValue = tsbkValue + tmMDAY;
|
|
|
|
@ -951,7 +949,7 @@ void TSBK::encode(uint8_t* data, bool rawTSBK, bool noTrellis)
|
|
|
|
tsbkValue = tsbkValue + tmMin;
|
|
|
|
tsbkValue = tsbkValue + tmMin;
|
|
|
|
tsbkValue = tsbkValue + tmS;
|
|
|
|
tsbkValue = tsbkValue + tmS;
|
|
|
|
|
|
|
|
|
|
|
|
//Debug Stuff, Comment out or put in a #if DEBUG statement before push
|
|
|
|
#if DEBUG_P25_TSBK
|
|
|
|
LogError(LOG_P25 , "TSBK_OSP_TIME_DATE_ANN (Dump Start)");
|
|
|
|
LogError(LOG_P25 , "TSBK_OSP_TIME_DATE_ANN (Dump Start)");
|
|
|
|
LogError(LOG_P25 , "tsbkValue RAW= $%p" , tsbkValue);
|
|
|
|
LogError(LOG_P25 , "tsbkValue RAW= $%p" , tsbkValue);
|
|
|
|
LogError(LOG_P25 , "tmM= $%p" , tmM);
|
|
|
|
LogError(LOG_P25 , "tmM= $%p" , tmM);
|
|
|
|
@ -961,6 +959,7 @@ void TSBK::encode(uint8_t* data, bool rawTSBK, bool noTrellis)
|
|
|
|
LogError(LOG_P25 , "tmMin= $%p" , tmMin);
|
|
|
|
LogError(LOG_P25 , "tmMin= $%p" , tmMin);
|
|
|
|
LogError(LOG_P25 , "tmS= $%p" , tmS);
|
|
|
|
LogError(LOG_P25 , "tmS= $%p" , tmS);
|
|
|
|
LogError(LOG_P25 , "TSBK_OSP_TIME_DATE_ANN (Dump End)");
|
|
|
|
LogError(LOG_P25 , "TSBK_OSP_TIME_DATE_ANN (Dump End)");
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
}break;
|
|
|
|
}break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
|