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
e6dbfeff
Commit
e6dbfeff
authored
Sep 04, 2023
by
Léo-Paul Géneau
👾
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add timestamp to Position class
parent
6ca1df64
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
0 deletions
+5
-0
include/pubsub.h
include/pubsub.h
+1
-0
qjs_wrapper.c
qjs_wrapper.c
+4
-0
No files found.
include/pubsub.h
View file @
e6dbfeff
...
@@ -37,6 +37,7 @@ typedef struct {
...
@@ -37,6 +37,7 @@ typedef struct {
UA_Double
x
;
UA_Double
x
;
UA_Double
y
;
UA_Double
y
;
UA_Double
z
;
UA_Double
z
;
UA_Double
timestamp
;
}
JSPositionData
;
}
JSPositionData
;
typedef
struct
{
typedef
struct
{
...
...
qjs_wrapper.c
View file @
e6dbfeff
...
@@ -69,6 +69,7 @@ static JSValue js_new_position(JSContext *ctx, JSValueConst thisVal,
...
@@ -69,6 +69,7 @@ static JSValue js_new_position(JSContext *ctx, JSValueConst thisVal,
s
->
x
=
positionArray
[
0
];
s
->
x
=
positionArray
[
0
];
s
->
y
=
positionArray
[
1
];
s
->
y
=
positionArray
[
1
];
s
->
z
=
positionArray
[
3
];
//relative altitude
s
->
z
=
positionArray
[
3
];
//relative altitude
s
->
timestamp
=
positionArray
[
4
];
JS_SetOpaque
(
obj
,
s
);
JS_SetOpaque
(
obj
,
s
);
free
(
positionArray
);
free
(
positionArray
);
return
obj
;
return
obj
;
...
@@ -86,6 +87,8 @@ static JSValue js_position_get(JSContext *ctx, JSValueConst thisVal, int magic)
...
@@ -86,6 +87,8 @@ static JSValue js_position_get(JSContext *ctx, JSValueConst thisVal, int magic)
return
JS_NewFloat64
(
ctx
,
s
->
y
);
return
JS_NewFloat64
(
ctx
,
s
->
y
);
case
2
:
case
2
:
return
JS_NewFloat64
(
ctx
,
s
->
z
);
return
JS_NewFloat64
(
ctx
,
s
->
z
);
case
3
:
return
JS_NewFloat64
(
ctx
,
s
->
timestamp
);
default:
default:
return
JS_EXCEPTION
;
return
JS_EXCEPTION
;
}
}
...
@@ -100,6 +103,7 @@ static const JSCFunctionListEntry js_position_proto_funcs[] = {
...
@@ -100,6 +103,7 @@ static const JSCFunctionListEntry js_position_proto_funcs[] = {
JS_CGETSET_MAGIC_DEF
(
"x"
,
js_position_get
,
NULL
,
0
),
JS_CGETSET_MAGIC_DEF
(
"x"
,
js_position_get
,
NULL
,
0
),
JS_CGETSET_MAGIC_DEF
(
"y"
,
js_position_get
,
NULL
,
1
),
JS_CGETSET_MAGIC_DEF
(
"y"
,
js_position_get
,
NULL
,
1
),
JS_CGETSET_MAGIC_DEF
(
"z"
,
js_position_get
,
NULL
,
2
),
JS_CGETSET_MAGIC_DEF
(
"z"
,
js_position_get
,
NULL
,
2
),
JS_CGETSET_MAGIC_DEF
(
"timestamp"
,
js_position_get
,
NULL
,
3
),
};
};
// Drone class functions
// Drone class functions
...
...
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