This patch fixes enabling advertising.
It was not possible to enable it if we had server registered
which is on listen_apps list but does not trigger advertising.
This patch introduces static counter to track number of clients
requested advertising.
---
android/gatt.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
@@ -1374,6 +1375,10 @@ static void set_advertising_cb(uint8_t status, void *user_data)send_client_listen_notify(l->client_id,status);+/* In case of success update advertising state*/+if(!status)+advertising_cnt=l->start?1:0;+/**Let'sremoveclientfromthelistintwocases*1.Startfailed
@@ -1418,7 +1423,8 @@ static void handle_client_listen(const void *buf, uint16_t len)}/* If listen is already on just return success*/-if(queue_length(listen_apps)>1){+if(advertising_cnt>0){+advertising_cnt++;status=HAL_STATUS_SUCCESS;gotoreply;}
Hi Łukasz,
On Wednesday 14 of May 2014 13:26:34 Lukasz Rymanowski wrote:
quoted hunk
This patch fixes enabling advertising.
It was not possible to enable it if we had server registered
which is on listen_apps list but does not trigger advertising.
This patch introduces static counter to track number of clients
requested advertising.
---
android/gatt.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
@@ -1374,6 +1375,10 @@ static void set_advertising_cb(uint8_t status, void *user_data)send_client_listen_notify(l->client_id,status);+/* In case of success update advertising state*/+if(!status)+advertising_cnt=l->start?1:0;+/**Let'sremoveclientfromthelistintwocases*1.Startfailed
@@ -1418,7 +1423,8 @@ static void handle_client_listen(const void *buf, uint16_t len)}/* If listen is already on just return success*/-if(queue_length(listen_apps)>1){+if(advertising_cnt>0){+advertising_cnt++;status=HAL_STATUS_SUCCESS;gotoreply;}
This patch fixes enabling advertising.
It was not possible to enable it if we had server registered
which is on listen_apps list but does not trigger advertising.
does this mean we always advertise when registering GATT server? If so, then this is wrong. The GATT server has nothing to do with advertising.
Regards
Marcel
Hi Marcel,
On Wed, May 14, 2014 at 5:12 PM, Marcel Holtmann [off-list ref] wrote:
Hi Lukasz,
quoted
This patch fixes enabling advertising.
It was not possible to enable it if we had server registered
which is on listen_apps list but does not trigger advertising.
does this mean we always advertise when registering GATT server?
No. We just put each server on the listen_apps queue and once remote
device connects to us, this server gets connection callback.
If so, then this is wrong. The GATT server has nothing to do with advertising.
Regards
Marcel
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
This patch fixes enabling advertising.
It was not possible to enable it if we had server registered
which is on listen_apps list but does not trigger advertising.
does this mean we always advertise when registering GATT server?
No. We just put each server on the listen_apps queue and once remote
device connects to us, this server gets connection callback.
this sounds all a bit weird. Did Android get this wrong. We can connect to a remote device and we can still receive GATT server exchange. It has really nothing to do with central or peripheral roles.
Regards
Marcel
Hi Marcel
On 14 May 2014 18:10, Marcel Holtmann [off-list ref] wrote:
Hi Lukasz,
quoted
quoted
quoted
This patch fixes enabling advertising.
It was not possible to enable it if we had server registered
which is on listen_apps list but does not trigger advertising.
does this mean we always advertise when registering GATT server?
No. We just put each server on the listen_apps queue and once remote
device connects to us, this server gets connection callback.
this sounds all a bit weird. Did Android get this wrong. We can connect to a remote device and we can still receive GATT server exchange. It has really nothing to do with central or peripheral roles.
This is bit weird I agree.
The fact is that if we want to send any read/write request to Android
Server App we need to have connection id for the server. So probably
we need to invoke connection cb for all the servers on any
incoming/outgoing connections. For now we do it only for incoming
connections just for testing. There is no single app using Server HAL
so we don't know how this actually should work.