forked from xuos/xiuos
fixed opcua demo exception and added mac address with showip command
This commit is contained in:
parent
b6bec0c2b6
commit
6972a14f6d
|
@ -68096,6 +68096,9 @@ void
|
|||
UA_Log_Stdout_log(void *context, UA_LogLevel level, UA_LogCategory category,
|
||||
const char *msg, va_list args) {
|
||||
|
||||
char str[120];
|
||||
memset(str, 0, sizeof(str));
|
||||
|
||||
/* Assume that context is casted to UA_LogLevel */
|
||||
/* TODO we may later change this to a struct with bitfields to filter on category */
|
||||
if ( context != NULL && (UA_LogLevel)(uintptr_t)context > level )
|
||||
|
@ -68115,8 +68118,8 @@ UA_Log_Stdout_log(void *context, UA_LogLevel level, UA_LogCategory category,
|
|||
|
||||
KPrintf("%s/%s" ANSI_COLOR_RESET "\t",
|
||||
logLevelNames[level], logCategoryNames[category]);
|
||||
|
||||
KPrintf(msg, args);
|
||||
vsnprintf(str, sizeof(str) - 1, msg, args);
|
||||
KPrintf(msg, str);
|
||||
KPrintf("\n");
|
||||
|
||||
// printf("\n");
|
||||
|
@ -70191,7 +70194,7 @@ UA_Client * UA_Client_new() {
|
|||
|
||||
UA_StatusCode
|
||||
UA_ClientConfig_setDefault(UA_ClientConfig *config) {
|
||||
config->timeout = 5000;
|
||||
config->timeout = 20000;
|
||||
config->secureChannelLifeTime = 10 * 60 * 1000; /* 10 minutes */
|
||||
|
||||
if(!config->logger.log) {
|
||||
|
@ -70656,13 +70659,15 @@ UA_Log_Syslog_withLevel(UA_LogLevel minlevel) {
|
|||
#define configTICK_RATE_HZ TICK_PER_SECOND
|
||||
#define xTaskGetTickCount CurrentTicksGain
|
||||
|
||||
#define EHOSTUNREACH 113 /* No route to host */
|
||||
#define EINPROGRESS 115 /* Operation now in progress */
|
||||
#define EADDRINUSE 98 /* Address already in use */
|
||||
#define EALREADY 114 /* Operation already in progress */
|
||||
#define ECONNABORTED 103 /* Software caused connection abort */
|
||||
|
||||
#define EISCONN 106 /* Transport endpoint is already connected */
|
||||
#define ENOTCONN 107 /* Transport endpoint is not connected */
|
||||
#define ECONNABORTED 103 /* Software caused connection abort */
|
||||
|
||||
#define EHOSTUNREACH 113 /* No route to host */
|
||||
#define EALREADY 114 /* Operation already in progress */
|
||||
#define EINPROGRESS 115 /* Operation now in progress */
|
||||
|
||||
#ifdef UA_ARCHITECTURE_FREERTOSLWIP_POSIX_CLOCK
|
||||
|
||||
|
|
|
@ -81,9 +81,6 @@
|
|||
#include "enet_ethernetif.h"
|
||||
#include <transform.h>
|
||||
|
||||
/* MAC address configuration. */
|
||||
#define configMAC_ADDR { 0x02, 0x12, 0x13, 0x10, 0x15, 0x11}
|
||||
|
||||
char lwip_ipaddr[] = {192, 168, 250, 253};
|
||||
char lwip_netmask[] = {255, 255, 255, 0};
|
||||
char lwip_gwaddr[] = {192, 168, 250, 252};
|
||||
|
|
|
@ -90,6 +90,10 @@
|
|||
#define GW_ADDR1 168
|
||||
#define GW_ADDR2 250
|
||||
#define GW_ADDR3 5
|
||||
|
||||
/* MAC address configuration. */
|
||||
#define configMAC_ADDR { 0x02, 0x12, 0x13, 0x10, 0x15, 0x11}
|
||||
|
||||
/* USER CODE END 0 */
|
||||
|
||||
#define SYS_MBOX_NULL -1
|
||||
|
|
|
@ -107,8 +107,10 @@ SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0) | SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN) |
|
|||
setip, lwip_setip_thread, SetIp [IP] [Netmask] [Gateway]);
|
||||
|
||||
|
||||
void lwip_getip_thread(int argc, char *argv[])
|
||||
void lwip_showip_thread(int argc, char *argv[])
|
||||
{
|
||||
char mac_addr[] = configMAC_ADDR;
|
||||
|
||||
lw_pr_info("\r\n************************************************\r\n");
|
||||
lw_pr_info(" Network Configuration\r\n");
|
||||
lw_pr_info("************************************************\r\n");
|
||||
|
@ -118,10 +120,12 @@ void lwip_getip_thread(int argc, char *argv[])
|
|||
((u8_t *)&lwip_netmask)[2], ((u8_t *)&lwip_netmask)[3]);
|
||||
lw_pr_info(" IPv4 Gateway : %u.%u.%u.%u\r\n", ((u8_t *)&lwip_gwaddr)[0], ((u8_t *)&lwip_gwaddr)[1],
|
||||
((u8_t *)&lwip_gwaddr)[2], ((u8_t *)&lwip_gwaddr)[3]);
|
||||
lw_pr_info(" MAC Address : %x:%x:%x:%x:%x:%x\r\n", mac_addr[0], mac_addr[1], mac_addr[2],
|
||||
mac_addr[3], mac_addr[4], mac_addr[5]);
|
||||
lw_pr_info("************************************************\r\n");
|
||||
}
|
||||
|
||||
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0) | SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN) | SHELL_CMD_PARAM_NUM(0),
|
||||
showip, lwip_getip_thread, GetIp [IP] [Netmask] [Gateway]);
|
||||
showip, lwip_showip_thread, GetIp [IP] [Netmask] [Gateway]);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue