5#ifndef _SERIALBURNERDATA_H_
6#define _SERIALBURNERDATA_H_
21#include "serialburnerdata.h"
31#define PROTOCOL_UDP_TO_SERIAL "UDP"
32#define PROTOCOL_TCP_SSL_TO_SERIAL "TCP/SSL"
33#define PROTOCOL_TCP_TO_SERIAL "TCP"
34#define PROTOCOL_SSH "SSH"
37#define SERIAL_MODE_RS232 "RS-232"
38#define SERIAL_MODE_DEBUG "DEBUG"
39#define SERIAL_MODE_485H "RS-485 Half Duplex"
40#define SERIAL_MODE_485F "RS-485 Full Duplex"
41#define SERIAL_MODE_422F "RS-422 Full Duplex"
42#define SERIAL_MODE_485H_ECHO "RS-485 Half Duplex with Echo"
43#define SERIAL_MODE_485H_NOECHO "RS-485 Half Duplex without Echo"
44#define SERIAL_MODE_DISABLED "Disabled"
46#define SERIAL_MODE_DISABLED_PINS_OUTPUT_HIGH "Output High"
47#define SERIAL_MODE_DISABLED_PINS_OUTPUT_LOW "Output Low"
48#define SERIAL_MODE_DISABLED_PINS_HIZ "High Impedance"
51#define SERIAL_FLOW_MODE_NONE "None"
52#define SERIAL_FLOW_MODE_XON_OFF "XON/XOFF"
53#define SERIAL_FLOW_MODE_RTS_CTS "RTS/CTS"
56#define SERIAL_CONNECT_CONNECT_NEVER "Never"
57#define SERIAL_CONNECT_CONNECT_AT_POWERUP "On power-up"
58#define SERIAL_CONNECT_CONNECT_WHEN_DATARX "If serial data received"
62#define IP_ADDR_MODE_DHCP "DHCP"
63#define IP_ADDR_MODE_DHCP_W_FALLBACK "DHCP w Fallback"
64#define IP_ADDR_MODE_STATIC "Static"
65#define IP_ADDR_MODE_DISABLED "Disabled"
68#define CONNECT_NAME_LENGTH (79)
69#define CONNECT_MESSAGE_LENGTH (79)
70#define CONNECT_LOSS_MESSAGE_LENGTH (79)
71#define DEVICE_NAME_LENGTH (15)
72#define NTP_NAME_LENGTH (35)
73#define USERNAME_LENGTH (39)
74#define PASSWORD_LENGTH (39)
75#define MAX_NUMERICAL_USER_INPUT_LENTH (32)
76#define MAX_STRING_USER_INPUT_LENTH (64)
79#define MAX_UDP_RX_BUFFER (1500)
80#define BUFFER_SIZE (20000)
83#define LED_TASK_PRIO (MAIN_PRIO - 1)
84#define SNMP_PRIO (MAIN_PRIO - 2)
85#define AT_COM_PRIO (MAIN_PRIO - 3)
86#define I2C_SERVER_TASK_PRIO (MAIN_PRIO + 1)
87#define GPIO_SERVER_TASK_PRIO (MAIN_PRIO + 2)
88#define START_WIFI_TASK_PRIO (OS_MAX_PRIOS - 2)
90#ifdef NB_FACTORY_INCLUDE_SSH
93#define SSH_USERNAME_LENGTH (39)
94#define SSH_PASSWORD_LENGTH (39)
98extern MonitorRecord monitor_config;
100#ifdef NB_FACTORY_INCLUDE_SSL
111#define SERIAL_BURNER_CERTIFICATE_SIZE_MAX ((2 * 1024) - 1)
112#define SERIAL_BURNER_CERTIFICATE_SIZE_MAX_PEM ((3 * 1024) - 1)
116#if defined(NB_FACTORY_INCLUDE_SSH) || defined(NB_FACTORY_INCLUDE_SSL)
119#define SERIAL_BURNER_LIBRARY_DEFAULT ((uint8_t)0x00)
120#define SERIAL_BURNER_DEFAULT ((uint8_t)0x01)
121#define SERIAL_BURNER_USER_INSTALLED ((uint8_t)0x02)
132#define SERIAL_BURNER_KEY_SIZE_MAX_PEM ((4 * 1024) - 1)
141#define SERIAL_BURNER_HTML_INPUT_NUMBER_SIZE (5)
144#define SERIAL_BURNER_HTML_HEX_NUMBER_LENGTH (2)
150#if ((NB_FACTORY_SERIAL_PORTS + NB_FACTORY_I2C_PORTS) <= 2)
151#define SERIAL_BURNER_DESCRIPTION_COLUMN_WIDTH_PERCENT (40)
153#define SERIAL_BURNER_DESCRIPTION_COLUMN_WIDTH_PERCENT (30)
156#define SERIAL_BURNER_PORT_COLUMN_WIDTH_PERCENT ((100 - SERIAL_BURNER_DESCRIPTION_COLUMN_WIDTH_PERCENT) / (NB_FACTORY_SERIAL_PORTS + NB_FACTORY_I2C_PORTS))
159#define SERIAL_BURNER_HTML_I2C_WIDTH (70)
162#define SERIAL_BURNER_HTML_INPUT_SIZE (39)
165#define SERIAL_BURNER_HTML_IP_STRING_SIZE (20)
168#define SERIAL_BURNER_PASSWORD_STRING "*******************"
175#define boot_iprintf(...) \
177 if (monitor_config.Quiet == 0) \
179 int ifNum = GetFirstInterface(); \
180 InterfaceBlock *pIfB = GetInterfaceBlock(ifNum); \
181 if (pIfB != nullptr) \
183 iprintf("%s : ", pIfB->device_name.c_str()); \
184 iprintf(__VA_ARGS__); \
195#define debug_iprintf(...) \
197 if (bShowDebug == true) \
199 int ifNum = GetFirstInterface(); \
200 InterfaceBlock *pIfB = GetInterfaceBlock(ifNum); \
201 if (pIfB != nullptr) \
203 iprintf("%s [debug] : ", pIfB->device_name.c_str()); \
204 iprintf(__VA_ARGS__); \
243 config_uint trap_enable_flags{0,
"Trap Enable Flags"};
247 SysInfo(
const char *name,
const char *desc =
nullptr) :
config_obj(name, desc){};
248 SysInfo(
config_obj &owner,
const char *name,
const char *desc =
nullptr) :
config_obj(owner, name, desc){};
249 SysInfo & operator=(
const SysInfo & si)
251 SysContact = si.SysContact;
252 SysName = si.SysName;
253 SysLocation = si.SysLocation;
254 ReadCommunity = si.ReadCommunity;
255 WriteCommunity = si.WriteCommunity;
256 trap_destination = si.trap_destination;
257 trap_enable_flags = si.trap_enable_flags;
318 config_uint ListenPort{NB_FACTORY_LISTEN_PORT_DEFAULT,
"Listen Port"};
319 config_uint InactivityTimeoutInSecs{NB_FACTORY_INACTIVITY_TIMEOUT_DEFAULT,
"Inactivity Timeout(seconds)"};
320 config_uint New_connection_timeout{NB_FACTORY_NEW_CONNECTION_TIMEOUT_DEFAULT,
"New Connection Timeout(seconds)"};
321 config_chooser ConnectMode{
"Connect Mode",
"Never",
"Never,On power-up,If serial data received"};
322 config_uint ConnectPort{NB_FACTORY_CONNECT_PORT_DEFAULT,
"Connect Port"};
327 config_uint ConnectIdleTimeout{NB_CONNECT_IDLE_TIMEOUT_DEFAULT,
"Connect Idle Timeout(seconds)"};
328 config_uint Connection_retry_timeout{NB_CONNECT_RETRY_TIMEOUT_DEFAULT,
"Connection Retry Timeout(seconds)"};
329 config_uint keepAliveInterval{NB_CONENCT_KEEP_ALIVE_INTERVAL_DEFAULT,
"Keep Alive Interval(seconds)"};
332 config_chooser SerialMode{
"Serial Mode", NB_FACTORY_DEFAULT_SERIAL_MODE, NB_FACTORY_SERIAL_CAPABILITY_RS232};
334 "Data Baud Rate", NB_FACTORY_SERIAL_DATA_RATE_DEFAULT,
335 "921600,500000,460800,345600,256000,230400,128000,115200,57600,38400,32000,19200,9600,4800,2400,1200,Custom"};
336 config_uint CustomBaudRate{NB_FACTORY_SERIAL_CUSTOM_DATA_RATE_DEFAULT,
"Custom Baudrate"};
337 config_chooser Output_Bits{
"Output Bits", NB_FACTORY_SERIAL_DATA_BITS_DEFAULT,
"8,7,6,5"};
338 config_chooser Output_Parity{
"Output Parity", NB_FACTORY_SERIAL_PARITY_DEFAULT,
"None,Odd,Even"};
339 config_chooser Output_Stop{
"Output Stop", NB_FACTORY_SERIAL_STOP_BITS_DEFAULT,
"1,2"};
340 config_chooser FlowMode{
"Flow Control Mode", NB_FACTORY_SERIAL_FLOW_CONTROL_DEFAULT,
"None,XON/XOFF,RTS/CTS"};
341 config_bool bDoAtCommand{NB_FACTORY_DO_AT_COMMANDS_DEFAULT,
"Do AT Commands"};
342 config_chooser DisabledPortPinFunction{
"Disabled Port Pin Function", NB_FACTORY_DISABLED_SER_PORT_PIN_FUNC_DEFAULT,
"Output High,Output Low,High Impedance"};
344 config_bool bUseConnectMessage{NB_FACTORY_USE_CONNECT_MSG_DEFAULT,
"Use the Configured Connect Message"};
345 config_string ConnectLossMessage{
"",
"Lost Connection Message"};
346 config_bool bUseConnectLossMessage{NB_FACTORY_USE_CONNECTION_LOST_MSG_DEFAULT,
"Use the Configured Lost Connection Message"};
347 config_bool BreakOnConnect{NB_FACTORY_BREAK_ON_CONNECT_DEFAULT,
"Break On Connect"};
348 config_uint BreakInterval{NB_FACTORY_BREAK_INTERVAL_DEFAULT,
"Break Interval"};
349 config_bool BreakKeyFlag{NB_FACTORY_BREAK_KEY_FLAG_DEFAULT,
"Break Key Flag"};
350 config_string BreakKeyValue{NB_FACTORY_BREAK_KEY_VALUE_DEFAULT,
"Break Key Value"};
351 config_uint UdpAccumulatedChars{NB_FACTORY_ACCUMULATED_CHARS_UDP_DEFAULT,
"UDP Accumulated Chars"};
352 config_uint UdpWait{NB_FACTORY_WAIT_UDP_IN_TICKS_DEFAULT,
"UDP Wait(ticks)"};
353 config_uint TcpAccumulatedChars{NB_FACTORY_ACCUMULATED_CHARS_TCP_DEFAULT,
"TCP Accumulated Chars"};
354 config_uint TcpWait{NB_FACTORY_WAIT_TCP_IN_TICKS_DEFAULT,
"TCP Wait(ticks)"};
355 config_string UdpTriggerChar{NB_FACTORY_TRIGGER_CHAR_UDP_DEFAULT,
356 "UDP Trigger Character"};
357 config_string TcpTriggerChar{NB_FACTORY_TRIGGER_CHAR_TCP_DEFAULT,
358 "TCP Trigger Character"};
359 config_bool bListenForTCPConnections{NB_FACTORY_LISTEN_FOR_TCP_CONNECT_DEFAULT,
"Listen for incoming network connections"};
360 config_bool bTcpCustomFrame{NB_FACTORY_CUSTOM_FRAME_TCP_DEFAULT,
"TCP Custom Frame"};
361 config_bool bLearnUdp{NB_FACTORY_LEARN_UDP_DEFAULT,
"Learn UDP"};
362 config_bool bUdpCheckFramingChar{NB_FACTORY_CHECK_FRAMING_CHAR_UDP_DEFAULT,
"Check UDP Framing Character"};
363 config_bool bTcpCheckFramingChar{NB_FACTORY_CHECK_FRAMING_CHAR_TCP_DEFAULT,
"Check TCP Framing Character"};
364 config_bool bAlwaysStoreSerialChars{
false,
"Always Store Serial Characters"};
366 config_bool bDTRReflectsConnection{
false,
"DTR Reflects Connection"};
368 config_bool bTCPasSSL{
false,
"Allow SSL on TCP Socket"};
371 NV_OnePortSetting(
const char *name,
372 const char *desc =
nullptr,
373 const char *serialMode =
nullptr,
374 const char *serialModeChoices =
nullptr)
377 if (serialModeChoices !=
nullptr) { SerialMode.
SetChoices(serialModeChoices); }
378 if (serialMode !=
nullptr)
380 SerialMode = serialMode;
382 if (strncmp(serialMode, SERIAL_MODE_DEBUG,
sizeof(SERIAL_MODE_DEBUG)) == 0)
385 bDoAtCommand =
false;
392 const char *desc =
nullptr,
393 const char *serialMode =
nullptr,
394 const char *serialModeChoices =
nullptr)
397 if (serialModeChoices !=
nullptr) { SerialMode.
SetChoices(serialModeChoices); }
398 if (serialMode !=
nullptr)
400 SerialMode = serialMode;
402 if (strncmp(serialMode, SERIAL_MODE_DEBUG,
sizeof(SERIAL_MODE_DEBUG)) == 0)
405 bDoAtCommand =
false;
424 config_uint FreqDivider{NB_FACTORY_I2C_FREQ_DIVIDER_DEFAULT,
"Frequency Divider"};
427 config_uint SetMasterAddress{NB_FACTORY_I2C_ADDRESS_DEFAULT,
"Set Master Address"};
428 config_uint SaveMasterAddress{NB_FACTORY_I2C_ADDRESS_DEFAULT,
"Save Master Address"};
431 config_uint ListenPort{NB_FACTORY_I2C_LISTEN_PORT_DEFAULT,
"Listen Port"};
432 config_bool bListenCheck{NB_FACTORY_LISTEN_FOR_TCP_CONNECT_DEFAULT,
"Listen for incoming network connections"};
433 config_uint InactivityTimeoutInSecs{NB_FACTORY_INACTIVITY_TIMEOUT_DEFAULT,
"Inactivity Timeout(seconds)"};
434 config_uint New_connection_timeout{NB_FACTORY_NEW_CONNECTION_TIMEOUT_DEFAULT,
"New Connection Timeout(seconds)"};
435 config_uint ConnectIdleTimeout{NB_CONNECT_IDLE_TIMEOUT_DEFAULT,
"Connect Idle Timeout(seconds)"};
439 NV_OneI2CPortSetting(
const char *name,
const char *desc =
nullptr) :
config_obj(name, desc){};
440 NV_OneI2CPortSetting(
config_obj &owner,
const char *name,
const char *desc =
nullptr) :
config_obj(owner, name, desc){};
452extern const char* defaultSerialPortModes[];
458 config_chooser Protocol{
"Protocol",
"TCP/SSL",
"UDP,TCP/SSL,SSH,TCP"};
459 config_chooser ConnectMode{
"Connect Mode",
"Never",
"Never,On power-up,If serial data received"};
462 config_string NTPName{NB_FACTORY_NTPSERVERNAME_DEFAULT,
"NTP Name"};
465 NV_OnePortSetting port0{
"Serial Port 0",
nullptr, defaultSerialPortModes[0], NB_FACTORY_SERIAL_PORT_0_MODE_CAPABILITY};
466#if !(defined SOMRT1061)
467 NV_OnePortSetting port1{
"Serial Port 1",
nullptr, defaultSerialPortModes[1], NB_FACTORY_SERIAL_PORT_1_MODE_CAPABILITY};
470#if (defined NANO54415)
471 NV_OnePortSetting port2{
"Serial Port 2",
nullptr, defaultSerialPortModes[2], NB_FACTORY_SERIAL_PORT_2_MODE_CAPABILITY};
472 NV_OnePortSetting port3{
"Serial Port 3",
nullptr, defaultSerialPortModes[3], NB_FACTORY_SERIAL_PORT_3_MODE_CAPABILITY};
473 NV_OnePortSetting port4{
"Serial Port 4",
nullptr, defaultSerialPortModes[4], NB_FACTORY_SERIAL_PORT_4_MODE_CAPABILITY};
474#elif ((defined MODM7AE70 && defined USE_E70_UART_SERIAL_PORTS))
475 NV_OnePortSetting port2{
"Serial Port 2",
nullptr, defaultSerialPortModes[2], NB_FACTORY_SERIAL_PORT_2_MODE_CAPABILITY};
476 NV_OnePortSetting port3{
"Serial Port 3",
nullptr, defaultSerialPortModes[3], NB_FACTORY_SERIAL_PORT_3_MODE_CAPABILITY};
477 NV_OnePortSetting port4{
"Serial Port 4",
nullptr, defaultSerialPortModes[4], NB_FACTORY_SERIAL_PORT_4_MODE_CAPABILITY};
478 NV_OnePortSetting port5{
"Serial Port 5",
nullptr, defaultSerialPortModes[5], NB_FACTORY_SERIAL_PORT_5_MODE_CAPABILITY};
479 NV_OnePortSetting port6{
"Serial Port 6",
nullptr, defaultSerialPortModes[6], NB_FACTORY_SERIAL_PORT_6_MODE_CAPABILITY};
480#elif ( defined SOMRT1061 )
481 NV_OnePortSetting port1{
"Serial Port 1",
nullptr, defaultSerialPortModes[1], NB_FACTORY_SERIAL_PORT_1_MODE_CAPABILITY};
482 NV_OnePortSetting port2{
"Serial Port 2",
nullptr, defaultSerialPortModes[2], NB_FACTORY_SERIAL_PORT_2_MODE_CAPABILITY};
483 NV_OnePortSetting port3{
"Serial Port 3",
nullptr, defaultSerialPortModes[3], NB_FACTORY_SERIAL_PORT_3_MODE_CAPABILITY};
484 NV_OnePortSetting port4{
"Serial Port 4",
nullptr, defaultSerialPortModes[4], NB_FACTORY_SERIAL_PORT_4_MODE_CAPABILITY};
485 NV_OnePortSetting port5{
"Serial Port 5",
nullptr, defaultSerialPortModes[5], NB_FACTORY_SERIAL_PORT_5_MODE_CAPABILITY};
486 NV_OnePortSetting port6{
"Serial Port 6",
nullptr, defaultSerialPortModes[6], NB_FACTORY_SERIAL_PORT_6_MODE_CAPABILITY};
489#ifdef SUPPORTED_GPIO_SERVER_PLATFORM
490 config_bool bEnableGpioProcess{NB_FACTORY_DO_GPIO_COMMANDS_DEFAULT,
"bEnableGpioProcess"};
491 config_bool bEnableHighDrive{NB_FACTORY_ENABLE_GPIO_HI_DRIVE_DEFAULT,
"bEnableHighDrive"};
492 config_uint GpioProcessPort{NB_FACTORY_GPIO_PORT_DEFAULT,
"GpioProcessPort"};
493 config_uint GpioInactivityTimeoutInSecs{NB_CONNECT_IDLE_TIMEOUT_DEFAULT,
"Inactivity timeout in seconds"};
494 config_uint GpioMaxConnections{NB_MAX_TCP_CONNECTIONS,
"Max simultaneous connections"};
496 NB_FACTORY_GPIO_SAVE_TO_FLASH_DEFAULT,
497 "Save every change to a pin's setting/state to flash. This will use more flash write cycles if a pin is modified often."};
500 SysInfo SysInfoData{
"SNMP_SysInfo"};
505#if (defined SUPPORTED_I2C_PLATFORM)
506 NV_OneI2CPortSetting i2c_port{
"I2C Configuration"};
509#ifdef NB_FACTORY_INCLUDE_SSL
512 config_uint SslCertificateSource{SERIAL_BURNER_LIBRARY_DEFAULT,
"SSL Certificate Source"};
513 config_uint SslCertificateLength{0,
"SSL Certificate Length"};
518#ifdef NB_FACTORY_INCLUDE_SSH
525 config_uint SshKeyRsaSource{SERIAL_BURNER_LIBRARY_DEFAULT,
"SSH Key RSA Source"};
526 config_uint SshKeyRsaLength{0,
"SSH Key RSA Length"};
527 config_uint SshKeyEcdsaSource{SERIAL_BURNER_LIBRARY_DEFAULT,
"SSH Key ECDSA Source"};
528 config_uint SshKeyEcdsaLength{0,
"SSH Key ECDSA Length"};
532 config_bool bAllowAtToAccessAPassword{
true,
"Allow AT to Access A Password"};
533 config_bool bAllowAtToAccessSPassword{
true,
"Allow AT to Access S Password"};
536 config_uint VerifyKey{NB_FACTORY_VERIFY_KEY,
"App Version Verification Key"};
539 config_uint STDEFFSVerifyKey{STD_EFFS_VERIFY_KEY,
"File System Version Verification Key"};
541 config_bool bFirstRun{
true,
"First time loading the SS2E Factory app on this device"};
544 NV_OnePortSetting *ports[NB_FACTORY_SERIAL_PORTS];
548 if (configFlag > 0) { SetFlag(configFlag); }
554#if (defined NANO54415)
558#elif ((defined MODM7AE70 && defined USE_E70_UART_SERIAL_PORTS) || (defined SOMRT1061) )
568 ports[(int)(monitor_config.Uart) - 1]->SerialMode = SERIAL_MODE_DEBUG;
570 ports[(int)(monitor_config.Uart)]->SerialMode = SERIAL_MODE_DEBUG;
573 for (uint8_t i = 1; i < NB_FACTORY_SERIAL_PORTS; i++)
576 ports[i]->ListenPort = ports[i]->ListenPort + i;
577 ports[i]->ConnectPort = ports[i]->ConnectPort + i;
584 if (configFlag > 0) { SetFlag(configFlag); }
590#if (defined NANO54415)
594#elif ((defined MODM7AE70 && defined USE_E70_UART_SERIAL_PORTS) || (defined SOMRT1061) )
604 ports[(int)(monitor_config.Uart) - 1]->SerialMode = SERIAL_MODE_DEBUG;
606 ports[(int)(monitor_config.Uart)]->SerialMode = SERIAL_MODE_DEBUG;
609 for (uint8_t i = 1; i < NB_FACTORY_SERIAL_PORTS; i++)
612 ports[i]->ListenPort = ports[i]->ListenPort + i;
613 ports[i]->ConnectPort = ports[i]->ConnectPort + i;
618#ifdef SUPPORTED_GPIO_SERVER_PLATFORM
625 config_chooser cc_pinFunction{
"Function",
"Not Configured",
"Not Configured,GPIO Input,GPIO Output 0,GPIO Output 1"};
626 config_string cs_currentState{
"Not Configured",
"Current State"};
632 PIN_FN_NO_CONFIG = 0,
644 uint32_t m_configFlags;
647 NV_PinIOConfig(
const char *name,
649 const char *desc =
nullptr,
650 uint8_t headerNumber = 0,
651 uint8_t pinNumber = 0,
652 const char *pinFuncSelection =
nullptr,
653 const char *pinFunctionChoices =
nullptr,
654 uint32_t configFlag = 0)
657 if (configFlag) { SetFlag(configFlag); }
658 if (pinFunctionChoices !=
nullptr) { cc_pinFunction.SetChoices(pinFunctionChoices); }
659 if (pinFuncSelection !=
nullptr) { cc_pinFunction = pinFuncSelection; }
661 m_headerNum = headerNumber;
662 m_pinNum = pinNumber;
663 m_configFlags = configFlag;
665 if (m_pinIO.
mask == 0)
668 cc_pinFunction.SetChoices(
"Fixed");
669 cc_pinFunction =
"Fixed";
676 const char *desc =
nullptr,
677 uint8_t headerNumber = 0,
678 uint8_t pinNumber = 0,
679 const char *pinFuncSelection =
nullptr,
680 const char *pinFunctionChoices =
nullptr,
681 uint32_t configFlag = 0)
684 if (configFlag > 0) { SetFlag(configFlag); }
685 if (pinFunctionChoices !=
nullptr) { cc_pinFunction.SetChoices(pinFunctionChoices); }
686 if (pinFuncSelection !=
nullptr) { cc_pinFunction = pinFuncSelection; }
688 m_headerNum = headerNumber;
689 m_pinNum = pinNumber;
690 m_configFlags = configFlag;
692 if (m_pinIO.
mask == 0)
695 cc_pinFunction.SetChoices(
"Fixed");
696 cc_pinFunction =
"Fixed";
702 inline bool valid() {
return pName !=
nullptr; }
704 bool ConfigureFromPinIOFunction()
706 int8_t pin_fn = m_pinIO.
getFn();
707 if (pin_fn < 0) {
return false; }
717 void DisplayPinFunctionToWeb(
int sock)
719 fdprintf(sock,
"\r\n\t\t<td><font size=\"2\">");
721 fdprintf(sock,
"\r\n\t\t</font></td>\r\n");
724 void DisplayPinDriveToWeb(
int sock)
726 if (!valid() || m_pinIO.
mask == 0)
729 cs_currentState =
"N/A";
733 if (cc_pinFunction.IsSelected(
"GPIO Input"))
735 if (m_pinIO.
readBack()) { cs_currentState =
"GPIO Input = 1"; }
738 cs_currentState =
"GPIO Input = 0";
741 else if (cc_pinFunction.IsSelected(
"GPIO Output 0"))
743 cs_currentState =
"GPIO Output = 0";
745 else if (cc_pinFunction.IsSelected(
"GPIO Output 1"))
747 cs_currentState =
"GPIO Output = 1";
749 else if (cc_pinFunction.IsSelected(
"Pin State"))
751 cs_currentState =
"Not Configured";
755 cs_currentState =
"Not Configured";
759 fdprintf(sock,
"\r\n\t\t<td><font size=\"2\">");
761 fdprintf(sock,
"\r\n\t\t</font></td>\r\n");
764 void DisplayFunction(
int sock)
766 static char rowLine[
sizeof(
"\r\n\t\t<td><font size=\"2\">")];
791 uint8_t GetPinFunctionIndex()
793 NBString pinFuncs(cc_pinFunction.GetChoices());
796 size_t position = pinFuncs.find(((
NBString)cc_pinFunction).c_str());
798 uint8_t commaCount = 0;
799 for (
size_t start = position; start > 0; start--)
801 if (pinFuncs[start] ==
',') { commaCount++; }
808 uint8_t InitPinFunction()
810 if (!valid() || m_pinIO.
mask == 0) {
return -1; }
814 uint8_t cc_pinFunctionVal = GetPinFunctionIndex();
816 switch (cc_pinFunctionVal)
818 case NV_PinIOConfig::PIN_FN_NO_CONFIG: m_pinIO.function(
PinIO::PIN_FN_IN);
return NV_PinIOConfig::PIN_FN_IN;
820 case NV_PinIOConfig::PIN_FN_IN: m_pinIO.function(
PinIO::PIN_FN_IN);
return NV_PinIOConfig::PIN_FN_IN;
822 case NV_PinIOConfig::NV_PinIOConfig::PIN_FN_OUT_0:
825 return NV_PinIOConfig::NV_PinIOConfig::PIN_FN_OUT_0;
827 case NV_PinIOConfig::PIN_FN_OUT_1:
830 return NV_PinIOConfig::PIN_FN_OUT_1;
832 case NV_PinIOConfig::PIN_FN_A: m_pinIO.function(
PinIO::PIN_FN_A);
return NV_PinIOConfig::PIN_FN_A;
834 case NV_PinIOConfig::PIN_FN_B: m_pinIO.function(
PinIO::PIN_FN_B);
return NV_PinIOConfig::PIN_FN_B;
836 case NV_PinIOConfig::PIN_FN_C: m_pinIO.function(
PinIO::PIN_FN_C);
return NV_PinIOConfig::PIN_FN_C;
838 case NV_PinIOConfig::PIN_FN_D: m_pinIO.function(
PinIO::PIN_FN_D);
return NV_PinIOConfig::PIN_FN_D;
846#define PIN_HEADER_SIZE 20
848#define PIN_HEADER_SIZE 50
851extern NV_PinIOConfig pinHeaderArray[];
852bool InitPinArrayFunctions();
853bool SetGpioConfigToReadOnly(
bool bSetToReadOnly);
854bool SetGpioHighCurrentDrive(
bool bEnableHighDrive);
868extern volatile bool Settings_Changed;
869extern volatile int old_config_ver;
875extern volatile bool gChangedUserParameters;
878extern bool bShowDebug;
883extern const char *IPModeList[];
884extern const char *IPValueList[];
885extern const char *IPOnClickList[];
886extern const char *BaudList[];
887extern const char *BitList[];
888extern const char *ParityList[];
889extern const char *StopList[];
890extern const char *FlowModeList[];
891extern const char *SerialModeListFull[];
892extern const char *SerialModeListRS232[];
893extern const char *SerialModeListRS485[];
894extern const char *SerialModeListHybrid[];
895extern const char *SerialModeListQuad485[];
896extern const char *SerialModeListQuadMMS[];
897extern const char *ConnectMode[];
898extern const char *ProtocolList[];
907extern bool UserSaveData(
char *dataPtr,
int dataSize,
const char *fileName);
910extern bool UserGetData(
char *dataPtr,
char *fileName,
int dataSize);
912extern void RegisterPost(
void);
914extern void CheckNVSettings(
bool returnToFactory = FALSE);
916extern void SetAndSaveDefaults(
void);
919extern uint8_t GetHexByte(
const char *cp);
Lightweight alternative to C++ CString class.
Definition nbstring.h:118
GPIO Pin Class.
Definition coldfire/cpu/MCF5441X/include/cpu_pins.h:14
int8_t getFn()
Get the pin function for the managed pin(s).
Definition cortex-m7/cpu/SAME70/include/cpu_pins.h:97
bool readBack() const
Read the state of the pin(s) line state without changing the pin function or direction.
Definition cortex-m7/cpu/SAME70/include/cpu_pins.h:164
@ PIN_FN_D
Peripheral D.
Definition cortex-m7/cpu/SAME70/include/cpu_pins.h:46
@ PIN_FN_A
Peripheral A.
Definition cortex-m7/cpu/SAME70/include/cpu_pins.h:43
@ PIN_FN_OUT
Output.
Definition coldfire/cpu/MCF5441X/include/cpu_pins.h:51
@ PIN_FN_C
Peripheral C.
Definition cortex-m7/cpu/SAME70/include/cpu_pins.h:45
@ PIN_FN_IN
Input.
Definition coldfire/cpu/MCF5441X/include/cpu_pins.h:50
@ PIN_FN_B
Peripheral B.
Definition cortex-m7/cpu/SAME70/include/cpu_pins.h:44
Configuration Variable for IPADDR4 (IPv4) object types.
Definition config_obj.h:1404
Boolean Configuration Variable.
Definition config_obj.h:932
Chooser Configuration Variable - Select From a List of Items.
Definition config_obj.h:1915
const config_string & SetChoices(const char *in_choices)
Set the list of choices.
Definition config_obj.h:2084
Base class used to create configuration objects.
Definition config_obj.h:277
Password string Configuration Variable.
Definition config_obj.h:1264
String Configuration Variable.
Definition config_obj.h:1055
Unsigned 32-bit Integer Configuration Variable.
Definition config_obj.h:504
Configuration object header file.
NetBurner functions to printf to a file descriptor.
const uint32_t fConfigReadOnly
Variable is read-only.
Definition config_obj.h:72
int fdprintf(int fc, const char *format,...)
printf to a file descriptor
uint32_t mask
Definition cortex-m7/cpu/SAME70/include/cpu_pins.h:35
int writestring(int fd, const char *str)
Write a null terminated ascii string to the stream associated with a file descriptor (fd)....
CONFIG_RENDER_OBJ ConfigRenderFunc(int mode, const char *pobj, int len=20, const char *extra=0)
Render a configuration object as HTML for the specified configuration object.
NetBurner HTTP Web Server File Handling.
NetBurner Network Interface Header File.
Configuration Settings.
Definition Parallax/src/nvsettings.h:13