2018-08-20 22:47:13 -07:00
|
|
|
/*
|
|
|
|
* Configuration Utility for DMR radios.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2018 Serge Vakulenko, KK6ABQ
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are met:
|
|
|
|
*
|
|
|
|
* 1. Redistributions of source code must retain the above copyright notice,
|
|
|
|
* this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. The name of the author may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
|
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
|
|
|
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
|
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
|
|
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
|
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
|
|
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
|
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
//
|
|
|
|
// Connect to the radio via the serial port.
|
|
|
|
// Identify the type of device.
|
|
|
|
//
|
2021-02-28 02:32:10 -08:00
|
|
|
//void radio_connect(void);
|
2018-08-20 22:47:13 -07:00
|
|
|
|
|
|
|
//
|
|
|
|
// Close the serial port.
|
|
|
|
//
|
|
|
|
void radio_disconnect(void);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Read firmware image from the device.
|
|
|
|
//
|
2021-02-28 02:32:10 -08:00
|
|
|
//void radio_download(void);
|
2018-08-20 22:47:13 -07:00
|
|
|
|
|
|
|
//
|
|
|
|
// Write firmware image to the device.
|
|
|
|
//
|
2021-02-28 02:40:00 -08:00
|
|
|
//void radio_upload(int cont_flag);
|
2018-08-20 22:47:13 -07:00
|
|
|
|
|
|
|
//
|
|
|
|
// Print a generic information about the device.
|
|
|
|
//
|
2021-02-28 02:32:10 -08:00
|
|
|
//void radio_print_version(FILE *out);
|
2018-08-20 22:47:13 -07:00
|
|
|
|
|
|
|
//
|
|
|
|
// Print full information about the device configuration.
|
|
|
|
//
|
|
|
|
void radio_print_config(FILE *out, int verbose);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Read firmware image from the binary file.
|
|
|
|
//
|
2018-09-05 21:03:03 -07:00
|
|
|
void radio_read_image(const char *filename);
|
2018-08-20 22:47:13 -07:00
|
|
|
|
|
|
|
//
|
|
|
|
// Save firmware image to the binary file.
|
|
|
|
//
|
2018-09-05 21:03:03 -07:00
|
|
|
void radio_save_image(const char *filename);
|
2018-08-20 22:47:13 -07:00
|
|
|
|
|
|
|
//
|
|
|
|
// Read the configuration from text file, and modify the firmware.
|
|
|
|
//
|
2018-09-05 21:03:03 -07:00
|
|
|
void radio_parse_config(const char *filename);
|
2018-08-20 22:47:13 -07:00
|
|
|
|
2018-08-31 18:19:53 -07:00
|
|
|
//
|
|
|
|
// Check the configuration.
|
|
|
|
//
|
2018-09-05 21:03:03 -07:00
|
|
|
void radio_verify_config(void);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Update CSV contacts database.
|
|
|
|
//
|
|
|
|
void radio_write_csv(const char *filename);
|
2018-08-31 18:19:53 -07:00
|
|
|
|
2018-09-10 18:50:55 -07:00
|
|
|
//
|
|
|
|
// List all supported radios.
|
|
|
|
//
|
2021-02-28 02:32:10 -08:00
|
|
|
//void radio_list_c(void);
|
2018-09-10 18:50:55 -07:00
|
|
|
|
2018-09-13 23:31:39 -07:00
|
|
|
//
|
|
|
|
// Check for compatible radio model.
|
|
|
|
//
|
|
|
|
int radio_is_compatible(const char *ident);
|
|
|
|
|
2018-08-20 22:47:13 -07:00
|
|
|
//
|
|
|
|
// Device-dependent interface to the radio.
|
|
|
|
//
|
2018-08-29 17:44:46 -07:00
|
|
|
typedef struct _radio_device_t radio_device_t;
|
|
|
|
struct _radio_device_t {
|
2018-08-20 22:47:13 -07:00
|
|
|
const char *name;
|
2018-08-29 17:44:46 -07:00
|
|
|
void (*download)(radio_device_t *radio);
|
|
|
|
void (*upload)(radio_device_t *radio, int cont_flag);
|
|
|
|
int (*is_compatible)(radio_device_t *radio);
|
|
|
|
void (*read_image)(radio_device_t *radio, FILE *img);
|
|
|
|
void (*save_image)(radio_device_t *radio, FILE *img);
|
|
|
|
void (*print_version)(radio_device_t *radio, FILE *out);
|
|
|
|
void (*print_config)(radio_device_t *radio, FILE *out, int verbose);
|
2018-08-31 18:19:53 -07:00
|
|
|
int (*verify_config)(radio_device_t *radio);
|
2018-08-29 17:44:46 -07:00
|
|
|
void (*parse_parameter)(radio_device_t *radio, char *param, char *value);
|
|
|
|
int (*parse_header)(radio_device_t *radio, char *line);
|
|
|
|
int (*parse_row)(radio_device_t *radio, int table_id, int first_row, char *line);
|
2018-08-29 21:04:13 -07:00
|
|
|
void (*update_timestamp)(radio_device_t *radio);
|
2018-09-05 21:03:03 -07:00
|
|
|
void (*write_csv)(radio_device_t *radio, FILE *csv);
|
2018-08-30 00:45:29 -07:00
|
|
|
int channel_count;
|
2018-08-29 17:44:46 -07:00
|
|
|
};
|
2018-08-20 22:47:13 -07:00
|
|
|
|
2018-09-05 12:53:36 -07:00
|
|
|
extern radio_device_t radio_md380; // TYT MD-380
|
2018-11-27 19:11:57 -08:00
|
|
|
extern radio_device_t radio_md390; // TYT MD-390
|
2018-09-05 12:53:36 -07:00
|
|
|
extern radio_device_t radio_md2017; // TYT MD-2017
|
|
|
|
extern radio_device_t radio_uv380; // TYT MD-UV380
|
2018-09-10 18:50:55 -07:00
|
|
|
extern radio_device_t radio_uv390; // TYT MD-UV390
|
|
|
|
extern radio_device_t radio_md9600; // TYT MD-9600
|
2018-09-05 12:53:36 -07:00
|
|
|
extern radio_device_t radio_d900; // Zastone D900
|
|
|
|
extern radio_device_t radio_dp880; // Zastone DP880
|
|
|
|
extern radio_device_t radio_rt27d; // Radtel RT-27D
|
2018-09-15 15:43:23 -07:00
|
|
|
extern radio_device_t radio_rd5r; // Baofeng RD-5R
|
2018-10-04 20:50:00 -07:00
|
|
|
extern radio_device_t radio_gd77; // Radioddity GD-77, version 3.1.1 and later
|
2019-07-26 19:45:29 -07:00
|
|
|
extern radio_device_t radio_dm1801; // Baofeng DM-1801
|
2018-10-13 21:16:03 -07:00
|
|
|
extern radio_device_t radio_d868uv; // Anytone AT-D868UV
|
2018-12-10 09:59:34 -08:00
|
|
|
extern radio_device_t radio_d878uv; // Anytone AT-D878UV
|
2018-11-09 17:46:05 -08:00
|
|
|
extern radio_device_t radio_dmr6x2; // BTECH DMR-6x2
|
2018-11-21 00:37:12 -08:00
|
|
|
extern radio_device_t radio_rt84; // Baofeng DM-1701, Retevis RT84
|
2018-08-20 22:47:13 -07:00
|
|
|
|
|
|
|
//
|
|
|
|
// Radio: memory contents.
|
|
|
|
//
|
|
|
|
extern unsigned char radio_mem[];
|
|
|
|
|
|
|
|
//
|
|
|
|
// File descriptor of serial port with programming cable attached.
|
|
|
|
//
|
2021-01-05 11:50:26 -08:00
|
|
|
extern int radio_port;
|
2018-08-20 22:47:13 -07:00
|
|
|
|
|
|
|
//
|
|
|
|
// Read/write progress counter.
|
|
|
|
//
|
2021-01-05 11:50:26 -08:00
|
|
|
extern int radio_progress;
|