Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ right commandline arguments, ie. as a minimum the right serial port:
-b, --baud
The baud rate of the serial port.
When omitted the baud rate is set to 4800.

-n, --name
The product name of the GPS device. Default is 'NMEA-0183 GPS'.

COMMON OPTIONS:

Expand Down
1 change: 1 addition & 0 deletions software/inc/dev_reg.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ typedef struct
{
un32 timeOut;
un32 baudRate;
VeStr name;
} DevReg;

extern DevReg devReg;
Expand Down
15 changes: 14 additions & 1 deletion software/src/platform/pc/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@
DevReg devReg =
{
0, // Timeout
4800 // Baudrate
4800, // Baudrate
"NMEA-0183 GPS" // Product name
};

struct option consoleOptions[] =
{
{"timeout", required_argument, 0, 't'},
{"baud", required_argument, 0, 'b'},
{"name", required_argument, 0, 'n'},
{0, 0, 0, 0}
};

Expand All @@ -37,6 +39,9 @@ void consoleUsage(char* program)
printf(" The baud rate of the serial port.\n");
printf(" When omitted the baud rate is set to 4800.\n");
printf("\n");
printf(" -n, --name\n");
printf(" The product name of the GPS device. Default is 'NMEA-0183 GPS'.\n");
printf("\n");
pltOptionsUsage();
printf("Victron Energy B.V.\n");
}
Expand All @@ -60,6 +65,14 @@ veBool consoleOption(int flag)
logE(MODULE, "wrong baud rate argument");
pltExit(128);
}
break;
case 'n':
errno = 0;
devReg.name = veArgStr(optarg);
if (errno == EINVAL) {
logE(MODULE, "wrong name argument");
pltExit(128);
}
}

return veTrue;
Expand Down
2 changes: 1 addition & 1 deletion software/src/values_dbus_service.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void valuesInit(void)
veItemCreateBasic(&root, "Mgmt/Connection", veVariantStr(&v, "USB"));
veItemCreateProductId(&root, VE_PROD_ID_NMEA_0183_GPS);

veStrNewFormat(&s, "NMEA-0183 GPS (%s)", serialPortShort());
veStrNewFormat(&s, "%s (%s)", devReg.name, serialPortShort());
veItemCreateBasic(&root, "ProductName", veVariantHeapStr(&v, veStrCStr(&s)));
}

Expand Down