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 = {
.
variableArray
=
subscriberVariableArray
,
};
void
Subscriber_log
(
void
*
context
,
UA_LogLevel
level
,
UA_LogCategory
category
,
const
char
*
msg
,
va_list
args
);
#endif
/* __DRONEDGE_H__ */
include/pubsub.h
View file @
fcc254d1
...
...
@@ -59,7 +59,7 @@ typedef struct {
void
(
*
init_node_id
)(
UA_UInt32
id
,
UA_UInt32
nb
,
UA_UInt32
magic
);
}
InstanceData
;
int
runPubsub
(
UA_String
*
transportProfile
,
int
runPubsub
(
const
UA_Logger
*
logger
,
UA_String
*
transportProfile
,
UA_NetworkAddressUrlDataType
*
networkAddressUrl
,
VariableStruct
variables
,
UA_UInt32
id
,
InstanceData
*
readerArray
,
UA_UInt32
nbReader
,
...
...
pubsub.c
View file @
fcc254d1
...
...
@@ -11,6 +11,8 @@ UA_NodeId connectionIdent, publishedDataSetIdent, writerGroupIdent,
UA_DataSetReaderConfig
readerConfig
;
const
UA_Logger
*
pubsubLogger
;
VariableData
(
*
pubsubGetValue
)(
UA_String
identifier
);
static
void
(
*
callbackUpdate
)(
UA_UInt32
,
const
UA_DataValue
*
,
bool
print
);
...
...
@@ -90,7 +92,7 @@ readVariable(UA_Server *server,
}
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
;
return
retval
;
}
...
...
@@ -100,7 +102,7 @@ writeVariable(UA_Server *server,
const
UA_NodeId
*
sessionId
,
void
*
sessionContext
,
const
UA_NodeId
*
nodeId
,
void
*
nodeContext
,
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"
);
return
UA_STATUSCODE_BADINTERNALERROR
;
}
...
...
@@ -360,7 +362,7 @@ static void fillDataSetMetaData(UA_DataSetMetaDataType *pMetaData,
/* Definition of number of fields sizeto create different
* targetVariables of distinct datatype */
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
,
&
UA_TYPES
[
UA_TYPES_FIELDMETADATA
]);
...
...
@@ -406,7 +408,7 @@ setVariableType(UA_Server *server, VariableStruct variables) {
break
;
default:
UA_LOG_ERROR
(
UA_Log_Stdout
,
UA_LOGCATEGORY_USERLAND
,
"Valuerank not handled"
);
UA_LOG_ERROR
(
pubsubLogger
,
UA_LOGCATEGORY_USERLAND
,
"Valuerank not handled"
);
break
;
}
}
...
...
@@ -470,7 +472,7 @@ subscribe(UA_Server *server, InstanceData *instanceArray, UA_UInt32 id,
return
retval
;
}
int
runPubsub
(
UA_String
*
transportProfile
,
int
runPubsub
(
const
UA_Logger
*
logger
,
UA_String
*
transportProfile
,
UA_NetworkAddressUrlDataType
*
networkAddressUrl
,
VariableStruct
variables
,
UA_UInt32
id
,
InstanceData
*
readerArray
,
UA_UInt32
nbReader
,
...
...
@@ -481,6 +483,7 @@ int runPubsub(UA_String *transportProfile,
UA_Boolean
*
running
)
{
UA_Server
*
server
;
UA_StatusCode
retval
;
pubsubLogger
=
logger
;
server
=
setServer
(
transportProfile
,
networkAddressUrl
,
id
);
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