Skip to content

Commit

Permalink
Add binc_application_get_adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
abqjln committed Jan 5, 2025
1 parent 3132834 commit b72576b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions binc/application.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ static const gchar descriptor_xml[] =
"</node>";

struct binc_application {
const Adapter *adapter;
char *path;
guint registration_id;
GDBusConnection *connection;
Expand Down Expand Up @@ -578,6 +579,7 @@ Application *binc_create_application(const Adapter *adapter) {
Application *application = g_new0(Application, 1);
application->connection = binc_adapter_get_dbus_connection(adapter);
application->path = g_strdup_printf("/org/bluez/bincapp_%s_%s", binc_adapter_get_name(adapter), random_str);
application->adapter = adapter;
application->services = g_hash_table_new_full(g_str_hash,
g_str_equal,
g_free,
Expand Down Expand Up @@ -1213,6 +1215,11 @@ const char *binc_application_get_path(const Application *application) {
return application->path;
}

const Adapter *binc_application_get_adapter(const Application *application) {
g_assert(application != NULL);
return application->adapter;
}

void binc_application_set_char_read_cb(Application *application, onLocalCharacteristicRead callback) {
g_assert(application != NULL);
g_assert(callback != NULL);
Expand Down
2 changes: 2 additions & 0 deletions binc/application.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ void binc_application_free(Application *application);

const char *binc_application_get_path(const Application *application);

const Adapter *binc_application_get_adapter(const Application *application);

int binc_application_add_service(Application *application, const char *service_uuid);

int binc_application_add_characteristic(Application *application, const char *service_uuid,
Expand Down

0 comments on commit b72576b

Please sign in to comment.