[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bluetooth-dev] Role switching

The current implementation of the stack does not allow role switching: the function create_connection() is always called with the argument role_sw = 0x00 (=do not accept master-slave switch), and the function accept_connection_request() is always called 
with argument role=0x01 (=remain slave). Since in some cases role switch can be necessary, this changes could be implemented:

- add an argument to lp_connection_req(), called e.g. accept_switch (0=do not accept role switching, 1=accept role switching), and pass it as the second argument of accept_connection_request()
- add an argument to lp_connection_rsp(), called e.g. remain_slave (0=become master, 1=remain slave), and pass it as the last argument of create_connection()
-add two global variables to l2cap.c, called e.g. accept_switch and remain_slave, which will be passed as arguments to the functions lp_connection_req() and lp_connection_rsp(), and can be manipulated by the upper layers (accept_switch, for example, 
could be passed as an argument to l2ca_connect_req(): if a baseband connection to the remote host does not exist yet, accept_switch is passed as an argument to lp_connect_req(), otherwise it is ignored).

Does this seem too complicated?

Furthermore, the switch_role HCI command could be implemented. It could be something like this:

switch_role(u8[] bd_addr,u8 role)                                               
        c_pkt.type = CMD_PKT;                                                   
        c_pkt.ocf = SWITCH_ROLE;                                                
        c_pkt.ogf = HCI_LP;                                                     
        memcpy(c_pkt.data, bd_addr, 6);                                         
        c_pkt.data[6] = role;                                                   
        c_pkt.len = 7;                                                          
        return send_cmd((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN);   

Fabrizio Gennari          tel. +39 039 203 7816
Philips Research Monza    fax. +39 039 203 7800
via G. Casati 23          fabrizio.gennari@xxxxxxx.com
20052 Monza (MI) Italy    http://www.research.philips.com
To unsubscribe from this list: send the line "unsubscribe bluetooth-dev" in
the body of a message to majordomo@xxxxxxx.com