summaryrefslogtreecommitdiff
path: root/attrib
AgeCommit message (Collapse)AuthorFilesLines
2013-06-07attrib: Use GAttrib destroy callback for included searchJohan Hedberg1-3/+1
2013-05-17core: Always specify local LE address type with btioJohan Hedberg1-0/+1
2013-05-02attrib: Get rid of gcharLucas De Marchi5-20/+20
Use plain char instead of gchar.
2013-05-01attrib: Get rid of gintLucas De Marchi3-5/+5
Use plain int instead of gint. In glib gint is always a typedef to int, so it's safe to use it even for callbacks with glib.
2013-04-24attrib: Change match_event return type from gbooleanJefferson Delfes1-7/+7
There is no reason to use gboolean as return type of match_event.
2013-04-24attrib: Change is_response return type from gbooleanJefferson Delfes1-3/+3
There is no reason to use gboolean as return type of is_response.
2013-04-24attrib: Change command->sent type from gbooleanJefferson Delfes1-2/+2
There is no reason to command->sent be gboolean.
2013-04-24attrib: Change GAttrib->stale type from gbooleanJefferson Delfes1-2/+3
There is no reason to GAttrib->stale be gboolean.
2013-04-24attrib: Simplify boolean testsJefferson Delfes2-6/+6
Remove unnecessary TRUE/FALSE in boolean tests.
2013-04-17gatttool: Use error message prefixes consistentlyAlvaro Silva1-51/+56
Replace rl_printf() calls with macros that add appropriate prefixes.
2013-04-17gatttool: Show info message when no primary service is foundEder Ruiz Maria1-0/+10
2013-04-17gatttool: Use bluetoothctl strategy for unix signal handlingEder Ruiz Maria1-0/+83
Now to exit from gatttool at interactive mode, user must use SIGTERM(15) or press Ctrl+D. SIGINT(2) or Ctrl+C just flushes typed characters and breaks line.
2013-04-17gatttool: Use bluetoothctl strategy to handle standard inputEder Ruiz Maria1-7/+19
Use GSource id returned by g_io_add_watch() instead of raw GIOChannel to handle stdin and glib main loop.
2013-04-17gatttool: Remove connecting message from promptAlvaro Silva1-8/+7
When trying to connect, the "connecting" message is not set as prompt anymore. Instead, it is printed just like other status messages and the prompt is kept, allowing the user to send commands while connection is being established.
2013-04-17gatttool: Show connection state using colorAlvaro Silva1-3/+3
When device is connected, the Bluetooth address is shown in blue color.
2013-04-17gatttool: Use bluetoothctl behavior when pressing Enter on empty promptEder Ruiz Maria1-0/+1
2013-04-17gatttool: Replace more usages of printf() with rl_printf()Eder Ruiz Maria1-93/+84
rl_printf() works better with readline than plain printf(), specially on asynchronous callbacks.
2013-04-17gatttool: Fix issues with printf() and readline promptEder Ruiz Maria1-4/+5
Use rl_printf() from bluetoothctl to consistently display messages. This is specially important for asynchronous callbacks, where using printf() may mess up the prompt created by readline.
2013-04-17gatttool: Use GError to propage error messages to callerEder Ruiz Maria4-13/+20
Handle runtime errors outside gatt_connect(), using GError to propagate error messages to caller.
2013-04-09attrib: Use gcc builtin instead of g_atomicLucas De Marchi2-12/+14
g_atomic_* end up using G_STATIC_ASSERT, causing gcc 4.8 to yell due to -Wunused-local-typedefs. /usr/include/glib-2.0/glib/gmacros.h:162:53: error: typedef ‘_GStaticAssertCompileTimeAssertion_2’ locally defined but not used [-Werror=unused-local-typedefs] #define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1] Most of the uses of atomic operations were wrong. They were fixed as well. If we are using atomic operations, reading the variable again later for logging is not an option, we should use the return of the atomic function used to fetch the variable.
2013-04-07gatttool: Remove check for bluetooth address parameter on gatt_connect()Eder Ruiz Maria1-5/+0
This check is more appropriate to be done by callers of gatt_connect(). This is already done on interactive mode in attrib/interactive.c and is now also done in non-interactive mode.
2013-04-07gatttool: Remote address is mandatory for non-interactive gatttoolEder Ruiz Maria1-0/+6
For gatttool non-interactive mode, command line parameter with bluetooth remote address is mandatory.
2013-04-07gatttool: Fix memory leak after parsing input lineJefferson Delfes1-1/+4
The callback is responsible for freeing input line buffer that comes from rl_callback_handler_install().
2013-04-04attrib: Fix status on memory allocation failureAnderson Lizardo1-1/+3
If memory allocation fails, ATT_ECODE_INSUFF_RESOURCES should be reported to the callback.
2013-04-04attrib: Fix coding style in read_char_helper()Anderson Lizardo1-3/+2
2013-04-04attrib: Fix memory leak on low memory conditionAnderson Lizardo1-0/+1
If g_try_new0() fails due to low memory condition, "list" should be freed before returning from primary_all_cb().
2013-04-02attrib: Fix use after free of attribJaganath Kanakkassery1-4/+4
If attrib is freed in cmd->func(), then it will be used if either request or response queue has some data to send. This patch moves calling wake_up_sender() which increases the ref count of attrib so that it wont get freed in cmd->func().
2013-04-02attrib: Remove norequests and noresponses variablesJaganath Kanakkassery1-7/+2
Passing NULL is fine to g_queue_is_empty(), so removing these variables makes the code more readable
2013-03-25gatttool: fix parameter type/name from le to psmJefferson Delfes1-1/+1
The parameter le was changed to psm and its type was modified from boolean to int, but header was unmodified. That change occurred in commit 0cc24599637ed6666469c68d55f4e42ff722e447.
2013-01-29device: Fix invalid memory access during Find IncludedVinicius Costa Gomes1-1/+4
When doing the Find Included Services GATT procedure, the status of the ATT procedure was being ignored, and in the case of a timeout it is possible to crash bluetooth with an invalid memory access. Valgrind log: ==1755== Invalid read of size 8 ==1755== at 0x46971A: find_included_cb (device.c:2964) ==1755== by 0x4465AE: isd_unref (gatt.c:92) ==1755== by 0x446885: find_included_cb (gatt.c:425) ==1755== by 0x448266: disconnect_timeout (gattrib.c:269) ==1755== by 0x4E76BCA: g_timeout_dispatch (in /usr/lib64/libglib-2.0.so.0.3400.2) ==1755== by 0x4E76044: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3400.2) ==1755== by 0x4E76377: g_main_context_iterate.isra.24 (in /usr/lib64/libglib-2.0.so.0.3400.2) ==1755== by 0x4E76771: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3400.2) ==1755== by 0x40A2EE: main (main.c:583) ==1755== Address 0x69530a8 is 8 bytes inside a block of size 64 free'd ==1755== at 0x4C2874F: free (vg_replace_malloc.c:446) ==1755== by 0x40BFA6: service_filter (watch.c:486) ==1755== by 0x40BC6A: message_filter (watch.c:554) ==1755== by 0x5160A1D: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.7.2) ==1755== by 0x40AAB7: message_dispatch (mainloop.c:76) ==1755== by 0x4E76BCA: g_timeout_dispatch (in /usr/lib64/libglib-2.0.so.0.3400.2) ==1755== by 0x4E76044: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3400.2) ==1755== by 0x4E76377: g_main_context_iterate.isra.24 (in /usr/lib64/libglib-2.0.so.0.3400.2) ==1755== by 0x4E76771: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3400.2) ==1755== by 0x40A2EE: main (main.c:583) ==1755== ==1755== Invalid read of size 8 ==1755== at 0x4486D5: g_attrib_get_buffer (gattrib.c:657) ==1755== by 0x4467C5: find_included (gatt.c:363) ==1755== by 0x4465AE: isd_unref (gatt.c:92) ==1755== by 0x446885: find_included_cb (gatt.c:425) ==1755== by 0x448266: disconnect_timeout (gattrib.c:269) ==1755== by 0x4E76BCA: g_timeout_dispatch (in /usr/lib64/libglib-2.0.so.0.3400.2) ==1755== by 0x4E76044: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3400.2) ==1755== by 0x4E76377: g_main_context_iterate.isra.24 (in /usr/lib64/libglib-2.0.so.0.3400.2) ==1755== by 0x4E76771: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3400.2) ==1755== by 0x40A2EE: main (main.c:583) ==1755== Address 0x18 is not stack'd, malloc'd or (recently) free'd ==1755== ==1755== ==1755== Process terminating with default action of signal 11 (SIGSEGV) ==1755== Access not within mapped region at address 0x18 ==1755== at 0x4486D5: g_attrib_get_buffer (gattrib.c:657) ==1755== by 0x4467C5: find_included (gatt.c:363) ==1755== by 0x4465AE: isd_unref (gatt.c:92) ==1755== by 0x446885: find_included_cb (gatt.c:425) ==1755== by 0x448266: disconnect_timeout (gattrib.c:269) ==1755== by 0x4E76BCA: g_timeout_dispatch (in /usr/lib64/libglib-2.0.so.0.3400.2) ==1755== by 0x4E76044: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3400.2) ==1755== by 0x4E76377: g_main_context_iterate.isra.24 (in /usr/lib64/libglib-2.0.so.0.3400.2) ==1755== by 0x4E76771: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3400.2) ==1755== by 0x40A2EE: main (main.c:583)
2013-01-28attrib: Don't attempt to unregister event id 0Luiz Augusto von Dentz1-0/+5
Id 0 is considered invalid so the code should not even try to lookup for it in the event list instead print a warning and return FALSE immediatelly.
2013-01-10attrib: Fix compilation errors when compiled without optimizationAnderson Lizardo1-2/+2
Fix these build errors: attrib/att.c: In function ‘dec_read_by_grp_req’: attrib/att.c:165:10: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] attrib/att.c:170:10: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] attrib/att.c: In function ‘dec_read_by_type_req’: attrib/att.c:393:10: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] attrib/att.c:402:10: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
2013-01-10attrib: Fix remaining references to bluetooth/uuid.hAnderson Lizardo7-9/+8
These headers are not public anymore, so need to use "lib/uuid.h".
2012-12-23attrib: Fix missing config.h includesCristian Rodríguez4-0/+17
2012-12-14attrib: conn_state should be staticJohan Hedberg1-1/+1
2012-12-13core: Remove attribute client APIJohan Hedberg2-1245/+0
There will be a more comprehensive API coming soon and we don't want to have this one around for 5.0 since it'd immediately have to be deprecated.
2012-12-07Revert "Ensure config.h is included by using CPPFLAGS"Johan Hedberg4-0/+16
This reverts commit 8a03376544b046a84301847d1594f6c3674983ff. The patch needs to be split up and the gdbus/ changes were bogus compared to the original commit message. Conflicts: Makefile.am Makefile.obexd profiles/cyclingspeed/cyclingspeed.c profiles/heartrate/heartrate.c src/error.c
2012-12-05Reorder btio.h includesLucas De Marchi4-4/+4
Let "#include <btio/btio.h>" together with other includes using '<' rather than '"'.
2012-12-05Use the entire include path for btio.hLucas De Marchi5-5/+5
2012-12-05Use the entire include path for gdbus.hLucas De Marchi1-1/+1
2012-12-05Ensure config.h is included by using CPPFLAGSLucas De Marchi4-16/+0
Instead of trying to include config.h in each file over the tree and possibly forgetting to include it, give a "-include config.h" argument to the compiler so it's guaranteed that a) it will be included for all source files and b) it will be the first header included. gdbus/ directory is left out, since it would break other projects using it.
2012-12-01gatt: Improve characteristics discoveryPaulo Borges1-1/+1
In the Discover Characteristics by UUID sub-procedure, if a fetched characteristic doesn't matches with the target UUID, all others characteristics in that response were discarded. Because of this, the procedure will make a new request to possibly rediscover the characteristics in the range beyond this last characteristic. At present, this procedure works because the gatt library will send a Read by Type Request starting at the first attribute after the non matching characteristic. This commit makes the rest of the characteristics to be checked for a matching type, which should reduce the number of requests sent during the discovery of characteristics.
2012-12-01gatt: Fix memory leak in characteristic discoveryPaulo Borges1-3/+3
If the Discover Characteristics by UUID sub-procedure has been executed and the first characteristic is not the target, a memory leak occurs. This commit fixes this leak by postponing the allocation to after the UUID verification.
2012-11-13gatt: Update characteristic names translation tableAndrzej Kaczmarek1-0/+23
2012-10-11gattrib: Add support for listening for events for specific handlesVinicius Costa Gomes5-18/+42
We want only the profile that implements a service to be notified of changes on that service. Before this patch, all the registered event notifiers are being called.
2012-10-11attrib: Fix not checking if att_data_list_alloc failsVinicius Costa Gomes1-0/+6
Now that this function may fail in more usual situations (invalid input), we have to check its return value.
2012-10-11att: Fix sending pdu's with invalid dataVinicius Costa Gomes1-0/+3
When encoding an att_data_list we need to make sure that each element lenght of the data list will not exceed 255, because that information will be encoded as a octet later.
2012-10-11att: Replace ATT_MAX_MTU with ATT_MAX_VALUE_LENVinicius Costa Gomes1-1/+1
ATT has the concept that an attribute value has a maximum length and we weren't keeping track of this.
2012-10-11attrib: Remove all the usages of ATT_MAX_MTUVinicius Costa Gomes2-2/+2
This "define" was bogus for two reasons: 1. There's no concept of maximum MTU in the ATT level; 2. It was used as a maximum attribute value length.
2012-10-11gattrib: Fix ignoring the error message when write failsVinicius Costa Gomes1-1/+7
If an error happens during writing to the socket, we should complain that it failed.