zclearn
zclearn
2016-05-30 08:21

蓝牙4.0一主两从通信,其中一个从节点断开,怎样通知另一个从节点?

2

蓝牙一主两从连接好以后,其中一个从节点断开,主节点发送0x0c告知另外一个从节点,代码如下

```case GAP_LINK_TERMINATED_EVENT:
{
simpleBLEState = BLE_STATE_IDLE;
uint8 connectionhandle[2] = {pEvent->linkTerminate.connectionHandle >> 8, pEvent->linkTerminate.connectionHandle};
simpleBLEConnHandle[connectionhandle[1]] = GAP_CONNHANDLE_INIT;
simpleBLERssi = FALSE;
simpleBLEDiscState = BLE_DISC_STATE_IDLE;
simpleBLECharHdl = 0;

    simpleBLEProcedureInProgress = FALSE;

    LCD_WRITE_STRING( "Disconnected", HAL_LCD_LINE_1 );
    LCD_WRITE_STRING_VALUE( "Reason:", pEvent->linkTerminate.reason,
                            10, HAL_LCD_LINE_2 );

    attWriteReq_t req;

    req.handle = 0x0035;
    req.len = 1;

    //req.offset = 0;
    req.sig = 0;
    req.cmd = 0;

   //osal_memcpy(req.value,ValueBuf,SIMPLEPROFILE_CHAR6_LEN);
    req.value[0] = 0x0C;
    //HalUARTWrite(0,&req.value[0],1);
    GATT_WriteCharValue( ShangweiConnectHandle, &req, simpleBLETaskId ); 
    //uint8 success = GATT_WriteCharValue( ShangweiConnectHandle, &req, simpleBLETaskId ); 
    //HalUARTWrite(0,&success,8);
  }
  break;
想在这个事件里面通知另外一个从节点,但是貌似发不出去,应该怎么通知呢?
  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答