Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Q
qjs-wrapper
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
qjs-wrapper
Commits
fcc254d1
Commit
fcc254d1
authored
Jun 03, 2023
by
Léo-Paul Géneau
👾
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Redirect pubsub logs for subscriber
parent
bf812553
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
119 additions
and
35 deletions
+119
-35
include/dronedge.h
include/dronedge.h
+3
-0
include/pubsub.h
include/pubsub.h
+1
-1
pubsub.c
pubsub.c
+8
-5
qjs_wrapper.c
qjs_wrapper.c
+107
-29
No files found.
include/dronedge.h
View file @
fcc254d1
...
@@ -89,4 +89,7 @@ VariableStruct subscriberVariables = {
...
@@ -89,4 +89,7 @@ VariableStruct subscriberVariables = {
.
variableArray
=
subscriberVariableArray
,
.
variableArray
=
subscriberVariableArray
,
};
};
void
Subscriber_log
(
void
*
context
,
UA_LogLevel
level
,
UA_LogCategory
category
,
const
char
*
msg
,
va_list
args
);
#endif
/* __DRONEDGE_H__ */
#endif
/* __DRONEDGE_H__ */
include/pubsub.h
View file @
fcc254d1
...
@@ -59,7 +59,7 @@ typedef struct {
...
@@ -59,7 +59,7 @@ typedef struct {
void
(
*
init_node_id
)(
UA_UInt32
id
,
UA_UInt32
nb
,
UA_UInt32
magic
);
void
(
*
init_node_id
)(
UA_UInt32
id
,
UA_UInt32
nb
,
UA_UInt32
magic
);
}
InstanceData
;
}
InstanceData
;
int
runPubsub
(
UA_String
*
transportProfile
,
int
runPubsub
(
const
UA_Logger
*
logger
,
UA_String
*
transportProfile
,
UA_NetworkAddressUrlDataType
*
networkAddressUrl
,
UA_NetworkAddressUrlDataType
*
networkAddressUrl
,
VariableStruct
variables
,
UA_UInt32
id
,
VariableStruct
variables
,
UA_UInt32
id
,
InstanceData
*
readerArray
,
UA_UInt32
nbReader
,
InstanceData
*
readerArray
,
UA_UInt32
nbReader
,
...
...
pubsub.c
View file @
fcc254d1
...
@@ -11,6 +11,8 @@ UA_NodeId connectionIdent, publishedDataSetIdent, writerGroupIdent,
...
@@ -11,6 +11,8 @@ UA_NodeId connectionIdent, publishedDataSetIdent, writerGroupIdent,
UA_DataSetReaderConfig
readerConfig
;
UA_DataSetReaderConfig
readerConfig
;
const
UA_Logger
*
pubsubLogger
;
VariableData
(
*
pubsubGetValue
)(
UA_String
identifier
);
VariableData
(
*
pubsubGetValue
)(
UA_String
identifier
);
static
void
(
*
callbackUpdate
)(
UA_UInt32
,
const
UA_DataValue
*
,
bool
print
);
static
void
(
*
callbackUpdate
)(
UA_UInt32
,
const
UA_DataValue
*
,
bool
print
);
...
@@ -90,7 +92,7 @@ readVariable(UA_Server *server,
...
@@ -90,7 +92,7 @@ readVariable(UA_Server *server,
}
}
if
(
retval
!=
UA_STATUSCODE_GOOD
)
if
(
retval
!=
UA_STATUSCODE_GOOD
)
UA_LOG_ERROR
(
UA_Log_Stdout
,
UA_LOGCATEGORY_USERLAND
,
"read returned value %d"
,
retval
);
UA_LOG_ERROR
(
pubsubLogger
,
UA_LOGCATEGORY_USERLAND
,
"read returned value %d"
,
retval
);
dataValue
->
hasValue
=
true
;
dataValue
->
hasValue
=
true
;
return
retval
;
return
retval
;
}
}
...
@@ -100,7 +102,7 @@ writeVariable(UA_Server *server,
...
@@ -100,7 +102,7 @@ writeVariable(UA_Server *server,
const
UA_NodeId
*
sessionId
,
void
*
sessionContext
,
const
UA_NodeId
*
sessionId
,
void
*
sessionContext
,
const
UA_NodeId
*
nodeId
,
void
*
nodeContext
,
const
UA_NodeId
*
nodeId
,
void
*
nodeContext
,
const
UA_NumericRange
*
range
,
const
UA_DataValue
*
data
)
{
const
UA_NumericRange
*
range
,
const
UA_DataValue
*
data
)
{
UA_LOG_INFO
(
UA_Log_Stdout
,
UA_LOGCATEGORY_USERLAND
,
UA_LOG_INFO
(
pubsubLogger
,
UA_LOGCATEGORY_USERLAND
,
"Updating variables manually is not implemented"
);
"Updating variables manually is not implemented"
);
return
UA_STATUSCODE_BADINTERNALERROR
;
return
UA_STATUSCODE_BADINTERNALERROR
;
}
}
...
@@ -360,7 +362,7 @@ static void fillDataSetMetaData(UA_DataSetMetaDataType *pMetaData,
...
@@ -360,7 +362,7 @@ static void fillDataSetMetaData(UA_DataSetMetaDataType *pMetaData,
/* Definition of number of fields sizeto create different
/* Definition of number of fields sizeto create different
* targetVariables of distinct datatype */
* targetVariables of distinct datatype */
pMetaData
->
fieldsSize
=
variables
.
nbVariable
;
pMetaData
->
fieldsSize
=
variables
.
nbVariable
;
UA_LOG_INFO
(
UA_Log_Stdout
,
UA_LOGCATEGORY_USERLAND
,
"fieldsSize %d"
,
(
int
)
pMetaData
->
fieldsSize
);
UA_LOG_INFO
(
pubsubLogger
,
UA_LOGCATEGORY_USERLAND
,
"fieldsSize %d"
,
(
int
)
pMetaData
->
fieldsSize
);
pMetaData
->
fields
=
(
UA_FieldMetaData
*
)
UA_Array_new
(
pMetaData
->
fieldsSize
,
pMetaData
->
fields
=
(
UA_FieldMetaData
*
)
UA_Array_new
(
pMetaData
->
fieldsSize
,
&
UA_TYPES
[
UA_TYPES_FIELDMETADATA
]);
&
UA_TYPES
[
UA_TYPES_FIELDMETADATA
]);
...
@@ -406,7 +408,7 @@ setVariableType(UA_Server *server, VariableStruct variables) {
...
@@ -406,7 +408,7 @@ setVariableType(UA_Server *server, VariableStruct variables) {
break
;
break
;
default:
default:
UA_LOG_ERROR
(
UA_Log_Stdout
,
UA_LOGCATEGORY_USERLAND
,
"Valuerank not handled"
);
UA_LOG_ERROR
(
pubsubLogger
,
UA_LOGCATEGORY_USERLAND
,
"Valuerank not handled"
);
break
;
break
;
}
}
}
}
...
@@ -470,7 +472,7 @@ subscribe(UA_Server *server, InstanceData *instanceArray, UA_UInt32 id,
...
@@ -470,7 +472,7 @@ subscribe(UA_Server *server, InstanceData *instanceArray, UA_UInt32 id,
return
retval
;
return
retval
;
}
}
int
runPubsub
(
UA_String
*
transportProfile
,
int
runPubsub
(
const
UA_Logger
*
logger
,
UA_String
*
transportProfile
,
UA_NetworkAddressUrlDataType
*
networkAddressUrl
,
UA_NetworkAddressUrlDataType
*
networkAddressUrl
,
VariableStruct
variables
,
UA_UInt32
id
,
VariableStruct
variables
,
UA_UInt32
id
,
InstanceData
*
readerArray
,
UA_UInt32
nbReader
,
InstanceData
*
readerArray
,
UA_UInt32
nbReader
,
...
@@ -481,6 +483,7 @@ int runPubsub(UA_String *transportProfile,
...
@@ -481,6 +483,7 @@ int runPubsub(UA_String *transportProfile,
UA_Boolean
*
running
)
{
UA_Boolean
*
running
)
{
UA_Server
*
server
;
UA_Server
*
server
;
UA_StatusCode
retval
;
UA_StatusCode
retval
;
pubsubLogger
=
logger
;
server
=
setServer
(
transportProfile
,
networkAddressUrl
,
id
);
server
=
setServer
(
transportProfile
,
networkAddressUrl
,
id
);
setVariableType
(
server
,
variables
);
setVariableType
(
server
,
variables
);
...
...
qjs_wrapper.c
View file @
fcc254d1
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment