forked from xuos/xiuos
optimize I2C and SPI codes and add rtc module
This commit is contained in:
@@ -103,7 +103,7 @@ void UaBrowserObjectsTestTask(void* param)
|
||||
|
||||
UA_ClientConfig* config = UA_Client_getConfig(client);
|
||||
UA_ClientConfig_setDefault(config);
|
||||
UA_StatusCode retval = UA_Client_connect(client, OPC_SERVER);
|
||||
UA_StatusCode retval = UA_Client_connect(client, opc_server_url);
|
||||
|
||||
if(retval != UA_STATUSCODE_GOOD)
|
||||
{
|
||||
@@ -157,7 +157,7 @@ void UaGetInfoTestTask(void* param)
|
||||
|
||||
UA_ClientConfig* config = UA_Client_getConfig(client);
|
||||
UA_ClientConfig_setDefault(config);
|
||||
UA_StatusCode retval = UA_Client_connect(client, OPC_SERVER);
|
||||
UA_StatusCode retval = UA_Client_connect(client, opc_server_url);
|
||||
|
||||
if(retval != UA_STATUSCODE_GOOD)
|
||||
{
|
||||
@@ -209,7 +209,7 @@ void UaAddNodesTask(void* param)
|
||||
|
||||
UA_ClientConfig* config = UA_Client_getConfig(client);
|
||||
UA_ClientConfig_setDefault(config);
|
||||
UA_StatusCode retval = UA_Client_connect(client, OPC_SERVER);
|
||||
UA_StatusCode retval = UA_Client_connect(client, opc_server_url);
|
||||
|
||||
if(retval != UA_STATUSCODE_GOOD)
|
||||
{
|
||||
|
||||
@@ -26,24 +26,15 @@
|
||||
#include "plc_dev.h"
|
||||
#include "plc_demo.h"
|
||||
|
||||
#define PLC_NS_FORMAT "n%d,%s"
|
||||
|
||||
struct PlcChannel plc_demo_ch;
|
||||
struct PlcDriver plc_demo_drv;
|
||||
struct PlcDevice plc_demo_dev;
|
||||
|
||||
PlcCtrlParamType plc_ctrl_param;
|
||||
|
||||
char plc_demo_ip[] = {192, 168, 250, 2};
|
||||
|
||||
#define TEST_STR_NID "ServiceInterfaces"
|
||||
#define PLC_NS_FORMAT "n%d,%s"
|
||||
|
||||
UA_NodeId test_nodeid =
|
||||
{
|
||||
4,
|
||||
UA_NODEIDTYPE_NUMERIC,
|
||||
5
|
||||
};
|
||||
|
||||
UA_NodeId test_nodeid = {4, UA_NODEIDTYPE_NUMERIC, 5};
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
@@ -54,7 +45,7 @@ void PlcDemoChannelDrvInit(void)
|
||||
return;
|
||||
init_flag = 1;
|
||||
|
||||
lwip_config_tcp(lwip_ipaddr, lwip_netmask, plc_demo_ip);
|
||||
lwip_config_tcp(lwip_ipaddr, lwip_netmask, test_ua_ip);
|
||||
PlcChannelInit(&plc_demo_ch, PLC_CH_NAME);
|
||||
if(PlcDriverInit(&plc_demo_drv, PLC_DRV_NAME) == EOK)
|
||||
{
|
||||
@@ -84,7 +75,7 @@ static void PlcCtrlDemoInit(void)
|
||||
}
|
||||
UaParamType* ua_ptr = plc_demo_dev.priv_data;
|
||||
memset(ua_ptr, 0, sizeof(UaParamType));
|
||||
strcpy(ua_ptr->ua_remote_ip, OPC_SERVER);
|
||||
strcpy(ua_ptr->ua_remote_ip, opc_server_url);
|
||||
ua_ptr->act = UA_ACT_ATTR;
|
||||
memcpy(&ua_ptr->ua_id, &test_nodeid, sizeof(test_nodeid));
|
||||
|
||||
@@ -166,8 +157,8 @@ void PlcWriteUATask(void* arg)
|
||||
struct PlcOps* ops = NULL;
|
||||
char buf[PLC_BUF_SIZE];
|
||||
memset(buf, 0, sizeof(buf));
|
||||
PlcCtrlDemoInit();
|
||||
|
||||
PlcCtrlDemoInit();
|
||||
ops = plc_demo_dev.ops;
|
||||
ret = ops->open(&plc_demo_dev);
|
||||
|
||||
|
||||
@@ -41,13 +41,14 @@ typedef struct UaParam
|
||||
UA_Client *client;
|
||||
}UaParamType;
|
||||
|
||||
#define OPC_SERVER "opc.tcp://192.168.250.2:4840"
|
||||
|
||||
#define ua_print //KPrintf
|
||||
#define ua_trace() //KPrintf("ua: [%s] line %d checked!\n", __func__, __LINE__)
|
||||
#define ua_pr_info KPrintf
|
||||
#define ua_debug //KPrintf
|
||||
|
||||
extern const char *opc_server_url;
|
||||
extern char test_ua_ip[];
|
||||
|
||||
int ua_server_connect(void);
|
||||
void ua_browser_nodes(UA_Client *client);
|
||||
void ua_browser_id(UA_Client *client, UA_NodeId id);
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
|
||||
#define UA_RESPONSE_TIMEOUT 10000
|
||||
|
||||
const char *opc_server_url = {"opc.tcp://192.168.250.2:4840"};
|
||||
|
||||
#ifdef UA_ENABLE_SUBSCRIPTIONS
|
||||
static void handler_TheAnswerChanged(UA_Client* client, UA_UInt32 subId, void* subContext,
|
||||
UA_UInt32 monId, void* monContext, UA_DataValue* value)
|
||||
@@ -52,7 +54,7 @@ int ua_get_points(UA_Client* client)
|
||||
/* Listing endpoints */
|
||||
UA_EndpointDescription* endpointArray = NULL;
|
||||
size_t endpointArraySize = 0;
|
||||
UA_StatusCode ret = UA_Client_getEndpoints(client, OPC_SERVER,
|
||||
UA_StatusCode ret = UA_Client_getEndpoints(client, opc_server_url,
|
||||
&endpointArraySize, &endpointArray);
|
||||
|
||||
if(ret != UA_STATUSCODE_GOOD)
|
||||
|
||||
@@ -82,7 +82,7 @@ int ua_test_interact_server(UA_Client *client)
|
||||
int16 ua_test(void)
|
||||
{
|
||||
UA_Client *client = UA_Client_new();
|
||||
UA_StatusCode retval = UA_Client_connect(client, OPC_SERVER);
|
||||
UA_StatusCode retval = UA_Client_connect(client, opc_server_url);
|
||||
if(retval != UA_STATUSCODE_GOOD) {
|
||||
UA_Client_delete(client);
|
||||
return (int)retval;
|
||||
|
||||
Reference in New Issue
Block a user