Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
b7a8755
Update Makefile.am
ANANTHMARIMUTHU Feb 3, 2026
fa7d62c
Update Makefile.am
ANANTHMARIMUTHU Feb 3, 2026
ac1ad6f
Update Makefile.am
ANANTHMARIMUTHU Feb 3, 2026
094a1b5
Update Makefile.am
ANANTHMARIMUTHU Feb 3, 2026
c42bffd
Update Makefile.am
ANANTHMARIMUTHU Feb 3, 2026
da04169
Update btrCore.c
ANANTHMARIMUTHU Feb 4, 2026
051a257
Update btrCore.c
ANANTHMARIMUTHU Feb 4, 2026
94c0bc5
Update btrCore.c
ANANTHMARIMUTHU Feb 6, 2026
657a1ae
btmgr t2 event implementation
Feb 11, 2026
0d24655
btmgr t2 event implementation
Feb 11, 2026
9d54a30
btmgr t2 event implementation
Feb 12, 2026
bdc8eb3
btmgr t2 event implementation
Feb 12, 2026
feb3ab0
btmgr t2 event implementation
Feb 12, 2026
29a00f6
btmgr t2 event implementation
Feb 13, 2026
075eb56
btmgr t2 event implementation
Feb 18, 2026
f399967
btmgr t2 event implementation
Feb 18, 2026
ee2cafe
btmgr t2 event implementation
Feb 18, 2026
87da2c1
btmgr t2 event implementation
Feb 19, 2026
0b349e5
btmgr t2 event implementation
Feb 19, 2026
fe5a0e5
btmgr t2 event implementation
Feb 19, 2026
f7241c5
btmgr t2 event implementation
Feb 20, 2026
d63dbe5
btmgr t2 event implementation
Feb 20, 2026
bb9a45c
btmgr t2 event implementation
Feb 20, 2026
44f2bbe
btmgr t2 event implementation
Feb 23, 2026
3cd3608
btmgr t2 event implementation
Feb 23, 2026
645479b
btmgr t2 event implementation
Feb 23, 2026
00a7f3b
btmgr t2 event implementation
Feb 23, 2026
3b60fc4
btmgr t2 event implementation
Feb 24, 2026
b335f9b
btmgr t2 event implementation
Feb 24, 2026
fbbb5f5
btmgr t2 event implementation
Feb 24, 2026
f2dfe10
btmgr t2 event implementation
Feb 24, 2026
99e4f7e
btmgr t2 event implementation
Feb 24, 2026
3fddcc1
btmgr t2 event implementation
Feb 24, 2026
4a83822
btmgr t2 event implementation
Feb 24, 2026
5aa2a84
btmgr t2 event implementation
Feb 24, 2026
f7f90bc
btmgr t2 event implementation
Feb 24, 2026
d80657b
btmgr t2 event implementation
Feb 24, 2026
4d0f520
btmgr t2 event implementation
Feb 24, 2026
ebe7c81
btmgr t2 event implementation
Feb 24, 2026
66d5711
btmgr t2 event implementation
Feb 24, 2026
8f35900
btmgr t2 event implementation
Feb 24, 2026
fbcedeb
btmgr t2 event implementation
Feb 24, 2026
24b18ef
btmgr t2 event implementation
Feb 24, 2026
3ba43e0
btmgr t2 event implementation
Feb 26, 2026
8b97191
btmgr t2 event implementation
Feb 26, 2026
29f9d9e
btmgr t2 event implementation
Feb 26, 2026
f6ff607
btmgr t2 event implementation
Feb 27, 2026
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
2 changes: 2 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ $$ CPPFLAGS=-I/xyz/abc/local/include ./configure --prefix=/xyz/abc/local/ --enab
$$ make V=1
$$ make install

Telemetry: use `--enable-telemetry=no` for standalone CI/L2 builds without telemetry sender libs.

