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
cd25661e
Commit
cd25661e
authored
Jun 13, 2022
by
Léo-Paul Géneau
👾
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add network interface as a parameter for pubsub
parent
4a529174
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
qjs_wrapper.c
qjs_wrapper.c
+6
-3
No files found.
qjs_wrapper.c
View file @
cd25661e
...
@@ -185,22 +185,24 @@ static JSValue js_run_pubsub(JSContext *ctx, JSValueConst this_val,
...
@@ -185,22 +185,24 @@ static JSValue js_run_pubsub(JSContext *ctx, JSValueConst this_val,
{
{
const
char
*
ipv6
;
const
char
*
ipv6
;
const
char
*
port
;
const
char
*
port
;
const
char
*
net_iface
;
char
urlBuffer
[
44
];
char
urlBuffer
[
44
];
int
id
;
int
id
;
int
res
;
int
res
;
ipv6
=
JS_ToCString
(
ctx
,
argv
[
0
]);
ipv6
=
JS_ToCString
(
ctx
,
argv
[
0
]);
port
=
JS_ToCString
(
ctx
,
argv
[
1
]);
port
=
JS_ToCString
(
ctx
,
argv
[
1
]);
net_iface
=
JS_ToCString
(
ctx
,
argv
[
2
]);
UA_snprintf
(
urlBuffer
,
sizeof
(
urlBuffer
),
"opc.udp://[%s]:%s/"
,
ipv6
,
port
);
UA_snprintf
(
urlBuffer
,
sizeof
(
urlBuffer
),
"opc.udp://[%s]:%s/"
,
ipv6
,
port
);
UA_String
transportProfile
=
UA_String
transportProfile
=
UA_STRING
(
"http://opcfoundation.org/UA-Profile/Transport/pubsub-udp-uadp"
);
UA_STRING
(
"http://opcfoundation.org/UA-Profile/Transport/pubsub-udp-uadp"
);
UA_NetworkAddressUrlDataType
networkAddressUrl
;
UA_NetworkAddressUrlDataType
networkAddressUrl
;
networkAddressUrl
.
networkInterface
=
UA_STRING
(
"eth0"
);
networkAddressUrl
.
networkInterface
=
UA_STRING
(
net_iface
);
networkAddressUrl
.
url
=
UA_STRING
(
urlBuffer
);
networkAddressUrl
.
url
=
UA_STRING
(
urlBuffer
);
if
(
JS_ToInt32
(
ctx
,
&
id
,
argv
[
2
]))
if
(
JS_ToInt32
(
ctx
,
&
id
,
argv
[
3
]))
return
JS_EXCEPTION
;
return
JS_EXCEPTION
;
res
=
runPubsub
(
&
transportProfile
,
&
networkAddressUrl
,
droneVariableArray
,
res
=
runPubsub
(
&
transportProfile
,
&
networkAddressUrl
,
droneVariableArray
,
...
@@ -209,6 +211,7 @@ static JSValue js_run_pubsub(JSContext *ctx, JSValueConst this_val,
...
@@ -209,6 +211,7 @@ static JSValue js_run_pubsub(JSContext *ctx, JSValueConst this_val,
JS_FreeCString
(
ctx
,
ipv6
);
JS_FreeCString
(
ctx
,
ipv6
);
JS_FreeCString
(
ctx
,
port
);
JS_FreeCString
(
ctx
,
port
);
JS_FreeCString
(
ctx
,
net_iface
);
return
JS_NewInt32
(
ctx
,
res
);
return
JS_NewInt32
(
ctx
,
res
);
}
}
...
@@ -507,7 +510,7 @@ static const JSCFunctionListEntry js_mavsdk_funcs[] = {
...
@@ -507,7 +510,7 @@ static const JSCFunctionListEntry js_mavsdk_funcs[] = {
JS_CFUNC_DEF
(
"takeOffAndWait"
,
0
,
js_mavsdk_takeOffAndWait
),
JS_CFUNC_DEF
(
"takeOffAndWait"
,
0
,
js_mavsdk_takeOffAndWait
),
JS_CFUNC_DEF
(
"land"
,
0
,
js_mavsdk_land
),
JS_CFUNC_DEF
(
"land"
,
0
,
js_mavsdk_land
),
JS_CFUNC_DEF
(
"initPubsub"
,
1
,
js_init_pubsub
),
JS_CFUNC_DEF
(
"initPubsub"
,
1
,
js_init_pubsub
),
JS_CFUNC_DEF
(
"runPubsub"
,
2
,
js_run_pubsub
),
JS_CFUNC_DEF
(
"runPubsub"
,
4
,
js_run_pubsub
),
JS_CFUNC_DEF
(
"publishCheckpoint"
,
1
,
js_publish_checkpoint
),
JS_CFUNC_DEF
(
"publishCheckpoint"
,
1
,
js_publish_checkpoint
),
JS_CFUNC_DEF
(
"stopPubsub"
,
0
,
js_stop_pubsub
),
JS_CFUNC_DEF
(
"stopPubsub"
,
0
,
js_stop_pubsub
),
};
};
...
...
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