Disabling (Hiding) Service

9 posts / 0 new
Last post
meriororen
Offline
Last seen:3 years 8 months ago
Joined:2015-08-12 13:45
Disabling (Hiding) Service

Hi,

Suppose I have two services (let's say CUSTS1 and CUSTS2), I want to be able to hide one of them (or both) service from a
connected client with a flag. E.g., when this flag is on, only make CUSTS1 available to connected client. Is this possible?

I have tried "disabling" CUSTS1 by not calling prf_enable()->app_custs1_enable() during client connection but it doesn't seem
(客户端不断等服务工作discovery) -- client is LightBlue app.

Thank you in advance

Device:
MT_dialog
Offline
Last seen:1 month 1 week ago
Staff
Joined:2015-06-08 11:34
Hi meriororen,

Hi meriororen,

Can you please try thisin the enable request handlerto hide the service:

attmdb_svc_set_permission(custs1_env.shdl, PERM(SVC_HIDE, ENABLE));

and this to re-enable it

attmdb_svc_set_permission(custs1_env.shdl,PERM(SVC, ENABLE));

Thanks MT_dialog

ankitdaf
Offline
Last seen:2 years 8 months ago
Joined:2015-09-03 20:14
If I hide the custs1 service

If I hide the custs1 service with attmdb_svc_set_permission(custs1_env.shdl, PERM(SVC_HIDE, ENABLE)) , can I still access the characteristics of the service on my Android app if I already know the UUID ? Or will I have to unhide it in order to access any characteristics of the service ?

ankitdaf
Offline
Last seen:2 years 8 months ago
Joined:2015-09-03 20:14
Hi Any help here ?

Hi

Any help here ?

Joacimwe
Offline
Last seen:1 year 4 months ago
Guru
Joined:2014-01-14 06:45
You will have to unhide it.

You will have to unhide it.

ankitdaf
Offline
Last seen:2 years 8 months ago
Joined:2015-09-03 20:14
Thanks, I'll try it once I

Thanks, I'll try it once I get hiding to work :)

meriororen
Offline
Last seen:3 years 8 months ago
Joined:2015-08-12 13:45
Hi MT_Dialog,

Hi MT_Dialog,

This is perfect! I never thought that it's been there all the time.

Thanks!

MT_dialog
Offline
Last seen:1 month 1 week ago
Staff
Joined:2015-06-08 11:34
Hi meriororen,

Hi meriororen,

Glad it suits you.

Thanks MT_dialog

ankitdaf
Offline
Last seen:2 years 8 months ago
Joined:2015-09-03 20:14
Hi

Hi

I am using attmdb_svc_set_permission(custs1_env.shdl, PERM(SVC_HIDE, ENABLE)); like so :

---
void user_app_connection(uint8_t connection_idx, struct gapc_connection_req_ind const *param)
{
if (app_env[connection_idx].conidx != GAP_INVALID_CONIDX)
{
attmdb_svc_set_permission(custs1_env.shdl, PERM(SVC_HIDE, ENABLE));

---
This does not seem to work, the service isn't being hidden (I am using nRF Master Control Panel to check). What am I doing wrong ?