30 const char cmd_srp_help[] =
"Show SRP status";
32 bool cmd_srp_exec(
int argc,
const char *args[])
38 const char cmd_net_help[] =
"Show Network information, set IP address";
41 static uint8_t hexByte(
const char * input)
49 if (
cnvParseU(input, &out, params) != 2) {
56 bool cmd_net_exec(
int argc,
const char *args[])
63 }
else if (argc == 1 && strcmp(args[0],
"help") == 0) {
64 puts(
"net [help|<ip>]");
65 puts(
" without arguments - print network configuration");
66 puts(
" help - show this help");
67 puts(
" modip <ip> - set the module ip in the form of # # # # (spaces, no dots)");
69 puts(
" svrip <ip> - set the server ip in the form of # # # # (spaces, no dots)");
70 puts(
" svrmac <mac> - sets the server MAC in the form aa:bb:cc:dd:ee:ff");
76 for (i = 0; i < 4; ++i) ip[i] = atoi(args[i + 1]);
77 if (strcmp(args[0],
"modip") == 0)
80 printf(
"Set module IP to: %u.%u.%u.%u\n", ip[0], ip[1], ip[2], ip[3]);
82 }
else if (strcmp(args[0],
"svrip") == 0)
84 uint32_t wIp = ( ip[0] << 24 ) | ( ip[1] << 16 ) | ( ip[2] << 8 ) | ( ip[3] << 0 );
85 net.ipmux_srv_ip = wIp;
86 printf(
"Set server IP to: %u.%u.%u.%u\n", ip[0], ip[1], ip[2], ip[3]);
92 }
else if (argc == 2 && strcmp(args[0],
"svrmac") == 0)
94 if (strlen(args[1]) != 17)
return false;
95 net.ipmux_srv_mac[0] = hexByte(args[1] + 0) << 8 | hexByte(args[1] + 3);
96 net.ipmux_srv_mac[1] = hexByte(args[1] + 6) << 8 | hexByte(args[1] + 9);
97 net.ipmux_srv_mac[2] = hexByte(args[1] + 12) << 8 | hexByte(args[1] + 15);
98 printf(
"Set MAC to: %04x %04x %04x\n",
99 net.ipmux_srv_mac[0], net.ipmux_srv_mac[1], net.ipmux_srv_mac[2]);
int cnvParseU(const char *input, uint32_t *output, CnvParams params)
Parse an unsigned integer.
Low level routines for LM32, including interrupt handling.
SRP or Simple Retransmission Protocol is a protocol which retransmits packets if they have not been c...
#define CNV_BASE_HEX
Base of hex numbers.
void srpDumpStatus()
Outputs SRP status information.
Manages the global system error.
This structure provides information about formatting and parsing.
uint8_t base
Base of the number to format or parse.
void netSetIp(uint8_t *ip)
Sets the Ip address to the network.
void netShowInfo(bool extended)
Shows network configuration information.
This module implements parsing and formating of strings and integers.