Commit 2a2d821d authored by Léo-Paul Géneau's avatar Léo-Paul Géneau 👾

rename x, y, z into latitude, longitude, altitude

parent 1a387ecc
......@@ -32,9 +32,9 @@ typedef struct {
} JSDroneData;
typedef struct {
UA_Double x;
UA_Double y;
UA_Double z;
UA_Double latitude;
UA_Double longitude;
UA_Double altitude;
UA_Int64 timestamp;
} JSPositionData;
......
......@@ -158,10 +158,10 @@ static JSValue js_new_position(JSContext *ctx, JSValueConst thisVal,
return JS_EXCEPTION;
}
newPositionArray = getPositionArray();
s->x = (double)newPositionArray[LATITUDE] / 1e7;
s->y = (double)newPositionArray[LONGITUDE] / 1e7;
s->z = (UA_Double)(newPositionArray[REL_ALTITUDE] / 1000);
s->timestamp = newPositionArray[TIMESTAMP];
s->latitude = (double)positionArray[LATITUDE] / 1e7;
s->longitude = (double)positionArray[LONGITUDE] / 1e7;
s->altitude = (UA_Double)(positionArray[REL_ALTITUDE] / 1000);
s->timestamp = positionArray[TIMESTAMP];
JS_SetOpaque(obj, s);
free(newPositionArray);
return obj;
......@@ -175,11 +175,11 @@ static JSValue js_position_get(JSContext *ctx, JSValueConst thisVal, int magic)
return JS_EXCEPTION;
switch(magic) {
case 0:
return JS_NewFloat64(ctx, s->x);
return JS_NewFloat64(ctx, s->latitude);
case 1:
return JS_NewFloat64(ctx, s->y);
return JS_NewFloat64(ctx, s->longitude);
case 2:
return JS_NewFloat64(ctx, s->z);
return JS_NewFloat64(ctx, s->altitude);
case 3:
return JS_NewInt64(ctx, s->timestamp);
default:
......@@ -193,9 +193,9 @@ static JSClassDef jsPositionClass = {
};
static const JSCFunctionListEntry js_position_proto_funcs[] = {
JS_CGETSET_MAGIC_DEF("x", js_position_get, NULL, 0),
JS_CGETSET_MAGIC_DEF("y", js_position_get, NULL, 1),
JS_CGETSET_MAGIC_DEF("z", js_position_get, NULL, 2),
JS_CGETSET_MAGIC_DEF("latitude", js_position_get, NULL, 0),
JS_CGETSET_MAGIC_DEF("longitude", js_position_get, NULL, 1),
JS_CGETSET_MAGIC_DEF("altitude", js_position_get, NULL, 2),
JS_CGETSET_MAGIC_DEF("timestamp", js_position_get, NULL, 3),
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment