diff --git a/CMakeLists.txt b/CMakeLists.txt
index 962e5a5..ae971cb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -53,17 +53,30 @@ include_directories(
)
+<<<<<<< HEAD
add_executable(xbee_mav src/Xbee.cpp src/XBeeFrame.cpp src/SerialDevice.cpp src/CommunicationManager.cpp)
target_link_libraries(xbee_mav ${catkin_LIBRARIES})
add_executable(config src/main.cpp src/XBeeModule.cpp src/XMLConfigParser.cpp)
target_link_libraries(config ${catkin_LIBRARIES})
+=======
+add_executable(xbee_mav src/Xbee.cpp src/XBeeFrame.cpp src/SerialDevice.cpp src/CommunicationManager.cpp src/PacketsHandler)
+target_link_libraries(xbee_mav ${catkin_LIBRARIES})
+
+#add_executable(config src/main.cpp src/XBeeModule.cpp src/XMLConfigParser.cpp)
+#target_link_libraries(config ${catkin_LIBRARIES})
+>>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1
#add_executable(test_controller src/TestController.cpp)
#target_link_libraries(test_controller ${catkin_LIBRARIES})
+<<<<<<< HEAD
#add_executable(test_buzz src/TestBuzz.cpp)
#target_link_libraries(test_buzz ${catkin_LIBRARIES})
+=======
+add_executable(test_buzz src/TestBuzz.cpp)
+target_link_libraries(test_buzz ${catkin_LIBRARIES})
+>>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1
@@ -76,6 +89,9 @@ target_link_libraries(config ${catkin_LIBRARIES})
#############
## Testing ##
#############
+<<<<<<< HEAD
+=======
+>>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1
diff --git a/Resources/XBee_Config.xml b/Resources/XBee_Config.xml
index 8b7af61..da8ec54 100644
--- a/Resources/XBee_Config.xml
+++ b/Resources/XBee_Config.xml
@@ -22,7 +22,11 @@
11
0
+<<<<<<< HEAD
7
+=======
+ 8
+>>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1
0
0
3
diff --git a/Resources/database.xml b/Resources/database.xml
new file mode 100644
index 0000000..be63e56
--- /dev/null
+++ b/Resources/database.xml
@@ -0,0 +1,14 @@
+
+
+
+ 0013A20040D8CA1E
+ 0013A200415278B8
+ 0013A2004103B363
+ 0013A200415278AD
+ 0013A2004103B356
+ 0013A200415278B7
+ 0013A2004098A7A7
+ 0013A2004098A7BA
+ 0013A200415A9DDD
+ 0013A200415A9DE4
+
diff --git a/include/CommunicationManager.h b/include/CommunicationManager.h
index 313f823..cfa0da1 100644
--- a/include/CommunicationManager.h
+++ b/include/CommunicationManager.h
@@ -1,6 +1,10 @@
/* CommunicationManager.h -- Communication Manager class for XBee:
Handles all communications with other ROS nodes
+<<<<<<< HEAD
and the serial port -- */
+=======
+ and the serial port -- */
+>>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1
/* ------------------------------------------------------------------------- */
/* September 20, 2016 -- @Copyright Aymen Soussia. All rights reserved. */
/* (aymen.soussia@gmail.com) */
@@ -16,12 +20,18 @@
#include
#include
+<<<<<<< HEAD
#include"SerialDevice.h"
#define MESSAGE_CONSTANT 238
#define ACK_MESSAGE_CONSTANT 911
#define XBEE_MESSAGE_CONSTANT 586782343
#define XBEE_STOP_TRANSMISSION 4355356352
+=======
+#include"PacketsHandler.h"
+#include"SerialDevice.h"
+
+>>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1
namespace Mist
{
@@ -62,15 +72,22 @@ private:
void Run_In_Solo_Mode(DRONE_TYPE drone_type);
void Run_In_Swarm_Mode();
+<<<<<<< HEAD
void Generate_Transmit_Request_Frame(
const char* const message,
std::string* frame,
int tot,
+=======
+ /*void Generate_Transmit_Request_Frame(
+ const char* const message,
+ std::string* frame,
+>>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1
const unsigned char frame_ID =
static_cast(0x01),
const std::string& destination_adssress = "000000000000FFFF",
const std::string& short_destination_adress = "FFFF",
const std::string& broadcast_radius = "00",
+<<<<<<< HEAD
const std::string& options = "00");
void Check_In_Messages_and_Transfer_To_Topics();
void Display_Init_Communication_Failure();
@@ -78,6 +95,15 @@ private:
std::string* converted_data);
void Calculate_and_Append_Checksum(std::string* frame);
void Add_Length_and_Start_Delimiter(std::string* frame);
+=======
+ const std::string& options = "00");*/
+ //void Check_In_Messages_and_Transfer_To_Topics();
+ void Display_Init_Communication_Failure();
+ //void Convert_HEX_To_Bytes(const std::string& HEX_data,
+ //std::string* converted_data);
+ //void Calculate_and_Append_Checksum(std::string* frame);
+ //void Add_Length_and_Start_Delimiter(std::string* frame);
+>>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1
void Send_Mavlink_Message_Callback(
const mavros_msgs::Mavlink::ConstPtr& mavlink_msg);
void Display_Drone_Type_and_Running_Mode(DRONE_TYPE drone_type,
@@ -85,15 +111,32 @@ private:
bool Serve_Flight_Controller(mavros_msgs::CommandInt::
Request& request, mavros_msgs::CommandInt::Response& response);
void Check_In_Messages_and_Transfer_To_Server();
+<<<<<<< HEAD
unsigned short Caculate_Checksum(std::string* frame);
void Send_multi_msg();
Mist::Xbee::SerialDevice serial_device_;
Thread_Safe_Deque* in_messages_;
+=======
+ void Process_In_Standard_Messages();
+ void Process_In_Acks_and_Pings();
+ void Process_In_Fragments();
+ void Process_In_Packets();
+ void Process_Command_Responses();
+
+ Mist::Xbee::SerialDevice serial_device_;
+ Mist::Xbee::PacketsHandler packets_handler_;
+ Thread_Safe_Deque in_std_messages_;
+ Thread_Safe_Deque in_fragments_;
+ Thread_Safe_Deque in_Acks_and_Pings_;
+ Thread_Safe_Deque command_responses_;
+ Thread_Safe_Deque in_packets_;
+>>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1
ros::NodeHandle node_handle_;
ros::Subscriber mavlink_subscriber_;
ros::Publisher mavlink_publisher_;
ros::ServiceClient mav_dji_client_;
ros::ServiceServer mav_dji_server_;
+<<<<<<< HEAD
/*No of robots*/
int no_of_dev;
int device_id;
@@ -114,6 +157,9 @@ private:
uint64_t message_obtmulti[600];
//int test_1;
//struct timeval t1, t2;
+=======
+ std::shared_ptr service_thread_; // TO DO delete !?
+>>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1
};
diff --git a/include/MultithreadingDeque.hpp b/include/MultithreadingDeque.hpp
index 8de0acf..6d0e80d 100644
--- a/include/MultithreadingDeque.hpp
+++ b/include/MultithreadingDeque.hpp
@@ -36,7 +36,11 @@ public:
//****************************************************************************
+<<<<<<< HEAD
void Push_Pack(const _T& new_data)
+=======
+ void Push_Back(const _T& new_data)
+>>>>>>> a16cf8b196cb6b63ef52ea26b8cb9a8e861d84d1
{
std::lock_guard guard(mutex_);
deque_.push_back(new_data);
diff --git a/include/PacketsHandler.h b/include/PacketsHandler.h
new file mode 100644
index 0000000..a450350
--- /dev/null
+++ b/include/PacketsHandler.h
@@ -0,0 +1,152 @@
+/* PacketsHandler.h-- Packets Handler class for XBee:
+ Serialize, deserialize, fragment and reassemly mavlink
+ messages -- */
+/* ------------------------------------------------------------------------- */
+/* February 06, 2017 -- @Copyright Aymen Soussia. All rights reserved. */
+/* (aymen.soussia@gmail.com) */
+
+
+#pragma once
+
+#include
+#include
+#include
+#include