Commit 1ab8f5a4 authored by Léo-Paul Géneau's avatar Léo-Paul Géneau 👾

Stop using custom logger

Stop using a custom logger for subscriber.
When drone logs are required during execution (a.k.a debug mode), they are now
send through OPC-UA.
parent 19d6f938
......@@ -5,7 +5,7 @@
#include "autopilot_wrapper.h"
#include "pubsub.h"
#define DRONE_VARIABLE_NB 3
#define DRONE_VARIABLE_NB 4
#define SUBSCRIBER_VARIABLE_NB 1
struct messageNode {
char *message;
......@@ -22,7 +22,7 @@ UA_UInt32 positionArrayDims[] = {POSITION_ARRAY_SIZE};
UA_Double speedArray[SPEED_ARRAY_SIZE] = { 0 };
UA_UInt32 speedArrayDims[] = {SPEED_ARRAY_SIZE};
UA_String message = {
UA_String initial_ua_string = {
.length = 0,
.data = NULL,
};
......@@ -55,7 +55,7 @@ VariableData droneVariableArray[] = {
{
.name = "message",
.description = "Message to send to the other drones",
.value = &message,
.value = &initial_ua_string,
.type = UA_TYPES_STRING,
.builtInType = UA_NS0ID_STRING,
.valueRank = UA_VALUERANK_SCALAR,
......@@ -63,6 +63,17 @@ VariableData droneVariableArray[] = {
.arrayDimensions = NULL,
.getter.getString = get_message,
},
{
.name = "log",
.description = "Message to send to the other drones",
.value = &initial_ua_string,
.type = UA_TYPES_STRING,
.builtInType = UA_NS0ID_STRING,
.valueRank = UA_VALUERANK_SCALAR,
.arrayDimensionsSize = 0,
.arrayDimensions = NULL,
.getter.getString = get_log,
},
};
VariableStruct droneVariables = {
......@@ -74,7 +85,7 @@ VariableData subscriberVariableArray[] = {
{
.name = "message",
.description = "Message to send to the other drones",
.value = &message,
.value = &initial_ua_string,
.type = UA_TYPES_STRING,
.builtInType = UA_NS0ID_STRING,
.valueRank = UA_VALUERANK_SCALAR,
......@@ -89,7 +100,4 @@ VariableStruct subscriberVariables = {
.variableArray = subscriberVariableArray,
};
void Subscriber_log(void *context, UA_LogLevel level, UA_LogCategory category,
const char *msg, va_list args);
#endif /* __DRONEDGE_H__ */
......@@ -31,6 +31,8 @@ typedef struct {
UA_Float climbRate;
char message[MAX_MESSAGE_SIZE];
UA_UInt32 messageId;
char log[MAX_MESSAGE_SIZE];
UA_UInt32 logId;
} JSDroneData;
typedef struct {
......@@ -79,6 +81,8 @@ int runPubsub(const UA_Logger *logger, UA_String *transportProfile,
UA_String get_message(void);
UA_String get_log(void);
UA_UInt16 get_drone_id(UA_UInt32 nb);
void init_drone_node_id(UA_UInt32 id, UA_UInt32 nb, UA_UInt32 magic);
......
This diff is collapsed.
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