Add Debugger commands.
This commit is contained in:
32
.vscode/launch.json
vendored
Normal file
32
.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
// Utilisez IntelliSense pour en savoir plus sur les attributs possibles.
|
||||||
|
// Pointez pour afficher la description des attributs existants.
|
||||||
|
// Pour plus d'informations, visitez : https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "(gdb) domo",
|
||||||
|
"type": "cppdbg",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceRoot}/_builds/x86_64_domo-debug/buildroot/build/domo/domod",
|
||||||
|
"args": [],
|
||||||
|
"stopAtEntry": false,
|
||||||
|
"cwd": "${workspaceRoot}/_builds/x86_64_domo-debug/buildroot/staging",
|
||||||
|
"environment": [
|
||||||
|
{
|
||||||
|
"name": "LD_LIBRARY_PATH",
|
||||||
|
"value": "${workspaceRoot}/_builds/x86_64_domo-debug/buildroot/staging/usr/lib"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"externalConsole": true,
|
||||||
|
"MIMode": "gdb",
|
||||||
|
"setupCommands": [
|
||||||
|
{
|
||||||
|
"description": "Enable pretty-printing for gdb",
|
||||||
|
"text": "-enable-pretty-printing",
|
||||||
|
"ignoreFailures": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -7,41 +7,45 @@ set (CMAKE_CXX_STANDARD 11)
|
|||||||
|
|
||||||
include (br)
|
include (br)
|
||||||
|
|
||||||
include_directories($ENV{SRC_DIR}/src/prog/domod/src)
|
include_directories(${workspaceRoot}/src/prog/domod/src)
|
||||||
|
|
||||||
#set(CMAKE_CXX_FLAGS "-Wall -Wextra -pedantic -Werror=strict-aliasing")
|
#set(CMAKE_CXX_FLAGS "-Wall -Wextra -pedantic -Werror=strict-aliasing")
|
||||||
|
|
||||||
file(
|
file(
|
||||||
GLOB_RECURSE
|
GLOB_RECURSE
|
||||||
source_files
|
source_files
|
||||||
$ENV{SRC_DIR}/src/prog/domod/src/timers/Timers.cpp
|
${workspaceRoot}/src/prog/domod/src/main.cpp
|
||||||
$ENV{SRC_DIR}/src/prog/domod/src/timers/Event.cpp
|
|
||||||
$ENV{SRC_DIR}/src/prog/domod/src/timers/Clock.cpp
|
|
||||||
$ENV{SRC_DIR}/src/prog/domod/src/devices/Devices.cpp
|
|
||||||
$ENV{SRC_DIR}/src/prog/domod/src/devices/Device.cpp
|
|
||||||
$ENV{SRC_DIR}/src/prog/domod/src/devices/LightDevice.cpp
|
|
||||||
$ENV{SRC_DIR}/src/prog/domod/src/devices/ShutterDevice.cpp
|
|
||||||
$ENV{SRC_DIR}/src/prog/domod/src/devices/SprinklerDevice.cpp
|
|
||||||
$ENV{SRC_DIR}/src/prog/domod/src/devices/Light.cpp
|
|
||||||
$ENV{SRC_DIR}/src/prog/domod/src/devices/Shutter.cpp
|
|
||||||
$ENV{SRC_DIR}/src/prog/domod/src/devices/Sprinkler.cpp
|
|
||||||
$ENV{SRC_DIR}/src/prog/domod/src/ubus/capabilities.cpp
|
|
||||||
$ENV{SRC_DIR}/src/prog/domod/src/ubus/capabilities_lights.cpp
|
|
||||||
$ENV{SRC_DIR}/src/prog/domod/src/ubus/capabilities_shutters.cpp
|
|
||||||
$ENV{SRC_DIR}/src/prog/domod/src/ubus/capabilities_sprinklers.cpp
|
|
||||||
$ENV{SRC_DIR}/src/prog/domod/src/ubus/speach_command.cpp
|
|
||||||
$ENV{SRC_DIR}/src/prog/domod/src/ubus/timers.cpp
|
|
||||||
$ENV{SRC_DIR}/src/prog/domod/src/helpers/Tokenizer.cpp
|
|
||||||
$ENV{SRC_DIR}/src/prog/domod/src/helpers/Strings.cpp
|
|
||||||
$ENV{SRC_DIR}/src/prog/domod/src/main.cpp
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# $ENV{SRC_DIR}/src/prog/domod/src/timers/Timers.cpp
|
||||||
|
# $ENV{SRC_DIR}/src/prog/domod/src/timers/Event.cpp
|
||||||
|
# $ENV{SRC_DIR}/src/prog/domod/src/timers/Clock.cpp
|
||||||
|
# $ENV{SRC_DIR}/src/prog/domod/src/devices/Devices.cpp
|
||||||
|
# $ENV{SRC_DIR}/src/prog/domod/src/devices/Device.cpp
|
||||||
|
# $ENV{SRC_DIR}/src/prog/domod/src/devices/LightDevice.cpp
|
||||||
|
# $ENV{SRC_DIR}/src/prog/domod/src/devices/ShutterDevice.cpp
|
||||||
|
# $ENV{SRC_DIR}/src/prog/domod/src/devices/SprinklerDevice.cpp
|
||||||
|
# $ENV{SRC_DIR}/src/prog/domod/src/devices/Light.cpp
|
||||||
|
# $ENV{SRC_DIR}/src/prog/domod/src/devices/Shutter.cpp
|
||||||
|
# $ENV{SRC_DIR}/src/prog/domod/src/devices/Sprinkler.cpp
|
||||||
|
# $ENV{SRC_DIR}/src/prog/domod/src/ubus/capabilities.cpp
|
||||||
|
# $ENV{SRC_DIR}/src/prog/domod/src/ubus/capabilities_lights.cpp
|
||||||
|
# $ENV{SRC_DIR}/src/prog/domod/src/ubus/capabilities_shutters.cpp
|
||||||
|
# $ENV{SRC_DIR}/src/prog/domod/src/ubus/capabilities_sprinklers.cpp
|
||||||
|
# $ENV{SRC_DIR}/src/prog/domod/src/ubus/speach_command.cpp
|
||||||
|
# $ENV{SRC_DIR}/src/prog/domod/src/ubus/timers.cpp
|
||||||
|
# $ENV{SRC_DIR}/src/prog/domod/src/helpers/Tokenizer.cpp
|
||||||
|
# $ENV{SRC_DIR}/src/prog/domod/src/helpers/Strings.cpp
|
||||||
|
# $ENV{SRC_DIR}/src/prog/domod/src/main.cpp
|
||||||
|
#)
|
||||||
|
|
||||||
add_executable (domod ${source_files})
|
add_executable (domod ${source_files})
|
||||||
|
|
||||||
target_link_libraries (domod
|
target_link_libraries (domod
|
||||||
LINK_PUBLIC
|
# LINK_PUBLIC
|
||||||
json-cpp
|
# json-cpp
|
||||||
ubus-cpp
|
# ubus-cpp
|
||||||
|
json-c
|
||||||
ubox
|
ubox
|
||||||
ubus
|
ubus
|
||||||
blobmsg_json
|
blobmsg_json
|
||||||
|
|||||||
@@ -27,11 +27,73 @@
|
|||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
|
#include <json-c/json.h>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <stdlib.h> /* getenv */
|
#include <stdlib.h> /* getenv */
|
||||||
#include <libubus.h>
|
#include <libubus.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*! ----------------------------------------------------------------------------
|
||||||
|
* @fn setup_ubus
|
||||||
|
*
|
||||||
|
* @brief Setup the UBus Mechanism.
|
||||||
|
*/
|
||||||
|
extern "C" {
|
||||||
|
static struct ubus_context *setup_ubus (void)
|
||||||
|
{
|
||||||
|
ubus_context *the_ctx;
|
||||||
|
|
||||||
|
if (uloop_init() !=0) {
|
||||||
|
|
||||||
|
fprintf(stderr, "Failed to init Uloop.\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
signal(SIGPIPE, SIG_IGN);
|
||||||
|
|
||||||
|
the_ctx = ubus_connect(NULL);
|
||||||
|
|
||||||
|
if (!the_ctx) {
|
||||||
|
|
||||||
|
fprintf(stderr, "Failed to connect to ubus\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ubus_add_uloop(the_ctx);
|
||||||
|
|
||||||
|
return the_ctx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*! ----------------------------------------------------------------------------
|
||||||
|
* @fn main
|
||||||
|
*
|
||||||
|
* @brief Main function of Domo Daemon.
|
||||||
|
*/
|
||||||
|
int main (void)
|
||||||
|
{
|
||||||
|
int the_ret = 0;
|
||||||
|
struct ubus_context *the_ctx = NULL;
|
||||||
|
|
||||||
|
/* Setup the Ubus context. */
|
||||||
|
the_ctx = setup_ubus();
|
||||||
|
if (the_ctx == NULL) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Main Event Loop. */
|
||||||
|
uloop_run();
|
||||||
|
|
||||||
|
ubus_free(the_ctx);
|
||||||
|
uloop_done();
|
||||||
|
|
||||||
|
return the_ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
#include "ubus/capabilities.h"
|
#include "ubus/capabilities.h"
|
||||||
#include "ubus/capabilities_lights.h"
|
#include "ubus/capabilities_lights.h"
|
||||||
#include "ubus/capabilities_shutters.h"
|
#include "ubus/capabilities_shutters.h"
|
||||||
@@ -46,36 +108,6 @@ extern "C" {
|
|||||||
|
|
||||||
#define kConfigPath "/usr/local/share/domo/"
|
#define kConfigPath "/usr/local/share/domo/"
|
||||||
|
|
||||||
/*! ----------------------------------------------------------------------------
|
|
||||||
* @fn setupUbus
|
|
||||||
*
|
|
||||||
* @brief Setup the UBus Mechanism.
|
|
||||||
*/
|
|
||||||
extern "C" {
|
|
||||||
static struct ubus_context *setupUbus (void)
|
|
||||||
{
|
|
||||||
ubus_context *theCtx;
|
|
||||||
|
|
||||||
if (uloop_init () !=0) {
|
|
||||||
|
|
||||||
fprintf (stderr, "Failed to init Uloop.\n");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
signal (SIGPIPE, SIG_IGN);
|
|
||||||
|
|
||||||
theCtx = ubus_connect (NULL);
|
|
||||||
|
|
||||||
if (!theCtx) {
|
|
||||||
|
|
||||||
fprintf (stderr, "Failed to connect to ubus\n");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ubus_add_uloop (theCtx);
|
|
||||||
|
|
||||||
return theCtx;
|
|
||||||
}
|
|
||||||
} // SetupUbus.
|
} // SetupUbus.
|
||||||
|
|
||||||
|
|
||||||
@@ -148,3 +180,4 @@ int main (void)
|
|||||||
|
|
||||||
return theRet;
|
return theRet;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user