Add functions to set DSTAR message field.

This commit is contained in:
Ed Gonzalez 2015-08-26 14:41:06 -05:00
parent 8a210b587b
commit 253ab84a34
3 changed files with 31 additions and 2 deletions

View file

@ -291,7 +291,9 @@ uint32 cmd_slice(int requester_fd, int argc, char **argv)
} else if ( strncmp(argv[i], "own_call2", strlen("own_call2") ) == 0 ) {
char * call = argv[i] + strlen("own_call2") + 1;
sched_waveform_setOwnCall2(slc, call);
} else if ( strncmp(argv[i], "message", strlen("message")) == 0 ) {
char * message = argv[i] + strlen("message") + 1;
sched_waveform_setMessage(slc, message);
}

View file

@ -220,8 +220,9 @@ void sched_waveform_setDestinationRptr( uint32 slice , const char * destination_
_dstar->outgoing_header.destination_rptr[8] = '\0';
if ( strncmp( _dstar->outgoing_header.destination_rptr, "DIRECT", strlen( "DIRECT" ) ) != 0 ) {
output( "WOOT\n" );
_dstar->outgoing_header.flag1 = 0x1 << 6;
} else {
_dstar->outgoing_header.flag1 = 0;
}
dstar_dumpHeader( &( _dstar->outgoing_header ) );
@ -326,6 +327,31 @@ void sched_waveform_setOwnCall2( uint32 slice , const char * owncall2 ) {
dstar_dumpHeader( &( _dstar->outgoing_header ) );
}
void sched_waveform_setMessage( uint32 slice, const char * message)
{
/* Ignore slice for now */
char string[SLOW_DATA_MESSAGE_LENGTH_BYTES + 1 ];
strncpy( string, message, SLOW_DATA_MESSAGE_LENGTH_BYTES + 1);
charReplace( string, ' ', ( char ) 0x7F );
memset(_dstar->slow_encoder->message, ' ', SLOW_DATA_MESSAGE_LENGTH_BYTES);
/* We limit the copy to the string length so that
* we can fill the rest of the string with spaces to
* comply with DSTAR
*/
uint32 copy_len = strlen( string );
if ( copy_len > SLOW_DATA_MESSAGE_LENGTH_BYTES )
copy_len = SLOW_DATA_MESSAGE_LENGTH_BYTES;
strncpy(_dstar->slow_encoder->message, string, copy_len);
/* Enforce termination */
_dstar->slow_encoder->message[SLOW_DATA_MESSAGE_LENGTH_BYTES] = '\0';
}
void sched_waveform_setFD( int fd ) {
_dv_serial_fd = fd;
}

View file

@ -46,6 +46,7 @@ void sched_waveform_setDepartureRptr(uint32 slice , const char * departure_rptr
void sched_waveform_setCompanionCall( uint32 slice, const char * companion_call);
void sched_waveform_setOwnCall1( uint32 slice , const char * owncall1 );
void sched_waveform_setOwnCall2(uint32 slice , const char * owncall2 );
void sched_waveform_setMessage( uint32 slice, const char * message);
void sched_waveform_sendStatus(uint32 slice);
void sched_waveform_setFD(int fd);