diff --git a/DSP_API/SmartSDR_Interface/cmd_basics.c b/DSP_API/SmartSDR_Interface/cmd_basics.c index cb2070d..64cd804 100644 --- a/DSP_API/SmartSDR_Interface/cmd_basics.c +++ b/DSP_API/SmartSDR_Interface/cmd_basics.c @@ -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); } diff --git a/DSP_API/SmartSDR_Interface/sched_waveform.c b/DSP_API/SmartSDR_Interface/sched_waveform.c index 759c4f6..01d189e 100644 --- a/DSP_API/SmartSDR_Interface/sched_waveform.c +++ b/DSP_API/SmartSDR_Interface/sched_waveform.c @@ -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; } diff --git a/DSP_API/SmartSDR_Interface/sched_waveform.h b/DSP_API/SmartSDR_Interface/sched_waveform.h index 95c0d08..250f8ed 100644 --- a/DSP_API/SmartSDR_Interface/sched_waveform.h +++ b/DSP_API/SmartSDR_Interface/sched_waveform.h @@ -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);