Example #1
0
void AppServerConnCback(dmEvt_t *pDmEvt)
{
  bool_t      bonded;
  appDbHdl_t  dbHdl;
  dmConnId_t  connId = (dmConnId_t) pDmEvt->hdr.param;
  
  if (pDmEvt->hdr.event == DM_CONN_OPEN_IND)
  {
    /* set up CCC table with uninitialized (all zero) values */
    AttsCccInitTable(connId, NULL);
  }
  else if (pDmEvt->hdr.event == DM_SEC_PAIR_CMPL_IND)
  {
    bonded = ((pDmEvt->pairCmpl.auth & DM_AUTH_BOND_FLAG) == DM_AUTH_BOND_FLAG);
    
    /* if going from unbonded to bonded update CCC table */
    if (bonded && (appCheckBonded(connId) == FALSE))
    {
      if ((dbHdl = AppDbGetHdl(connId)) != APP_DB_HDL_NONE)
      {
        AttsCccInitTable(connId, AppDbGetCccTbl(dbHdl));
      }
    }      
  }
  else if (pDmEvt->hdr.event == DM_SEC_ENCRYPT_IND)
  {
    /* if going from unbonded to bonded update CCC table */
    if (pDmEvt->encryptInd.usingLtk && appCheckBondByLtk(connId))
    {
      if ((dbHdl = AppDbGetHdl(connId)) != APP_DB_HDL_NONE)
      {
        AttsCccInitTable(connId, AppDbGetCccTbl(dbHdl));
      }
    }    
  }
  else if (pDmEvt->hdr.event == DM_CONN_CLOSE_IND)
  {
    /* clear CCC table on connection close */
    AttsCccClearTable(connId);
  }
}
Example #2
0
/*
 * AttServerInitDeInitCback callback is used to Initialize/Deinitialize
 * the CCC Table of the ATT Server when a remote peer requests to Open
 * or Close the connection.
 */
 void BLE::connection_handler(dmEvt_t* dm_event)
 {
    dmConnId_t connId = (dmConnId_t)dm_event->hdr.param;

    switch (dm_event->hdr.event) {
        case DM_CONN_OPEN_IND:
            /* set up CCC table with uninitialized (all zero) values */
            AttsCccInitTable(connId, NULL);
            break;
        case DM_CONN_CLOSE_IND:
            /* clear CCC table on connection close */
            AttsCccClearTable(connId);
            break;
        default:
            break;
    }
}
Example #3
0
static void AppServerConnCback(dmEvt_t *pDmEvt)
{
  dmConnId_t connId = (dmConnId_t)pDmEvt->hdr.param;

  switch (pDmEvt->hdr.event)
  {
    case DM_CONN_OPEN_IND:
      /* set up CCC table with uninitialized (all zero) values */
      AttsCccInitTable(connId, NULL);
      break;
    case DM_CONN_CLOSE_IND:
      /* clear CCC table on connection close */
      AttsCccClearTable(connId);
      break;
    default:
      break;
  }
}