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