2.3 To configure and use GDBus with Bluez5
-------------------------------------------
$$ PATH=/xyz/abc/local/bin:$PATH PKG_CONFIG_PATH=/xyz/abc/local/lib/x86_64-linux-gnu/pkgconfig CPPFLAGS=-I/xyz/abc/local/include ./configure --prefix=/xyz/abc/local/ --enable-btr-ifce=gdbus_bluez5
Expand Down
30 changes: 30 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ PKG_CHECK_MODULES([DBUS], [dbus-1])
BTR_CORE_SRC="src"
BTR_CORE_TEST="tests"
BTR_CORE_LOGGER_LIBS=" "
TELEMETRY_MSGLIBS=" "
TELEMETRY_CFLAGS=" "
BTR_IFCE_DBUS_BLUEZ4=" "
BTR_IFCE_DBUS_BLUEZ5=" "
BTR_IFCE_GDBUS_BLUEZ5=" "
Expand Down Expand Up @@ -176,6 +178,32 @@ AS_IF([test "x$rdk_logger_ok" = "xyes"], [
fi
], [])

# Check for telemetry sender library
AC_ARG_ENABLE([telemetry],
AS_HELP_STRING([--enable-telemetry],[enable telemetry sender integration (default is yes)]),
[
case "${enableval}" in
yes) enable_telemetry=yes;;
no) enable_telemetry=no;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-telemetry]) ;;
esac
],
[enable_telemetry=yes])

AS_IF([test "x$enable_telemetry" = "xyes"], [
AC_CHECK_HEADERS([telemetry_busmessage_sender.h], [],
AC_MSG_ERROR([telemetry header (telemetry_busmessage_sender.h) not found]))
AC_CHECK_LIB(telemetry_msgsender, t2_init,
telemetry_msgsender_ok=yes, telemetry_msgsender_ok=no
AC_MSG_ERROR([telemetry library (libtelemetry_msgsender) not found]))
if test "x$telemetry_msgsender_ok" = "xyes"; then
TELEMETRY_MSGLIBS="-ltelemetry_msgsender"
TELEMETRY_CFLAGS="-DHAVE_TELEMETRY_MSGSENDER"
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indentation of TELEMETRY_CFLAGS is inconsistent with the previous line. It should align with the TELEMETRY_MSGLIBS assignment above it.

Suggested change
TELEMETRY_CFLAGS="-DHAVE_TELEMETRY_MSGSENDER"
TELEMETRY_CFLAGS="-DHAVE_TELEMETRY_MSGSENDER"

Copilot uses AI. Check for mistakes.
fi
], [
AC_MSG_WARN([telemetry sender integration disabled])
])

AC_ARG_ENABLE([streaming-in],
AS_HELP_STRING([--enable-streaming-in],[enable streaming in (a2dp sink) (default is yes)]),
[
Expand Down Expand Up @@ -250,6 +278,8 @@ AM_CONDITIONAL([GATT_CLIENT], [test x$GATT_CLIENT = xtrue])
AC_SUBST(BTR_CORE_SRC)
AC_SUBST(BTR_CORE_TEST)
AC_SUBST(BTR_CORE_LOGGER_LIBS)
AC_SUBST(TELEMETRY_MSGLIBS)
AC_SUBST(TELEMETRY_CFLAGS)

# Checks for library functions.

Expand Down
60 changes: 60 additions & 0 deletions include/telemetry/bt-telemetry.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* If not stated otherwise in this file or this component's LICENSE file the

Check failure on line 2 in include/telemetry/bt-telemetry.h

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'GPL-2.0' license found in local file 'include/telemetry/bt-telemetry.h' (Match: gnuton/asuswrt-merlin.ng/3006.102.1-beta1, 15 lines, url: https://github.com/gnuton/asuswrt-merlin.ng/archive/refs/tags/3006.102.1-beta1.tar.gz, file: release/src-rt-5.04behnd.4916/userspace/public/include/wifi_hal.h)
* following copyright and licenses apply:
*
* Copyright 2016 RDK Management
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* @file bt-telemetry.h
* Includes telemetry wrapper utilities for Bluetooth Core and Bluetooth Manager
*/

#ifndef __BT_TELEMETRY_H__
#define __BT_TELEMETRY_H__

/**
* @brief Initialize telemetry with component name
*
* @param name Component name for telemetry identification
*/
void telemetry_init(char* name);

/**
* @brief Send marker with string value to T2
*
* @param marker Telemetry marker/event name (use _split suffix for split markers)
* @param value String value to send
*/
void telemetry_event_s(const char* marker, char* value);
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The value parameter should be const char* for consistency with the marker parameter and to indicate that the string is not modified by the function. However, if the underlying t2_event_s API requires a non-const char*, this may be unavoidable. If that's the case, consider adding a comment explaining why the parameter cannot be const.

Suggested change
void telemetry_event_s(const char* marker, char* value);
void telemetry_event_s(const char* marker, const char* value);

Copilot uses AI. Check for mistakes.

/**
* @brief Send marker with integer value to T2 or report count based markers
*
* @param marker Telemetry marker/event name
* @param value Integer value to send
*/
void telemetry_event_d(const char* marker, int value);

/**
* @brief Send marker with double value to T2
*
* @param marker Telemetry marker/event name (use _split suffix for split markers)
* @param value Double value to send
*
* Usage: telemetry_event_f("HWREV_split", 2.2);
*/
void telemetry_event_f(const char* marker, double value);

#endif /* __BT_TELEMETRY_H__ */
11 changes: 6 additions & 5 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ SUBDIRS = bt-ifce
INCLUDE_FILES =

BTRCORE_IFCE_INC = -I${top_srcdir}/include/bt-ifce
AM_CPPFLAGS = -Wall -Werror -I${top_srcdir}/include -I${top_srcdir}/include/logger -I${top_srcdir}/include/safec $(BTRCORE_IFCE_INC)
AM_CPPFLAGS = -Wall -Werror -I${top_srcdir}/include -I${top_srcdir}/include/telemetry -I${top_srcdir}/include/logger -I${top_srcdir}/include/safec $(BTRCORE_IFCE_INC)

if IS_LIBSYSWRAPPER_ENABLED
AM_LDFLAGS = -lsecure_wrapper
Expand All @@ -30,15 +30,16 @@ endif
lib_LTLIBRARIES = libbtrCore.la

if LE_ONLY
libbtrCore_la_SOURCES = btrCore.c btrCore_le.c
libbtrCore_la_SOURCES = btrCore.c btrCore_le.c bt-telemetry.c
else
libbtrCore_la_SOURCES = btrCore.c btrCore_avMedia.c btrCore_le.c
libbtrCore_la_SOURCES = btrCore.c btrCore_avMedia.c btrCore_le.c bt-telemetry.c
endif

libbtrCore_la_CFLAGS = $(INCLUDE_FILES) $(GLIB_CFLAGS) $(LIBSYSWRAPPER_FLAG) $(SAFEC_CFLAGS)
libbtrCore_la_LIBADD = $(GLIB_LIBS) $(BTR_CORE_LOGGER_LIBS) $(SAFEC_LFLAGS) $(top_builddir)/src/bt-ifce/libbtrCoreIfce.la
libbtrCore_la_CFLAGS = $(INCLUDE_FILES) $(GLIB_CFLAGS) $(LIBSYSWRAPPER_FLAG) $(SAFEC_CFLAGS) $(TELEMETRY_CFLAGS)
libbtrCore_la_LIBADD = $(GLIB_LIBS) $(BTR_CORE_LOGGER_LIBS) $(SAFEC_LFLAGS) $(top_builddir)/src/bt-ifce/libbtrCoreIfce.la $(TELEMETRY_MSGLIBS)

# Explicitly declare the header file U want to expose out of libbtrCore.so here
include_HEADERS = $(top_srcdir)/include/btrCoreTypes.h
include_HEADERS += $(top_srcdir)/include/btrCore.h
include_HEADERS += $(top_srcdir)/include/btrCore_service.h
include_HEADERS += $(top_srcdir)/include/telemetry/bt-telemetry.h
9 changes: 5 additions & 4 deletions src/bt-ifce/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ SUBDIRS =

INCLUDE_FILES =


if BTR_IFCE_DBUS_BLUEZ4
BTRCORE_IFCE_SRCS = btrCore_dbus_bluez4.c
BTRCORE_IFCE_BLUEZ_INC = $(DBUS_CFLAGS)
Expand All @@ -40,16 +41,16 @@ endif
endif
endif

AM_CPPFLAGS = -Wall -Werror -I${top_srcdir}/include/logger -I${top_srcdir}/include/safec -I${top_srcdir}/include/bt-ifce $(BTRCORE_IFCE_BLUEZ_INC)
AM_CPPFLAGS = -Wall -Werror -I${top_srcdir}/include/logger -I${top_srcdir}/include/safec -I${top_srcdir}/include/bt-ifce $(BTRCORE_IFCE_BLUEZ_INC) -I${top_srcdir}/include/telemetry

if IS_LIBSYSWRAPPER_ENABLED
AM_LDFLAGS = -lsecure_wrapper
endif

lib_LTLIBRARIES = libbtrCoreIfce.la
libbtrCoreIfce_la_SOURCES = $(BTRCORE_IFCE_SRCS)
libbtrCoreIfce_la_CFLAGS = $(INCLUDE_FILES) $(GLIB_CFLAGS) $(LIBSYSWRAPPER_FLAG) $(SAFEC_CFLAGS)
libbtrCoreIfce_la_LIBADD = $(GLIB_LIBS) $(BTR_CORE_LOGGER_LIBS) $(BTRCORE_IFCE_BLUEZ_LIB) $(UDEV_LIB) $(SAFEC_LFLAGS)
libbtrCoreIfce_la_CFLAGS = $(INCLUDE_FILES) $(GLIB_CFLAGS) $(LIBSYSWRAPPER_FLAG) $(SAFEC_CFLAGS) $(TELEMETRY_CFLAGS)
libbtrCoreIfce_la_LIBADD = $(GLIB_LIBS) $(BTR_CORE_LOGGER_LIBS) $(BTRCORE_IFCE_BLUEZ_LIB) $(UDEV_LIB) $(SAFEC_LFLAGS) $(TELEMETRY_MSGLIBS)

if BTR_IFCE_GDBUS_BLUEZ5
libbtrCoreIfce_la_CFLAGS += $(GIO_CFLAGS) $(GIO_UNIX_CFLAGS)
Expand Down
18 changes: 16 additions & 2 deletions src/bt-ifce/btrCore_gdbus_bluez5.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

/* Interface lib Headers */
#include "btrCore_logger.h"
#include "bt-telemetry.h"

/* Local Headers */
#include "btrCore_bt_ifce.h"
Expand Down Expand Up @@ -896,6 +897,15 @@ btrCore_BTParseDevice (
apstBTDeviceInfo->bConnected = bluez_device1_get_connected(dev_proxy);
BTRCORELOG_INFO ("bConnected = %d\n", apstBTDeviceInfo->bConnected);

{
//This is telemetry log. If we change this print,need to change and configure the telemetry string in xconf server.
char buffer[64];
snprintf(buffer, sizeof(buffer), "bPaired = %d", apstBTDeviceInfo->bPaired);
telemetry_event_s("BTpair_split", buffer);
snprintf(buffer, sizeof(buffer), "bConnected = %d", apstBTDeviceInfo->bConnected);
telemetry_event_s("BTconn_split", buffer);
}

apstBTDeviceInfo->ui16Appearance = bluez_device1_get_appearance(dev_proxy);
BTRCORELOG_INFO ("ui16Appearance = %d\n", apstBTDeviceInfo->ui16Appearance);

Expand Down Expand Up @@ -5337,7 +5347,9 @@ btrCore_BTStartDiscoveryCb (
BTRCORELOG_INFO("Discovery started successfully\n");
}
else {
BTRCORELOG_INFO("Discovery start failed - %s\n",error->message);
//This is telemetry log. If we change this marker name, need to change and configure the telemetry marker in xconf server.
telemetry_event_d("BT_ERR_DiscStartFail", 1);
BTRCORELOG_INFO("Discovery start failed - %s\n", error ? error->message : "Unknown error");
}
}

Expand All @@ -5358,7 +5370,9 @@ btrCore_BTStopDiscoveryCb (
BTRCORELOG_INFO("Discovery stopped successfully\n");
}
else {
BTRCORELOG_INFO("Discovery stop failed - %s\n",error->message);
//This is telemetry log. If we change this marker name, need to change and configure the telemetry marker in xconf server.
telemetry_event_d("BT_ERR_DiscStopFail", 1);
BTRCORELOG_INFO("Discovery stop failed - %s\n", error ? error->message : "Unknown error");
}
}

Expand Down
113 changes: 113 additions & 0 deletions src/bt-telemetry.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/*
* If not stated otherwise in this file or this component's LICENSE file the

Check failure on line 2 in src/bt-telemetry.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'GPL-2.0' license found in local file 'src/bt-telemetry.c' (Match: gnuton/asuswrt-merlin.ng/3006.102.1-beta1, 15 lines, url: https://github.com/gnuton/asuswrt-merlin.ng/archive/refs/tags/3006.102.1-beta1.tar.gz, file: release/src-rt-5.04behnd.4916/userspace/public/include/wifi_hal.h)
* following copyright and licenses apply:
*
* Copyright 2016 RDK Management
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* bt-telemetry.c
* Implementation of telemetry wrapper utilities for Bluetooth Core and Bluetooth Manager
*/

#include <stdio.h>

#ifdef HAVE_TELEMETRY_MSGSENDER
#include <telemetry_busmessage_sender.h>
#endif

#include "btrCore_logger.h"
#include "bt-telemetry.h"

/**
* @brief Initialize telemetry with component name
*/
void telemetry_init(char* name)
{
if (name == NULL) {
BTRCORELOG_ERROR("T2: Failed to initialize telemetry - component name is NULL\n");
return;
}

#ifdef HAVE_TELEMETRY_MSGSENDER
BTRCORELOG_INFO("T2: Initializing telemetry with component name=\"%s\"\n", name);
t2_init(name);
#else
BTRCORELOG_INFO("T2: telemetry sender disabled - telemetry_init skipped for \"%s\"\n", name);
#endif
}

/**
* @brief Send marker with string value to T2
*/
void telemetry_event_s(const char* marker, char* value)
{
if (marker == NULL) {
BTRCORELOG_ERROR("T2: telemetry_event_s - marker is NULL\n");
return;
}
if (value == NULL) {
BTRCORELOG_ERROR("T2: telemetry_event_s - value is NULL\n");
return;
}

#ifdef HAVE_TELEMETRY_MSGSENDER
T2ERROR t2error = t2_event_s(marker, value);
if (t2error != T2ERROR_SUCCESS) {
BTRCORELOG_ERROR("t2_event_s(\"%s\", \"%s\") returned error code %d\n", marker, value, t2error);
}
#else
BTRCORELOG_INFO("T2: telemetry sender disabled - telemetry_event_s skipped for %s\n", marker);
#endif
}

/**
* @brief Send marker with integer value to T2 or report count based markers
*/
void telemetry_event_d(const char* marker, int value)
{
if (marker == NULL) {
BTRCORELOG_ERROR("T2: telemetry_event_d - marker is NULL\n");
return;
}

#ifdef HAVE_TELEMETRY_MSGSENDER
T2ERROR t2error = t2_event_d(marker, value);
if (t2error != T2ERROR_SUCCESS) {
BTRCORELOG_ERROR("t2_event_d(\"%s\", %d) returned error code %d\n", marker, value, t2error);
}
#else
BTRCORELOG_INFO("T2: telemetry sender disabled - telemetry_event_d skipped for %s\n", marker);
#endif
}

/**
* @brief Send marker with double value to T2
*/
void telemetry_event_f(const char* marker, double value)
{
if (marker == NULL) {
BTRCORELOG_ERROR("T2: telemetry_event_f - marker is NULL\n");
return;
}

#ifdef HAVE_TELEMETRY_MSGSENDER
T2ERROR t2error = t2_event_f(marker, value);
if (t2error != T2ERROR_SUCCESS) {
BTRCORELOG_ERROR("t2_event_f(\"%s\", %f) returned error code %d\n", marker, value, t2error);
}
#else
BTRCORELOG_INFO("T2: telemetry sender disabled - telemetry_event_f skipped for %s\n", marker);
#endif
}
Loading
Loading