[Dsctl-devel] SF.net SVN: dsctl: [143] src
Status: Alpha
Brought to you by:
roger-linux
|
From: <rog...@us...> - 2007-11-14 04:00:19
|
Revision: 143
http://dsctl.svn.sourceforge.net/dsctl/?rev=143&view=rev
Author: roger-linux
Date: 2007-11-13 19:59:32 -0800 (Tue, 13 Nov 2007)
Log Message:
-----------
src/commands.c
src/commands.h - Finished writing functions for all commands.
Corrected comments for reading clarity.
TODO: Implement remainder of functions.
TODO: Cleanup command line interface and output.
Modified Paths:
--------------
src/commands.c
src/commands.h
Modified: src/commands.c
===================================================================
--- src/commands.c 2007-11-12 22:07:47 UTC (rev 142)
+++ src/commands.c 2007-11-14 03:59:32 UTC (rev 143)
@@ -909,7 +909,7 @@
/***********************************************************************
* Delete System
***********************************************************************/
-/* TODO: This needs to be implemented & tested */
+/* TODO: If needed, this needs to be implemented & tested */
int delete_system(int fd, int system_index)
{
char answer[100], command[500];
@@ -1739,7 +1739,7 @@
/***********************************************************************
* Get Locked Out TGIDs
***********************************************************************/
-/* TODO - Check GLI info is downloading. It seems to work. */
+/* TODO: This needs to be tested. I think it works. */
int get_lockout_tgid(int fd, int system_index)
{
char answer[100], command[100];
@@ -1782,7 +1782,7 @@
/***********************************************************************
* Get Search Lockout TGID
***********************************************************************/
-/* TODO - Check SLI info is downloading. It seems to work. */
+/* TODO: This needs to be tested. It seems to work. */
int get_search_lockout_tgid(int fd, int system_index)
{
char answer[100], command[100];
@@ -2004,7 +2004,6 @@
/***********************************************************************
* Get Location Alert System Index Head
***********************************************************************/
-/* TODO: This needs to be implemented & tested */
int loc_alert_system_index_head(int fd, char *loc_alert_system_type)
{
char answer[100], command[100];
@@ -2121,7 +2120,7 @@
snprintf(command, 100, "LIN,%i", loc_alert_system_index);
/*printf("Command == %s\n", command); */
do_command(fd, command, answer);
- /*printf ("\n%s\n(%i)\n", answer, strlen (answer)); */
+ printf ("\n%s\n(%i)\n", answer, strlen (answer));
parse_fields(answer, field);
/* We have 13 parsed fields to print for this command */
@@ -3438,12 +3437,6 @@
get_firmware_version(fd);
- get_opening_message(fd);
-
- get_remains_memory_block(fd);
-
- get_memory_used(fd);
-
/* Get System Settings */
get_backlight(fd);
@@ -3457,39 +3450,7 @@
get_system_count(fd);
- get_srch_cc_settings(fd);
-
- get_bcast_screen_band_settings(fd);
-
- get_search_key_settings(fd);
-
- get_global_lockout_freq(fd);
-
- get_close_call_settings(fd);
-
- get_service_search_settings(fd);
-
- get_custom_search_group(fd);
-
- get_custom_search_settings(fd);
-
- get_weather_settings(fd);
-
- get_same_group_settings(fd);
-
- get_tone_out_settings(fd);
-
- get_lcd_contrast_settings(fd);
-
- get_lcd_upside_down_settings(fd);
-
- get_scanner_option_settings(fd);
-
- get_apco_settings(fd);
-
- get_gps_display_option(fd);
-
- /* Get Scan Settings
+ /* Scan Settings
* The "scan data" is organized into two basic trees. One for
* conventional freqs and the other tree organized for trunked freqs.
* I ordered the function calls below into a very particular order
@@ -3497,24 +3458,26 @@
* gotten the data once. Why make a second call to the scanner when we
* already have the data?) */
- /* SIN
- * While we have System Indexes, then print them.
- * using the above System Head and System Tail
+ /* While we have System Indexes, then print them.
+ * (Using the System Head and System Tail.)
* And once we find the first system, find the next system using
* forward system index field.
- * TODO: When we get SIN, create a new out-file named for each SIN name */
+ * TODO: When we get SIN, create a new out-file named for each SIN name? */
sys_index = get_system_index_head(fd);
- /* Get System Quick Lockouts now */
+ /* QSL
+ * Get System Quick Lockouts now */
get_system_quick_lockout(fd);
while (sys_index != -1)
{
- /* Get Group Quick Lockouts now along with System Info */
+ /* QGL
+ * Get Group Quick Lockouts */
get_group_quick_lockout(fd, sys_index);
- /* Continue getting System Info */
+ /* SIN
+ * Continue getting System Info */
char channel_group_head[10];
int next_sys_index = 0;
@@ -3530,8 +3493,8 @@
/*printf("systype = %s\n", sys_type); */
/*printf("sys_index = %i\n", sys_index); */
- /* TRN */
- /* While System has Trunked Systems, then print them.
+ /* TRN
+ * While System has Trunked Systems, then print them.
*
* Set our grpinfo variable before getting site info because
* these are pointers and site info will overwrite it's
@@ -3546,8 +3509,8 @@
&& strncmp(sys_type, "LTR", 3) != 0)
grpinfo_index = get_trunk_info(fd, sys_index);
- /* GIN */
- /* While System has Groups, then print them.
+ /* GIN
+ * While System has Groups, then print them.
*
* grpinfo_index was set prior to getting Site Info because
* we're returning pointers from parse_fields */
@@ -3564,8 +3527,8 @@
chaninfo_index = atoi(channel_index);
tgidinfo_index = chaninfo_index;
- /* CIN */
- /* While Group has Channels, and System Type is Conventional, then print them.
+ /* CIN
+ * While Group has Channels, and System Type is Conventional, then print them.
* Else they're treated like Trunk Group ID's. */
/*printf(" (Channel Starting Location: %s Channel Ending Location: %s)\n", grp_field[8], grp_field[9]; */
int next_channel_index = 0;
@@ -3587,8 +3550,8 @@
chaninfo_index = next_channel_index;
}
- /* TIN */
- /* While system is not conventional, then get Trunk Group ID info. */
+ /* TIN
+ * While system is not conventional, then get Trunk Group ID info. */
/*printf(" (TGID Starting Location: %s TGID Ending Location: %s)\n", tgid_field[8], tgid_field[9]; */
/*printf("systype = %s\n", sys_type); */
int next_tgidinfo_index = 0;
@@ -3604,8 +3567,9 @@
tgidinfo_index = next_tgidinfo_index;
}
- /* GLI & SLI */
- /* If a system is not conventional, then get all L/O TGIDs and Search L/O TGIDs for the System */
+ /* GLI & SLI
+ * If a system is not conventional, then get all L/O
+ * TGIDs and Search L/O TGIDs for the System */
if (strncmp(sys_type, "CNV", 3) != 0 && strncmp(sys_type, "LTR", 3) != 0)
{
get_lockout_tgid(fd, sys_index);
@@ -3613,8 +3577,8 @@
}
}
- /* SIF */
- /* While System has Sites, print them.
+ /* SIF
+ * While System has Sites, print them.
* We only get Site Info (aka Site Settings), as well as TFQ,
* if the System is not Conv Type
*
@@ -3681,52 +3645,60 @@
}
}
- /* Exit from Programming Mode */
+ get_remains_memory_block(fd);
+ get_memory_used(fd);
+
+ /* Search/Close Call Settings */
+ get_srch_cc_settings(fd);
+
+ get_bcast_screen_band_settings(fd);
+
+ get_search_key_settings(fd);
+
+ get_global_lockout_freq(fd);
+
+ get_close_call_settings(fd);
+
+ /* Misc Settings */
+ get_service_search_settings(fd);
+
+ get_custom_search_group(fd);
+
+ get_custom_search_settings(fd);
+
+ get_weather_settings(fd);
+
+ get_same_group_settings(fd);
+
+ get_tone_out_settings(fd);
+
+ get_lcd_contrast_settings(fd);
+
+ get_lcd_upside_down_settings(fd);
+
+ get_scanner_option_settings(fd);
+
+ get_apco_settings(fd);
+
+ /* GPS Settings */
+ get_gps_display_option(fd);
+
+ /* Exit Programming Mode */
exit_prg_mode(fd);
return (0);
}
-/***********************************************************************
-* Load Firmware
-***********************************************************************/
-int load_firmware(int fd, FILE *infile)
-{
- char line[500];
-
- memset(line, 0, 500);
-
- printf("firmware_load: \n");
-
- setup_port(fd, 9600); /* Units use default baud rates in firmware mode! */
- //get_fmodel(fd, model); /* "*MDL" */
-
- //if (strcmp(model, "bcd996t") == 0)
- //{
- // set_speed(fd, 115200); /* "*SPD int" - Increase baud rate to value*/
- // setup_port(fd, 115200); /* Set our program to the increased baud rate */
- // set_pgl(fd, 1000000000000000000); /* "*PGL int" - Clear Memory ??? */
- // set_ule(fd); /* "*ULE" - Unlock EEPROM ??? */
- // set_scb(fd, 1); /* "*SCB int" - Set Checksum Byte to int ??? */
- // set_prg(fd); /* "*PRG" - Enter program mode - expect a lot of data */
-
- /* TODO: Put firmware names and checksums into DEFINES */
- while (fgets(line, MAXLINELEN, infile) != NULL)
- {
- // read in firmware
- // When NULL, scanner unit will return "PROGRAM END" and "CHECKSUM= EC8BH
- }
-
- return (0);
-}
/***********************************************************************
* Load BCD memory from file
***********************************************************************/
/* TODO: Break the following into sections for allowing upload of
- *only Configuration Settings, Systems Data only or Location Alert
- *Settings only.*/
+ * only Configuration Settings, Systems Data only or Location Alert
+ * Settings only?
+ * TODO: This only loads Scan Settings. Need to implement the remainder
+ * of the other commands. */
int load(int fd, FILE * infile)
{
char answer[500], command[500], line[500], *parsed_line[100],
@@ -3779,7 +3751,12 @@
/* TODO: Break the following into sections for allowing
upload of only Configuration Settings, Systems Data only or
- Location Alert Settings only. */
+ Location Alert Settings only? */
+
+ /* System Settings
+ * TODO: BKL, KBP, OMS, PRI, AGV */
+
+ /* Scan Settings */
if (strncmp(scanner_command, "SIN", 3) == 0)
{
/*printf("DEBUG %s\n", scanner_command); */
@@ -3861,6 +3838,18 @@
/* Set Trunk Frequency info. Send channel_index & string info; Returns OK. */
set_trunk_freq_info(fd, channel_index, parsed_line);
}
+
+ /* Location Settings
+ * TODO: CLA, LIN */
+
+ /* Search/Close Call Settings
+ * TODO: SCO, BBS, SHK, CLC -- and LOF too? */
+
+ /* Misc Settings
+ * TODO: SSP, CSG, CSP, WXS, SGP, TON, CNT, DUD, SCN -- and P25 too? */
+
+ /* GPS Settings
+ * TODO: GDO */
}
}
@@ -3873,6 +3862,42 @@
}
/***********************************************************************
+* Load Firmware
+***********************************************************************/
+/* TODO: This needs testing - I have a timeout in serial.c try to detect
+communication hangs - I might remove the detection if it's too trouble-
+some. Firmware load can take > 5 minutes and might be mistaken for hanging. */
+int load_firmware(int fd, FILE *infile)
+{
+ char line[500];
+
+ memset(line, 0, 500);
+
+ printf("firmware_load: \n");
+
+ setup_port(fd, 9600); /* Units use default baud rates in firmware mode! */
+ //get_fmodel(fd, model); /* "*MDL" */
+
+ //if (strcmp(model, "bcd996t") == 0)
+ //{
+ // set_speed(fd, 115200); /* "*SPD int" - Increase baud rate to value*/
+ // setup_port(fd, 115200); /* Set our program to the increased baud rate */
+ // set_pgl(fd, 1000000000000000000); /* "*PGL int" - Clear Memory ??? */
+ // set_ule(fd); /* "*ULE" - Unlock EEPROM ??? */
+ // set_scb(fd, 1); /* "*SCB int" - Set Checksum Byte to int ??? */
+ // set_prg(fd); /* "*PRG" - Enter program mode - expect a lot of data */
+
+ /* TODO: Put firmware names and checksums into DEFINES */
+ while (fgets(line, MAXLINELEN, infile) != NULL)
+ {
+ // read in firmware
+ // When NULL, scanner unit will return "PROGRAM END" and "CHECKSUM= EC8BH
+ }
+
+ return (0);
+}
+
+/***********************************************************************
* Get Scanner Model & Scanner Firmware Version
***********************************************************************/
int version(int fd)
Modified: src/commands.h
===================================================================
--- src/commands.h 2007-11-12 22:07:47 UTC (rev 142)
+++ src/commands.h 2007-11-14 03:59:32 UTC (rev 143)
@@ -171,12 +171,12 @@
int get_apco_settings(int fd);
int set_apco_settings(int fd, int threshold);
-/* GPS Related (Available in Program Mode Only) */
+/* GPS Settings (Available in Program Mode Only) */
/* (Not Tested. I don't have a GPS for this scanner) */
int get_gps_display_option(int fd);
int set_gps_display_option(int fd, char **parsed_line);
-/* GPS Related (Use not restricted to Program Mode) */
+/* GPS Settings (Use not restricted to Program Mode) */
int get_gps_gga_data(int fd);
int get_gps_rmc_data(int fd);
int get_window_voltage(int fd);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|