Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
9b64c43
.clang-tidy: fix typo in settings value
AndreaRicchi Sep 10, 2025
ec72043
connman:services: Add nameservers configuration
EddyTheCo Sep 10, 2025
c329a9f
gdbus_private.hpp: Fix style and modernize warnings
EddyTheCo Sep 10, 2025
8c3cc72
gdbus_private: Add vector_to_as method
EddyTheCo Sep 10, 2025
c11a2b8
Services test: Add set nameservers test
EddyTheCo Sep 10, 2025
eb51fcf
examples:connmanctl: Use register agent
EddyTheCo Sep 10, 2025
341f0e2
Agent: Allow to set the path
EddyTheCo Sep 10, 2025
05ba954
manager: Allow to set agent path
EddyTheCo Sep 10, 2025
8edd678
connman: Remove init
EddyTheCo Sep 10, 2025
7f81db7
services test: register agent
EddyTheCo Sep 10, 2025
9ddbb4f
.gitignore: Remove unused entries
EddyTheCo Sep 10, 2025
f5d74f0
gdbus_private: fix clang tidy warnings
EddyTheCo Sep 10, 2025
98a343b
connman:clock: Fix clang warnings
EddyTheCo Sep 10, 2025
6023ac1
connman:manager: Fix clang warnings
EddyTheCo Sep 10, 2025
0fe0e49
connman:service: Fix clang warnings
EddyTheCo Sep 10, 2025
63a7d32
connman:technology: Fix clang warnings
EddyTheCo Sep 10, 2025
d98b10c
CMakeLists: Set C++ standard 20
EddyTheCo Sep 10, 2025
4fbe9ff
gproxy: Fix naming style
EddyTheCo Sep 10, 2025
deb3066
gdbus: Fix naming style
EddyTheCo Sep 10, 2025
e3de0bc
Remove recreate develop workflow
EddyTheCo Sep 11, 2025
8caa077
Remove check code formatting workflow
EddyTheCo Sep 11, 2025
8090a2d
workflows: Separate release from build&test
EddyTheCo Sep 11, 2025
b2724cb
workflow: Format Markdown
EddyTheCo Sep 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ Checks:
modernize-*,
performance-*,
portability-*,
readability-*
readability-*,
-readability-function-cognitive-complexity

HeaderFilterRegex: 'src'
FormatStyle: file
Expand Down Expand Up @@ -52,9 +53,9 @@ CheckOptions:
- key: readability-identifier-naming.PrivateMethodCase
value: lower_case
- key: readability-identifier-naming.PublicMethodCase
value: camelCase
value: camelBack
- key: readability-identifier-naming.ProtectedMethodCase
value: camelCase
value: camelBack

- key: readability-identifier-naming.ConstexprVariableCase
value: UPPER_CASE
Expand Down
14 changes: 0 additions & 14 deletions .github/workflows/check-code-formatting.yml

This file was deleted.

17 changes: 11 additions & 6 deletions .github/workflows/code-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,31 @@ jobs:
uses: actions/checkout@v4

# --- C/C++ ---
- name: Format C/C++ with clang-format
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang-format
sudo apt-get install -y clang-format pipx jq

- name: Format C/C++ with clang-format
run: |
find . -regex '.*\.\(cpp\|hpp\|cu\|cuh\|c\|h\)' -exec clang-format -style=file -i {} \;

# --- CMake ---
- name: Format CMake files
run: |
sudo apt-get update
sudo apt-get install -y pipx
pipx install cmakelang
find . -regex '.*\.\(cmake\)' -exec cmake-format -i {} \;
find . -name 'CMakeLists.txt' -exec cmake-format -i {} \;

# --- Markdown ---
- name: Format CMake files
run: |
pipx install mdformat
find . -type f -name "*.md" -exec mdformat {} +

# --- JSON ---
- name: Format JSON files
run: |
sudo apt-get update
sudo apt-get install -y jq
find . -regex '.*\.\(json\)' -exec bash -c "jq . {} > {}.tmp && mv {}.tmp {}" \;

