From 21472310d8a037702834835cbe638e25c3bdebc5 Mon Sep 17 00:00:00 2001 From: Yu Asabe Date: Fri, 1 Apr 2022 15:07:11 +0900 Subject: [PATCH] Create functions for DB manipulation --- include/autoware_v2x/cpm_application.hpp | 13 +++++++++++++ src/cpm_application.cpp | 8 ++++++++ 2 files changed, 21 insertions(+) diff --git a/include/autoware_v2x/cpm_application.hpp b/include/autoware_v2x/cpm_application.hpp index ea3aab5..82fa2e0 100644 --- a/include/autoware_v2x/cpm_application.hpp +++ b/include/autoware_v2x/cpm_application.hpp @@ -7,6 +7,7 @@ #include #include "autoware_auto_perception_msgs/msg/predicted_objects.hpp" #include "autoware_v2x/positioning.hpp" +#include namespace v2x { @@ -28,6 +29,18 @@ namespace v2x void printObjectsList(int); void send(); + /** Creates the database schema. + * Creates tables for cpm_sent, cpm_received + */ + void createTables(); + + /** Inserts CPM into the database. + * Constructs and executes queries for inserting the specified CPM data. + * @param cpm The CPM to be inserted + * @param table_name The table to insert the CPM into (cpm_sent or cpm_received) + */ + void insertCpmToCpmTable(vanetza::asn1::Cpm, char* table_name); + struct Object { std::string uuid; int objectID; // 0-255 for CPM diff --git a/src/cpm_application.cpp b/src/cpm_application.cpp index 6cf4cf9..5a42302 100644 --- a/src/cpm_application.cpp +++ b/src/cpm_application.cpp @@ -561,4 +561,12 @@ namespace v2x { ++cpm_num_; } } + + void CpmApplication::createTables() { + + } + + void CpmApplication::insertCpmToCpmTable(vanetza::asn1::Cpm cpm, char* table_name) { + + } } \ No newline at end of file