summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStephen Crane <steve.crane@rococosoft.com>2003-05-20 11:33:53 +0000
committerStephen Crane <steve.crane@rococosoft.com>2003-05-20 11:33:53 +0000
commit2c375c1f2c5cff353e2f767ac14f8251452392e9 (patch)
tree445b94bdb1ff1a0e39262dd2ea38007d03ed316b /src
parent6cd70af01a46b7e543c50d0646b877c38b3257f4 (diff)
add role switch
Diffstat (limited to 'src')
-rw-r--r--src/hci.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/hci.c b/src/hci.c
index e6cf48c4..6d313d21 100644
--- a/src/hci.c
+++ b/src/hci.c
@@ -1125,3 +1125,27 @@ int hci_encrypt_link(int dd, uint16_t handle, int on, int to)
}
return 0;
}
+
+int hci_switch_role(int dd, bdaddr_t peer, int role, int to)
+{
+ switch_role_cp cp;
+ evt_role_change rp;
+ struct hci_request rq;
+
+ cp.bdaddr = peer;
+ cp.role = role;
+ rq.ogf = OGF_LINK_POLICY;
+ rq.ocf = OCF_SWITCH_ROLE;
+ rq.cparam = &cp;
+ rq.clen = SWITCH_ROLE_CP_SIZE;
+ rq.rparam = &rp;
+ rq.rlen = EVT_ROLE_CHANGE_SIZE;
+ rq.event = EVT_ROLE_CHANGE;
+ if (hci_send_req(dd, &rq, to) < 0)
+ return -1;
+ if (rp.status) {
+ errno = EIO;
+ return -1;
+ }
+ return 0;
+}