# --- Create Pull Request ---
Expand Down
55 changes: 0 additions & 55 deletions .github/workflows/conf-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,58 +74,3 @@ jobs:
path: |
${{ runner.temp }}/common/*

release-deploy:
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
needs: [build_test_package]
runs-on: ubuntu-latest
permissions:
contents: write
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/download-artifact@v4
with:
path: artifacts

- name: Move docs to website dir
run: mv artifacts/common/html github-pages

- name: Clean packages
run: |
rm -rf artifacts/*/_CPack_Packages
mv artifacts/common . || true

- name: Create CHANGELOG
run: |
git log $(git rev-list --tags --skip=1 --max-count=1 | xargs git describe --tags --abbrev=0)..$(git describe --tags --abbrev=0) \
--pretty=format:"* %h - %s (%an, %ar)" > CHANGELOG.md

- name: Package GitHub Page content
working-directory: ${{ github.workspace }}/github-pages
run: |
cmake -E make_directory ${{ runner.temp }}/page-packages
cmake -E tar c ${{ runner.temp }}/page-packages/github-pages.tar -- .

- name: Release
uses: softprops/action-gh-release@v2
with:
files: ./artifacts/*/*
body_path: ./CHANGELOG.md

- uses: actions/upload-artifact@v4
with:
name: github-pages
path: ${{ runner.temp }}/page-packages/*

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

35 changes: 0 additions & 35 deletions .github/workflows/recreate-develop.yml

This file was deleted.

60 changes: 60 additions & 0 deletions .github/workflows/release-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: release-deploy

on:
workflow_run:
workflows: ["push-build-test-lint-release"]
types:
- completed

jobs:
release:
if: ${{ github.event.workflow_run.conclusion == 'success' && startsWith(github.ref, 'refs/tags/v') }}
runs-on: ubuntu-latest
permissions:
contents: write
pages: write
id-token: write

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/download-artifact@v4
with:
path: artifacts

- name: Move docs to website dir
run: mv artifacts/common/html github-pages

- name: Clean packages
run: |
rm -rf artifacts/*/_CPack_Packages
mv artifacts/common . || true

- name: Create CHANGELOG
run: |
git log $(git rev-list --tags --skip=1 --max-count=1 | xargs git describe --tags --abbrev=0)..$(git describe --tags --abbrev=0) \
--pretty=format:"* %h - %s (%an, %ar)" > CHANGELOG.md

- name: Package GitHub Page content
working-directory: ${{ github.workspace }}/github-pages
run: |
cmake -E make_directory ${{ runner.temp }}/page-packages
cmake -E tar c ${{ runner.temp }}/page-packages/github-pages.tar -- .

