3636// upper bound.
3737#define NGLYPHS (sizeof (fsq_code_table)/sizeof (fsq_code_table[0 ]))
3838
39- // uint8_t JTEncode::crc8_table[256];
40-
4139/* Public Class Members */
4240
4341JTEncode::JTEncode (void )
@@ -47,7 +45,7 @@ JTEncode::JTEncode(void)
4745}
4846
4947/*
50- * jt65_encode(String message, uint8_t * symbols)
48+ * jt65_encode(char * message, uint8_t * symbols)
5149 *
5250 * Takes an arbitrary message of up to 13 allowable characters and returns
5351 * a channel symbol table.
@@ -57,22 +55,16 @@ JTEncode::JTEncode(void)
5755 * Ensure that you pass a uint8_t array of size JT65_SYMBOL_COUNT to the method.
5856 *
5957 */
60- void JTEncode::jt65_encode (String message, uint8_t * symbols)
58+ void JTEncode::jt65_encode (char * message, uint8_t * symbols)
6159{
62- char message_array[14 ];
63-
64- // Convert the String to C-style char array
65- // ----------------------------------------
66- message.toCharArray (message_array, 14 );
67-
6860 // Ensure that the message text conforms to standards
6961 // --------------------------------------------------
70- jt_message_prep (message_array );
62+ jt_message_prep (message );
7163
7264 // Bit packing
7365 // -----------
7466 uint8_t c[12 ];
75- jt65_bit_packing (message_array , c);
67+ jt65_bit_packing (message , c);
7668
7769 // Reed-Solomon encoding
7870 // ---------------------
@@ -93,7 +85,7 @@ void JTEncode::jt65_encode(String message, uint8_t * symbols)
9385}
9486
9587/*
96- * jt9_encode(String message, uint8_t * symbols)
88+ * jt9_encode(char * message, uint8_t * symbols)
9789 *
9890 * Takes an arbitrary message of up to 13 allowable characters and returns
9991 * a channel symbol table.
@@ -103,22 +95,16 @@ void JTEncode::jt65_encode(String message, uint8_t * symbols)
10395 * Ensure that you pass a uint8_t array of size JT9_SYMBOL_COUNT to the method.
10496 *
10597 */
106- void JTEncode::jt9_encode (String message, uint8_t * symbols)
98+ void JTEncode::jt9_encode (char * message, uint8_t * symbols)
10799{
108- char message_array[14 ];
109-
110- // Convert the String to C-style char array
111- // ----------------------------------------
112- message.toCharArray (message_array, 14 );
113-
114100 // Ensure that the message text conforms to standards
115101 // --------------------------------------------------
116- jt_message_prep (message_array );
102+ jt_message_prep (message );
117103
118104 // Bit packing
119105 // -----------
120106 uint8_t c[13 ];
121- jt9_bit_packing (message_array , c);
107+ jt9_bit_packing (message , c);
122108
123109 // Convolutional Encoding
124110 // ---------------------
@@ -144,7 +130,7 @@ void JTEncode::jt9_encode(String message, uint8_t * symbols)
144130}
145131
146132/*
147- * jt4_encode(String message, uint8_t * symbols)
133+ * jt4_encode(char * message, uint8_t * symbols)
148134 *
149135 * Takes an arbitrary message of up to 13 allowable characters and returns
150136 * a channel symbol table.
@@ -154,22 +140,16 @@ void JTEncode::jt9_encode(String message, uint8_t * symbols)
154140 * Ensure that you pass a uint8_t array of size JT9_SYMBOL_COUNT to the method.
155141 *
156142 */
157- void JTEncode::jt4_encode (String message, uint8_t * symbols)
143+ void JTEncode::jt4_encode (char * message, uint8_t * symbols)
158144{
159- char message_array[14 ];
160-
161- // Convert the String to C-style char array
162- // ----------------------------------------
163- message.toCharArray (message_array, 14 );
164-
165145 // Ensure that the message text conforms to standards
166146 // --------------------------------------------------
167- jt_message_prep (message_array );
147+ jt_message_prep (message );
168148
169149 // Bit packing
170150 // -----------
171151 uint8_t c[13 ];
172- jt9_bit_packing (message_array , c);
152+ jt9_bit_packing (message , c);
173153
174154 // Convolutional Encoding
175155 // ---------------------
@@ -188,7 +168,7 @@ void JTEncode::jt4_encode(String message, uint8_t * symbols)
188168}
189169
190170/*
191- * wspr_encode(String call, String loc, uint8_t dbm, uint8_t * symbols)
171+ * wspr_encode(char * call, char * loc, uint8_t dbm, uint8_t * symbols)
192172 *
193173 * Takes an arbitrary message of up to 13 allowable characters and returns
194174 *
@@ -199,19 +179,11 @@ void JTEncode::jt4_encode(String message, uint8_t * symbols)
199179 * Ensure that you pass a uint8_t array of size WSPR_SYMBOL_COUNT to the method.
200180 *
201181 */
202- void JTEncode::wspr_encode (String call, String loc, uint8_t dbm, uint8_t * symbols)
182+ void JTEncode::wspr_encode (char * call, char * loc, uint8_t dbm, uint8_t * symbols)
203183{
204- char call_array[8 ];
205- char loc_array[8 ];
206-
207- // Convert the String to C-style char array
208- // ----------------------------------------
209- call.toCharArray (call_array, 8 );
210- loc.toCharArray (loc_array, 8 );
211-
212184 // Ensure that the message text conforms to standards
213185 // --------------------------------------------------
214- wspr_message_prep (call_array, loc_array , dbm);
186+ wspr_message_prep (call, loc , dbm);
215187
216188 // Bit packing
217189 // -----------
@@ -233,7 +205,7 @@ void JTEncode::wspr_encode(String call, String loc, uint8_t dbm, uint8_t * symbo
233205}
234206
235207/*
236- * fsq_encode(String from_call, String message, uint8_t * symbols)
208+ * fsq_encode(cahr * from_call, char * message, uint8_t * symbols)
237209 *
238210 * Takes an arbitrary message and returns a FSQ channel symbol table.
239211 *
@@ -244,7 +216,7 @@ void JTEncode::wspr_encode(String call, String loc, uint8_t dbm, uint8_t * symbo
244216 * plus 5 characters to the method. Terminated in 0xFF.
245217 *
246218 */
247- void JTEncode::fsq_encode (String from_call, String message, uint8_t * symbols)
219+ void JTEncode::fsq_encode (char * from_call, char * message, uint8_t * symbols)
248220{
249221 char tx_buffer[155 ];
250222 char * tx_message;
@@ -258,7 +230,7 @@ void JTEncode::fsq_encode(String from_call, String message, uint8_t * symbols)
258230
259231 // Create the message to be transmitted
260232 // ------------------------------------
261- sprintf (tx_buffer, " \n %s: %s" , from_call. c_str () , message. c_str () );
233+ sprintf (tx_buffer, " \n %s: %s" , from_call, message);
262234
263235 tx_message = tx_buffer;
264236
@@ -318,7 +290,7 @@ void JTEncode::fsq_encode(String from_call, String message, uint8_t * symbols)
318290}
319291
320292/*
321- * fsq_dir_encode(String from_call, String to_call, char cmd, String message, uint8_t * symbols)
293+ * fsq_dir_encode(char * from_call, char * to_call, char cmd, char * message, uint8_t * symbols)
322294 *
323295 * Takes an arbitrary message and returns a FSQ channel symbol table.
324296 *
@@ -331,7 +303,7 @@ void JTEncode::fsq_encode(String from_call, String message, uint8_t * symbols)
331303 * plus 5 characters to the method. Terminated in 0xFF.
332304 *
333305 */
334- void JTEncode::fsq_dir_encode (String from_call, String to_call, char cmd, String message, uint8_t * symbols)
306+ void JTEncode::fsq_dir_encode (char * from_call, char * to_call, char cmd, char * message, uint8_t * symbols)
335307{
336308 char tx_buffer[155 ];
337309 char * tx_message;
@@ -341,7 +313,7 @@ void JTEncode::fsq_dir_encode(String from_call, String to_call, char cmd, String
341313
342314 // Generate a CRC on from_call
343315 // ---------------------------
344- from_call_crc = crc8 (from_call. c_str () );
316+ from_call_crc = crc8 (from_call);
345317
346318 // Clear out the transmit buffer
347319 // -----------------------------
@@ -351,7 +323,7 @@ void JTEncode::fsq_dir_encode(String from_call, String to_call, char cmd, String
351323 // We are building a directed message here.
352324 // FSQ very specifically needs " \b " in
353325 // directed mode to indicate EOT. A single backspace won't do it.
354- sprintf (tx_buffer, " \n %s:%02x%s%c%s%s" , from_call. c_str () , from_call_crc, to_call. c_str () , cmd, message. c_str () , " \b " );
326+ sprintf (tx_buffer, " \n %s:%02x%s%c%s%s" , from_call, from_call_crc, to_call, cmd, message, " \b " );
355327
356328 tx_message = tx_buffer;
357329
0 commit comments