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
1
Merge Requests
1
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
ba7bc987
Commit
ba7bc987
authored
Apr 19, 2023
by
Léo-Paul Géneau
👾
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split ip and port parameters
parent
bdf16d1f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
9 deletions
+14
-9
include/mavsdk_wrapper.h
include/mavsdk_wrapper.h
+1
-1
mavsdk_wrapper.cpp
mavsdk_wrapper.cpp
+3
-1
qjs_wrapper.c
qjs_wrapper.c
+10
-7
No files found.
include/mavsdk_wrapper.h
View file @
ba7bc987
...
@@ -20,7 +20,7 @@ extern "C" {
...
@@ -20,7 +20,7 @@ extern "C" {
#endif
#endif
#include <stdint.h>
#include <stdint.h>
// Connexion management functions
// Connexion management functions
int
mavsdk_start
(
const
char
*
url
,
const
char
*
log_file
,
int
timeout
);
int
mavsdk_start
(
const
char
*
ip
,
int
port
,
const
char
*
log_file
,
int
timeout
);
int
mavsdk_stop
(
void
);
int
mavsdk_stop
(
void
);
int
mavsdk_reboot
(
void
);
int
mavsdk_reboot
(
void
);
...
...
mavsdk_wrapper.cpp
View file @
ba7bc987
...
@@ -92,7 +92,9 @@ static double toDeg(double angle) {
...
@@ -92,7 +92,9 @@ static double toDeg(double angle) {
return
180
*
angle
/
M_PI
;
return
180
*
angle
/
M_PI
;
}
}
int
mavsdk_start
(
const
char
*
url
,
const
char
*
log_file
,
int
timeout
)
{
int
mavsdk_start
(
const
char
*
ip
,
int
port
,
const
char
*
log_file
,
int
timeout
)
{
char
url
[
32
];
sprintf
(
url
,
"udp://%s:%d"
,
ip
,
port
);
std
::
string
connection_url
(
url
);
std
::
string
connection_url
(
url
);
ConnectionResult
connection_result
;
ConnectionResult
connection_result
;
float
abs_altitude
;
float
abs_altitude
;
...
...
qjs_wrapper.c
View file @
ba7bc987
...
@@ -405,18 +405,21 @@ static JSValue js_stop_pubsub(JSContext *ctx, JSValueConst thisVal,
...
@@ -405,18 +405,21 @@ static JSValue js_stop_pubsub(JSContext *ctx, JSValueConst thisVal,
static
JSValue
js_mavsdk_start
(
JSContext
*
ctx
,
JSValueConst
thisVal
,
static
JSValue
js_mavsdk_start
(
JSContext
*
ctx
,
JSValueConst
thisVal
,
int
argc
,
JSValueConst
*
argv
)
int
argc
,
JSValueConst
*
argv
)
{
{
const
char
*
url
;
const
char
*
ip
;
const
char
*
log_file
;
const
char
*
log_file
;
int
port
;
int
timeout
;
int
timeout
;
int
res
;
int
res
;
url
=
JS_ToCString
(
ctx
,
argv
[
0
]);
ip
=
JS_ToCString
(
ctx
,
argv
[
0
]);
log_file
=
JS_ToCString
(
ctx
,
argv
[
1
]);
if
(
JS_ToInt32
(
ctx
,
&
port
,
argv
[
1
]))
if
(
JS_ToInt32
(
ctx
,
&
timeout
,
argv
[
2
]))
return
JS_EXCEPTION
;
log_file
=
JS_ToCString
(
ctx
,
argv
[
2
]);
if
(
JS_ToInt32
(
ctx
,
&
timeout
,
argv
[
3
]))
return
JS_EXCEPTION
;
return
JS_EXCEPTION
;
res
=
mavsdk_start
(
url
,
log_file
,
timeout
);
res
=
mavsdk_start
(
ip
,
port
,
log_file
,
timeout
);
JS_FreeCString
(
ctx
,
url
);
JS_FreeCString
(
ctx
,
ip
);
JS_FreeCString
(
ctx
,
log_file
);
JS_FreeCString
(
ctx
,
log_file
);
return
JS_NewInt32
(
ctx
,
res
);
return
JS_NewInt32
(
ctx
,
res
);
...
@@ -591,7 +594,7 @@ static const JSCFunctionListEntry js_mavsdk_funcs[] = {
...
@@ -591,7 +594,7 @@ static const JSCFunctionListEntry js_mavsdk_funcs[] = {
JS_CFUNC_DEF
(
"setMessage"
,
1
,
js_drone_set_message
),
JS_CFUNC_DEF
(
"setMessage"
,
1
,
js_drone_set_message
),
JS_CFUNC_DEF
(
"runPubsub"
,
6
,
js_run_pubsub
),
JS_CFUNC_DEF
(
"runPubsub"
,
6
,
js_run_pubsub
),
JS_CFUNC_DEF
(
"stopPubsub"
,
0
,
js_stop_pubsub
),
JS_CFUNC_DEF
(
"stopPubsub"
,
0
,
js_stop_pubsub
),
JS_CFUNC_DEF
(
"start"
,
3
,
js_mavsdk_start
),
JS_CFUNC_DEF
(
"start"
,
4
,
js_mavsdk_start
),
JS_CFUNC_DEF
(
"stop"
,
0
,
js_mavsdk_stop
),
JS_CFUNC_DEF
(
"stop"
,
0
,
js_mavsdk_stop
),
JS_CFUNC_DEF
(
"reboot"
,
0
,
js_mavsdk_reboot
),
JS_CFUNC_DEF
(
"reboot"
,
0
,
js_mavsdk_reboot
),
JS_CFUNC_DEF
(
"arm"
,
0
,
js_mavsdk_arm
),
JS_CFUNC_DEF
(
"arm"
,
0
,
js_mavsdk_arm
),
...
...
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