- name: Release
uses: softprops/action-gh-release@v2
with:
files: ./artifacts/*/*
body_path: ./CHANGELOG.md

- uses: actions/upload-artifact@v4
with:
name: github-pages
path: ${{ runner.temp }}/page-packages/*

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@ build*
doc
tags
CMakeUserPresets.json
dbus_xml/net.connman/*.h
dbus_xml/net.connman/*.c
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ project(
LANGUAGES C CXX)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
include(GNUInstallDirs)
Expand Down
31 changes: 28 additions & 3 deletions examples/connmanctl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,24 @@ auto main() -> int {
props.print();
}
}
}
if (cmd == "agent") {
auto on_register = [arg](const auto success) {
if (success) {
std::cout << "Agent "
<< ((arg == "on") ? "registered" : "unregistered")
<< "\n";
}
};
if (arg == "on") {
manager->registerAgent(manager->internalAgentPath(),
on_register);
} else if (arg == "off") {
manager->unregisterAgent(manager->internalAgentPath(),
on_register);
} else {
std::cout << "Usage: agent on/off\n";
}
} else if (cmd == "services") {
const auto services = manager->services();
if (services.empty()) {
Expand Down Expand Up @@ -222,7 +240,9 @@ auto main() -> int {
!connect) {
std::cout << (connect ? "Connecting" : "Disconnecting")
<< " to service: " << name << "\n";
const auto onConnect = [name, connect](bool success) {
const auto on_connect = [name, connect, &connecting,
&cin_mutex,
&cin_cv](bool success) {
if (success) {
std::cout
<< "Service " << name
Expand All @@ -233,12 +253,17 @@ auto main() -> int {
<< (connect ? " connect" : " disconnect")
<< " to service " << name << "\n";
}
{
const std::unique_lock<std::mutex> lock(cin_mutex);
connecting = false;
}
cin_cv.notify_one();
};
if (connect) {
(*iterator)->connect(onConnect);
(*iterator)->connect(on_connect);
connecting = true;
} else {
(*iterator)->disconnect(onConnect);
(*iterator)->disconnect(on_connect);
}
} else {
std::cout << "Service " << name << " is already "
Expand Down
8 changes: 5 additions & 3 deletions include/amarula/dbus/connman/gagent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <glib.h>

#include <functional>
#include <string>
#include <utility>

namespace Amarula::DBus::G::Connman {
Expand All @@ -11,10 +12,11 @@ class Connman;
class Agent {
GDBusNodeInfo *node_info_;
guint registration_id_{0};
GDBusConnection *connection_{nullptr};
static constexpr const auto AGENT_PATH{"/net/amarula/gconnman/agent"};
GDBusConnection* connection_{nullptr};
std::string path_{"/net/amarula/gconnman/agent"};

explicit Agent(GDBusConnection *connection);
explicit Agent(GDBusConnection* connection,
const std::string& path = std::string());

using RequestInputCallback =
std::function<GVariant *(const gchar *service, GVariant *fields)>;
Expand Down
5 changes: 3 additions & 2 deletions include/amarula/dbus/connman/gmanager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ class Manager : public DBusProxy<ManaProperties> {
void onTechnologiesChanged(OnTechListChangedCallback callback);
void onServicesChanged(OnServListChangedCallback callback);

auto internalAgentPath() const -> std::string { return agent_->path_; };

private:
enum class InputType : std::uint8_t {
InputUnknown = 0,
Expand Down Expand Up @@ -152,8 +154,7 @@ class Manager : public DBusProxy<ManaProperties> {
OnServicesChangedCallback services_changed_cb_{
[](const Manager::ProxyList<Service>&) {}};

explicit Manager(DBus* dbus);
void init();
explicit Manager(DBus* dbus, const std::string& agent_path = std::string());

using DBusProxy::DBusProxy;

Expand Down
3 changes: 3 additions & 0 deletions include/amarula/dbus/connman/gservice.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ struct ServProperties {
Type type_{};
std::optional<std::vector<Security>> security_;
std::optional<std::vector<std::string>> name_servers_;
std::optional<std::vector<std::string>> name_servers_conf_;
std::optional<std::vector<std::string>> domains_;
std::optional<std::vector<std::string>> time_servers_;
bool autoconnect_{false};
Expand Down Expand Up @@ -246,6 +247,8 @@ class Service : public DBusProxy<ServProperties> {
void remove(PropertiesSetCallback callback = nullptr);
void setAutoconnect(bool autoconnect,
PropertiesSetCallback callback = nullptr);
void setNameServers(const std::vector<std::string>& name_servers,
PropertiesSetCallback callback = nullptr);
friend class Manager;
};

Expand Down
4 changes: 2 additions & 2 deletions include/amarula/dbus/connman/gtechnology.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct TechProperties {
[[nodiscard]] auto isPowered() const { return powered_; }
[[nodiscard]] auto isConnected() const { return connected_; }
[[nodiscard]] auto isTethering() const { return tethering_; }
[[nodiscard]] auto getTetheringFreq() const { return tetheringFreq_; }
[[nodiscard]] auto getTetheringFreq() const { return tethering_freq_; }
void print() const;

private:
Expand All @@ -37,7 +37,7 @@ struct TechProperties {
bool tethering_ = false;
std::string name_;
Type type_;
int tetheringFreq_{0};
int tethering_freq_{0};

void update(const gchar* key, GVariant* value);

Expand Down
4 changes: 2 additions & 2 deletions include/amarula/dbus/gdbus.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class DBus {
virtual ~DBus();

void start();
void on_any_async_done();
void on_any_async_start();
void onAnyAsyncDone();
void onAnyAsyncStart();

[[nodiscard]] auto connection() const { return connection_; }
};
Expand Down
Loading