示例#1
0
/*********************************************************************
 * @fn      ProxPeriph_AddService
 *
 * @brief   Initializes the Proximity Peripheral service by
 *          registering GATT attributes with the GATT server.
 *          Only call this function once.
 *
 * @param   services - services to add. This is a bit map and can
 *                     contain more than one service.
 *
 * @return   Success or Failure
 */
bStatus_t ProxPeriph_AddService( uint32 services )
{
  uint8 status = SUCCESS;

  if ( services & PP_LINK_LOSS_SERVICE )
  {
    // Register Link Loss attribute list and CBs with GATT Server App  
    status = GATTServApp_RegisterService( linkLossAttrTbl, GATT_NUM_ATTRS( linkLossAttrTbl ),
                                          GATT_MAX_ENCRYPT_KEY_SIZE, &proxPeriphCBs );
  }

  if ( ( status == SUCCESS ) && ( services & PP_IM_ALETR_SERVICE ) )
  {
    // Register Link Loss attribute list and CBs with GATT Server App
    status = GATTServApp_RegisterService( imAlertAttrTbl, GATT_NUM_ATTRS( imAlertAttrTbl ),
                                          GATT_MAX_ENCRYPT_KEY_SIZE, &proxPeriphCBs );
  }
  
  if ( ( status == SUCCESS )  && ( services & PP_TX_PWR_LEVEL_SERVICE ) )
  {
    // Register Tx Power Level attribute list and CBs with GATT Server App
    status = GATTServApp_RegisterService( txPwrLevelAttrTbl, GATT_NUM_ATTRS( txPwrLevelAttrTbl ),
                                          GATT_MAX_ENCRYPT_KEY_SIZE, &proxPeriphCBs );
  }

  return ( status );
}
示例#2
0
/**
 * @fn      UartProfile_AddService
 *
 * @brief   Initializes the Simple Profile service by registering
 *          GATT attributes with the GATT server.
 *
 * @param   services - services to add. This is a bit map and can
 *                     contain more than one service.
 *
 * @return  Success or Failure
 */
bStatus_t UartProfile_AddService(void)
{
	uint8	status = SUCCESS;

	// Initialize Client Characteristic Configuration attributes
	GATTServApp_InitCharCfg(INVALID_CONNHANDLE, uartServ2CharCfg);

	// Register with Link DB to receive link status change callback
	linkDB_Register(UartProfile_HandleConnStatusCB);

	// Register GATT attribute list and CBs with GATT Server App
	GATTServApp_RegisterService(uartServ1AttrTbl, GATT_NUM_ATTRS(uartServ1AttrTbl), &uartServ1CBs);
	GATTServApp_RegisterService(uartServ2AttrTbl, GATT_NUM_ATTRS(uartServ2AttrTbl), &uartServ2CBs);
	return (status);
}
/*********************************************************************
 * @fn      SimpleProfile_AddService
 *
 * @brief   Initializes the Simple Profile service by registering
 *          GATT attributes with the GATT server.
 *
 * @param   services - services to add. This is a bit map and can
 *                     contain more than one service.
 *
 * @return  Success or Failure
 */
bStatus_t SimpleProfile_AddService( uint32 services )
{
  uint8 status = SUCCESS;

  // Allocate Client Characteristic Configuration table
  simpleProfileChar4Config = (gattCharCfg_t *)osal_mem_alloc( sizeof(gattCharCfg_t) *
                                                              linkDBNumConns );
  if ( simpleProfileChar4Config == NULL )
  {
    return ( bleMemAllocError );
  }

  // Initialize Client Characteristic Configuration attributes
  GATTServApp_InitCharCfg( INVALID_CONNHANDLE, simpleProfileChar4Config );

  // Register with Link DB to receive link status change callback
  VOID linkDB_Register( simpleProfile_HandleConnStatusCB );

  if ( services & SIMPLEPROFILE_SERVICE )
  {
    // Register GATT attribute list and CBs with GATT Server App
    status = GATTServApp_RegisterService( simpleProfileAttrTbl,
                                          GATT_NUM_ATTRS( simpleProfileAttrTbl ),
                                          GATT_MIN_ENCRYPT_KEY_SIZE,
                                          &simpleProfileCBs );
  }

  return ( status );
}
示例#4
0
/*********************************************************************
 * @fn      SK_AddService
 *
 * @brief   Initializes the Simple Key service by registering
 *          GATT attributes with the GATT server.
 *
 * @param   services - services to add. This is a bit map and can
 *                     contain more than one service.
 *
 * @return  Success or Failure
 */
bStatus_t SK_AddService( uint32 services )
{
  uint8 status = SUCCESS;

  // Initialize Client Characteristic Configuration attributes
  for ( uint8 i = 0; i < GATT_MAX_NUM_CONN; i++ )
  {
    skConfig[i].connHandle = INVALID_CONNHANDLE;
    skConfig[i].value = GATT_CFG_NO_OPERATION;

  }

  // Register with Link DB to receive link status change callback
  VOID linkDB_Register( sk_HandleConnStatusCB );  
  
  
  if ( services & SK_SERVICE )
  {
    // Register GATT attribute list and CBs with GATT Server App
    status = GATTServApp_RegisterService( simplekeysAttrTbl, GATT_NUM_ATTRS( simplekeysAttrTbl ),
                                          sk_ReadAttrCB, sk_WriteAttrCB, NULL );
  }

  return ( status );
}
/*********************************************************************
 * @fn      OADTarget_addService
 *
 * @brief   Initializes the OAD Service by registering GATT attributes
 *          with the GATT server. Only call this function once.
 *
 * @return  The return value of GATTServApp_RegisterForMsg().
 */
bStatus_t OADTarget_addService(void)
{
  // Allocate Client Characteristic Configuration table
  oadImgIdentifyConfig = (gattCharCfg_t *)ICall_malloc(sizeof(gattCharCfg_t) *
                                                       linkDBNumConns);
  if (oadImgIdentifyConfig == NULL)
  {
    return (bleMemAllocError);
  }
  
  // Allocate Client Characteristic Configuration table
  oadImgBlockConfig = (gattCharCfg_t *)ICall_malloc(sizeof(gattCharCfg_t) *
                                                    linkDBNumConns);
  
  if (oadImgBlockConfig == NULL)
  {
    // Free already allocated data
    ICall_free(oadImgIdentifyConfig);
    
    return (bleMemAllocError);
  }
  
  // Initialize Client Characteristic Configuration attributes
  GATTServApp_InitCharCfg(INVALID_CONNHANDLE, oadImgIdentifyConfig);
  GATTServApp_InitCharCfg(INVALID_CONNHANDLE, oadImgBlockConfig);

  return GATTServApp_RegisterService(oadAttrTbl, GATT_NUM_ATTRS(oadAttrTbl), 
                                     GATT_MAX_ENCRYPT_KEY_SIZE, &oadCBs);
}
示例#6
0
/*********************************************************************
 * @fn      DevInfo_AddService
 *
 * @brief   Initializes the Device Information service by registering
 *          GATT attributes with the GATT server.
 *
 * @return  Success or Failure
 */
bStatus_t DevInfo_AddService( void )
{
  // Register GATT attribute list and CBs with GATT Server App
  return GATTServApp_RegisterService( devInfoAttrTbl,
                                      GATT_NUM_ATTRS( devInfoAttrTbl ),
                                      &devInfoCBs );
}
示例#7
0
/*********************************************************************
 * @fn      HeartRate_AddService
 *
 * @brief   Initializes the Heart Rate service by registering
 *          GATT attributes with the GATT server.
 *
 * @param   services - services to add. This is a bit map and can
 *                     contain more than one service.
 *
 * @return  Success or Failure
 */
bStatus_t HeartRate_AddService(uint32 services)
{
  uint8 status;

  // Allocate Client Characteristic Configuration table
  heartRateMeasClientCharCfg = (gattCharCfg_t *)ICall_malloc( sizeof(gattCharCfg_t) *
                                                              linkDBNumConns );
  if ( heartRateMeasClientCharCfg == NULL )
  {
    return ( bleMemAllocError );
  }
  
  // Initialize Client Characteristic Configuration attributes.
  GATTServApp_InitCharCfg(INVALID_CONNHANDLE, heartRateMeasClientCharCfg);

  if (services & HEARTRATE_SERVICE)
  {
    // Register GATT attribute list and CBs with GATT Server App.
    status = GATTServApp_RegisterService(heartRateAttrTbl, 
                                         GATT_NUM_ATTRS(heartRateAttrTbl),
                                         GATT_MAX_ENCRYPT_KEY_SIZE,
                                         &heartRateCBs);
  }
  else
  {
    status = SUCCESS;
  }

  return (status);
}
示例#8
0
/*********************************************************************
 * @fn      SK_AddService
 *
 * @brief   Initializes the Simple Key service by registering
 *          GATT attributes with the GATT server.
 *
 * @param   services - services to add. This is a bit map and can
 *                     contain more than one service.
 *
 * @return  Success or Failure
 */
bStatus_t SK_AddService(uint32 services)
{
  uint8 status = SUCCESS;

  // Allocate Client Characteristic Configuration table
  skConfig = (gattCharCfg_t *)ICall_malloc(sizeof(gattCharCfg_t) *
                                            linkDBNumConns);
  if (skConfig == NULL)
  {
    return (bleMemAllocError);
  }
  
  // Initialize Client Characteristic Configuration attributes
  GATTServApp_InitCharCfg(INVALID_CONNHANDLE, skConfig); 
  
  if (services & SK_SERVICE)
  {
    // Register GATT attribute list and CBs with GATT Server App
    status = GATTServApp_RegisterService(simplekeysAttrTbl, 
                                         GATT_NUM_ATTRS(simplekeysAttrTbl),
                                         GATT_MAX_ENCRYPT_KEY_SIZE,
                                         &skCBs);
  }

  return (status);
}
/*********************************************************************
 * @fn      Audio_AddService
 *
 * @brief   Initializes the Audio Profile service by registering
 *          GATT attributes with the GATT server.
 *
 * @return  SUCCESS, bleMemAllocError, or return value of
 *          GATTServApp_RegisterService
 */
bStatus_t Audio_AddService(void)
{
  uint8 status = SUCCESS;

  // Allocate Audio Cmd Client Characteristic Configuration table
  audioProfileStartConfig = (gattCharCfg_t *)ICall_malloc(sizeof(gattCharCfg_t)*
                                                          linkDBNumConns );
  if (audioProfileStartConfig == NULL)
  {
    return bleMemAllocError;
  }

  // Initialize Audio Cmd Client Characteristic Configuration attributes
  GATTServApp_InitCharCfg(INVALID_CONNHANDLE, audioProfileStartConfig);

  // Allocate Audio Stream Client Characteristic Configuration table
  audioProfileAudioConfig = (gattCharCfg_t *)ICall_malloc(sizeof(gattCharCfg_t)*
                                                          linkDBNumConns);
  if (audioProfileAudioConfig == NULL)
  {
    return bleMemAllocError;
  }

  // Initialize Audio Stream Client Characteristic Configuration attributes
  GATTServApp_InitCharCfg(INVALID_CONNHANDLE, audioProfileAudioConfig);

  // Register GATT attribute list and CBs with GATT Server App
  status = GATTServApp_RegisterService(audioProfileAttrTbl,
                                       GATT_NUM_ATTRS(audioProfileAttrTbl),
                                       GATT_MAX_ENCRYPT_KEY_SIZE,
                                       &audioProfileCBs);

  return status;
}
/*********************************************************************
 * @fn      ClimbProfile_AddService
 *
 * @brief   Initializes the Simple Profile service by registering
 *          GATT attributes with the GATT server.
 *
 * @param   services - services to add. This is a bit map and can
 *                     contain more than one service.
 *
 * @return  Success or Failure
 */
bStatus_t ClimbProfile_AddService( uint32 services )
{
  uint8 status;

  // Allocate Client Characteristic Configuration table
  climbProfileChar1Config = (gattCharCfg_t *)ICall_malloc( sizeof(gattCharCfg_t) *
                                                            linkDBNumConns );
  if ( climbProfileChar1Config == NULL )
  {     
    return ( bleMemAllocError );
  }
  
  // Initialize Client Characteristic Configuration attributes
  GATTServApp_InitCharCfg( INVALID_CONNHANDLE, climbProfileChar1Config );

  if ( services & CLIMBPROFILE_SERVICE )
  {
    // Register GATT attribute list and CBs with GATT Server App
    status = GATTServApp_RegisterService( climbProfileAttrTbl,
                                          GATT_NUM_ATTRS( climbProfileAttrTbl ),
                                          GATT_MAX_ENCRYPT_KEY_SIZE,
                                          &climbProfileCBs );
  }
  else
  {
    status = SUCCESS;
  }

  return ( status );
}
/*********************************************************************
 * @fn      SimpleProfile_AddService
 *
 * @brief   Initializes the Simple Profile service by registering
 *          GATT attributes with the GATT server.
 *
 * @param   services - services to add. This is a bit map and can
 *                     contain more than one service.
 *
 * @return  Success or Failure
 */
bStatus_t ExampleService_AddService( void )
{
 static uint8 excute_time =0;
 uint8 status = SUCCESS;
 
 if(excute_time > 0)          //make sure it is only excuted once, because everytime it excuted, it add the attr to the list ,no matter wheather it exists in it.
   return(status);
 else
   excute_time++;
 
 HalLcdWriteStringValue("excute_time",excute_time,10,HAL_LCD_LINE_6);
  


  // Initialize Client Characteristic Configuration attributes
  GATTServApp_InitCharCfg( INVALID_CONNHANDLE, simpleProfileChar2Config );

  // Register with Link DB to receive link status change callback
  VOID linkDB_Register( simpleProfile_HandleConnStatusCB );  
  

    // Register GATT attribute list and CBs with GATT Server App
    status = GATTServApp_RegisterService( simpleProfileAttrTbl, 
                                          GATT_NUM_ATTRS( simpleProfileAttrTbl ),
                                          &simpleProfileCBs );


  return ( status );
}
示例#12
0
/*********************************************************************
 * @fn      Reset_addService
 *
 * @brief   Initializes the OAD Reset service by registering
 *          GATT attributes with the GATT server.
 *
 * @param   none
 *
 * @return  Success or Failure
 */
uint8_t Reset_addService(void)
{
    // Register GATT attribute list and CBs with GATT Server App
    return GATTServApp_RegisterService(resetServiceAttrTbl,
                                       GATT_NUM_ATTRS(resetServiceAttrTbl),
                                       GATT_MAX_ENCRYPT_KEY_SIZE,
                                       &resetServiceCBs);
}
/*********************************************************************
 * @fn      Display_addService
 *
 * @brief   Initializes the Sensor Profile service by registering
 *          GATT attributes with the GATT server.
 *
 * @return  Success or Failure
 */
bStatus_t Display_addService(void)
{  
  // Register GATT attribute list and CBs with GATT Server App
  return GATTServApp_RegisterService( sensorAttrTable,
                                      GATT_NUM_ATTRS (sensorAttrTable),
                                      GATT_MAX_ENCRYPT_KEY_SIZE,
                                      &sensorCBs );
}
示例#14
0
/*********************************************************************
 * @fn      Test_AddService
 *
 * @brief   Initializes the Test Profile service by registering
 *          GATT attributes with the GATT server.
 *
 * @param   services - services to add. This is a bit map and can
 *                     contain more than one service.
 *
 * @return  Success or Failure
 */
bStatus_t Test_AddService(void)
{
  // Register GATT attribute list and CBs with GATT Server App
  return GATTServApp_RegisterService( testAttrTable,
                                      GATT_NUM_ATTRS (testAttrTable),
                                      GATT_MAX_ENCRYPT_KEY_SIZE,
                                      &testCBs );
}
示例#15
0
/*********************************************************************
 * @fn      proxReporter_AddService
 *
 * @brief   Initializes the Proximity Reporter service by
 *          registering GATT attributes with the GATT server.
 *          Only call this function once.
 *
 * @param   services - services to add. This is a bit map and can
 *                     contain more than one service.
 *
 * @return   Success or Failure
 */
bStatus_t ProxReporter_AddService( uint32 services )
{
  uint8 status = SUCCESS;

  if ( services & PP_LINK_LOSS_SERVICE )
  {
    // Register Link Loss attribute list and CBs with GATT Server App  
    status = GATTServApp_RegisterService( linkLossAttrTbl, 
                                          GATT_NUM_ATTRS( linkLossAttrTbl ),
                                          GATT_MAX_ENCRYPT_KEY_SIZE,
                                          &proxReporterCBs );
  }

  if ( ( status == SUCCESS ) && ( services & PP_IM_ALETR_SERVICE ) )
  {
    // Register Link Loss attribute list and CBs with GATT Server App
    status = GATTServApp_RegisterService( imAlertAttrTbl, 
                                          GATT_NUM_ATTRS( imAlertAttrTbl ),
                                          GATT_MAX_ENCRYPT_KEY_SIZE,
                                          &proxReporterCBs );
  }
  
  if ( ( status == SUCCESS )  && ( services & PP_TX_PWR_LEVEL_SERVICE ) )
  {
    // Allocate Client Characteristic Configuration table
    txPwrLevelConfig = (gattCharCfg_t *)osal_mem_alloc( sizeof(gattCharCfg_t) *
                                                        linkDBNumConns );
    if ( txPwrLevelConfig != NULL )
    {
      // Initialize Client Characteristic Configuration attributes
      GATTServApp_InitCharCfg( INVALID_CONNHANDLE, txPwrLevelConfig ); 
      
      // Register Tx Power Level attribute list and CBs with GATT Server App
      status = GATTServApp_RegisterService( txPwrLevelAttrTbl, 
                                            GATT_NUM_ATTRS( txPwrLevelAttrTbl ),
                                            GATT_MAX_ENCRYPT_KEY_SIZE,
                                            &proxReporterCBs );
    }
    else
    {
      status = bleMemAllocError;
    }
  }

  return ( status );
}
示例#16
0
/*********************************************************************
 * @fn      Lights_addService
 *
 * @brief   Initializes the Lights Profile service by registering
 *          GATT attributes with the GATT server.
 *
 * @return  Success or Failure
 */
bStatus_t Lights_addService(void)
{

  // Register GATT attribute list and CBs with GATT Server App
  return GATTServApp_RegisterService(lightsProfileAttrTbl, 
                                     GATT_NUM_ATTRS(lightsProfileAttrTbl),
                                     GATT_MAX_ENCRYPT_KEY_SIZE,
                                     &lightsProfileCBs);
}
示例#17
0
/*********************************************************************
 * @fn      Glucose_AddService
 *
 * @brief   Initializes the Glucose   service by registering
 *          GATT attributes with the GATT server.
 *
 * @param   services - services to add. This is a bit map and can
 *                     contain more than one service.
 *
 * @return  Success or Failure
 */
bStatus_t Glucose_AddService(uint32 services)
{
    uint8 status;

    // Allocate Client Characteristic Configuration table
    glucoseMeasConfig = (gattCharCfg_t *)osal_mem_alloc( sizeof(gattCharCfg_t) *
                        linkDBNumConns );
    if ( glucoseMeasConfig == NULL )
    {
        return ( bleMemAllocError );
    }

    // Allocate Client Characteristic Configuration table
    glucoseContextConfig = (gattCharCfg_t *)osal_mem_alloc( sizeof(gattCharCfg_t) *
                           linkDBNumConns );
    if ( glucoseContextConfig == NULL )
    {
        // Free already allocated data
        osal_mem_free( glucoseMeasConfig );

        return ( bleMemAllocError );
    }

    // Allocate Client Characteristic Configuration table
    glucoseControlConfig = (gattCharCfg_t *)osal_mem_alloc( sizeof(gattCharCfg_t) *
                           linkDBNumConns );
    if ( glucoseControlConfig == NULL )
    {
        // Free already allocated data
        osal_mem_free( glucoseMeasConfig );
        osal_mem_free( glucoseContextConfig );

        return ( bleMemAllocError );
    }

    // Initialize Client Characteristic Configuration attributes.
    GATTServApp_InitCharCfg(INVALID_CONNHANDLE, glucoseMeasConfig);
    GATTServApp_InitCharCfg(INVALID_CONNHANDLE, glucoseContextConfig);
    GATTServApp_InitCharCfg(INVALID_CONNHANDLE, glucoseControlConfig);

    if (services & GLUCOSE_SERVICE)
    {
        // Register GATT attribute list and CBs with GATT Server App.
        status = GATTServApp_RegisterService(glucoseAttrTbl,
                                             GATT_NUM_ATTRS(glucoseAttrTbl),
                                             GATT_MAX_ENCRYPT_KEY_SIZE,
                                             &glucoseCBs);
    }
    else
    {
        status = SUCCESS;
    }

    return (status);
}
示例#18
0
/*********************************************************************
 * @fn      OADTarget_AddService
 *
 * @brief   Initializes the OAD Service by registering GATT attributes
 *          with the GATT server. Only call this function once.
 *
 * @return  The return value of GATTServApp_RegisterForMsg().
 */
bStatus_t OADTarget_AddService(void)
{
  // Initialize Client Characteristic Configuration attributes
  GATTServApp_InitCharCfg( INVALID_CONNHANDLE, oadImgIdentifyConfig );
  GATTServApp_InitCharCfg( INVALID_CONNHANDLE, oadImgBlockConfig );

  // Register with Link DB to receive link status change callback
  VOID linkDB_Register( oadHandleConnStatusCB );

  return GATTServApp_RegisterService(oadAttrTbl, GATT_NUM_ATTRS(oadAttrTbl), &oadCBs);
}
示例#19
0
/*
 * TxPower_AddService- Initializes the TxPower service by registering
 *          GATT attributes with the GATT server.
 *
 */
bStatus_t TxPower_AddService( void )
{
  uint8_t status;

  // Register GATT attribute list and CBs with GATT Server App
  status = GATTServApp_RegisterService( Tx_PowerAttrTbl, 
                                        GATT_NUM_ATTRS( Tx_PowerAttrTbl ),
                                        GATT_MAX_ENCRYPT_KEY_SIZE,
                                        &Tx_PowerCBs );

  return ( status );
}
示例#20
0
/**
 * @fn      Batt_AddService
 *
 * @brief   Initializes the Battery Service by registering
 *          GATT attributes with the GATT server.
 *
 * @return  Success or Failure
 */
bStatus_t Batt_AddService(void)
{
	uint8 status = SUCCESS;

	// Initialize Client Characteristic Configuration attributes
	GATTServApp_InitCharCfg(INVALID_CONNHANDLE, battLevelClientCharCfg);

	// Register GATT attribute list and CBs with GATT Server App
	status = GATTServApp_RegisterService(battAttrTbl, GATT_NUM_ATTRS(battAttrTbl), &battCBs);

	return (status);
}
/*********************************************************************
 * @fn      CmdEnum_AddService
 *
 * @brief   Initializes the Command Enumeration Service by registering
 *          GATT attributes with the GATT server.
 *
 * @return  Success or Failure
 */
bStatus_t CmdEnum_AddService( void )
{
  uint8 status = SUCCESS;

  // Register GATT attribute list and CBs with GATT Server App
  status = GATTServApp_RegisterService( cmdEnumAttrTbl, 
                                        GATT_NUM_ATTRS( cmdEnumAttrTbl ),
                                        GATT_MAX_ENCRYPT_KEY_SIZE,
                                        &cmdEnumCBs );

  return ( status );
}
示例#22
0
/*********************************************************************
 * @fn      ScanParam_AddService
 *
 * @brief   Initializes the Battery Service by registering
 *          GATT attributes with the GATT server.
 *
 * @return  Success or Failure
 */
bStatus_t ScanParam_AddService( void )
{
  uint8 status = SUCCESS;

  // Initialize Client Characteristic Configuration attributes
  GATTServApp_InitCharCfg( INVALID_CONNHANDLE, scanParamRefreshClientCharCfg );

  // Register GATT attribute list and CBs with GATT Server App
  status = GATTServApp_RegisterService( scanParamAttrTbl, GATT_NUM_ATTRS( scanParamAttrTbl ),
                                        &scanParamCBs );

  return ( status );
}
示例#23
0
bStatus_t buttonsProfile_AddService(uint32 services)
{
	uint8 status = SUCCESS;

	VOID linkDB_Register(buttonsProfile_HandleConnStatusCB);

	if (services & BLE_BUTTONS_PROFILE_SERVICE)
	{
		status = GATTServApp_RegisterService(buttonsProfileAttributesTable, GATT_NUM_ATTRS(buttonsProfileAttributesTable), &buttonsProfileCBs);
	}

	return (status);
};
示例#24
0
/*********************************************************************
 * @fn      Battery_AddService
 *
 * @brief   Initializes the Batter service by registering GATT attributes 
 *          with the GATT server. Only call this function once.
 *
 * @param   services - services to add. This is a bit map and can
 *                     contain more than one service.
 *
 * @return  success or failure
 */
bStatus_t Battery_AddService( uint32 services )
{
  uint8 status = SUCCESS;

  if ( services & BATTERY_SERVICE )
  {
    // Register GATT attribute list and CBs with GATT Server App  
    status = GATTServApp_RegisterService( batteryAttrTbl, GATT_NUM_ATTRS( batteryAttrTbl ), 
                                          bat_ReadAttrCB, NULL, NULL );
  }

  return ( status );
}
示例#25
0
/*********************************************************************
 * @fn      proxReporter_AddService
 *
 * @brief   Initializes the Proximity Reporter service by
 *          registering GATT attributes with the GATT server.
 *          Only call this function once.
 *
 * @param   services - services to add. This is a bit map and can
 *                     contain more than one service.
 *
 * @return   Success or Failure
 */
bStatus_t ProxReporter_AddService( uint32 services )
{
  uint8 status = SUCCESS;

  if ( services & PP_LINK_LOSS_SERVICE )
  {
    // Register Link Loss attribute list and CBs with GATT Server App  
    status = GATTServApp_RegisterService( linkLossAttrTbl, 
                                          GATT_NUM_ATTRS( linkLossAttrTbl ),
                                          &proxReporterCBs );
  }

  if ( ( status == SUCCESS ) && ( services & PP_IM_ALETR_SERVICE ) )
  {
    // Register Link Loss attribute list and CBs with GATT Server App
    status = GATTServApp_RegisterService( imAlertAttrTbl, 
                                          GATT_NUM_ATTRS( imAlertAttrTbl ),
                                          &proxReporterCBs );
  }
  
  if ( ( status == SUCCESS )  && ( services & PP_TX_PWR_LEVEL_SERVICE ) )
  {
    
    // Initialize Client Characteristic Configuration attributes
    GATTServApp_InitCharCfg( INVALID_CONNHANDLE, txPwrLevelConfig );

    // Register with Link DB to receive link status change callback
    VOID linkDB_Register( proxReporter_HandleConnStatusCB );  

    
    // Register Tx Power Level attribute list and CBs with GATT Server App
    status = GATTServApp_RegisterService( txPwrLevelAttrTbl, 
                                          GATT_NUM_ATTRS( txPwrLevelAttrTbl ),
                                          &proxReporterCBs );
  }

  return ( status );
}
示例#26
0
/*********************************************************************
 * @fn      Temp_AddService
 *
 * @brief   Initializes the Heart Rate service by registering
 *          GATT attributes with the GATT server.
 *
 * @param   services - services to add. This is a bit map and can
 *                     contain more than one service.
 *
 * @return  Success or Failure
 */
bStatus_t Temp_AddService( uint32 services )
{
    uint8 status = SUCCESS;

    VOID linkDB_Register( Temp_HandleConnStatusCB );
    
    GATTServApp_InitCharCfg( INVALID_CONNHANDLE, valueConfigCoordinates );    
    
    status = GATTServApp_RegisterService( tempAttrTbl, 
      GATT_NUM_ATTRS( tempAttrTbl ),
      &tempCBs );

    return ( status );
}
/*********************************************************************
 * @fn      FindMeTarget_AddService
 *
 * @brief   Initializes the Simple Profile service by registering
 *          GATT attributes with the GATT server.
 *
 * @param   services - services to add. This is a bit map and can
 *                     contain more than one service.
 *
 * @return  Success or Failure
 */
bStatus_t FindMeTarget_AddService( uint32 services )
{
  uint8 status = SUCCESS;

  if ( services & FINDME_IM_ALERT_SERVICE )
  {
    // Register GATT attribute list and CBs with GATT Server App
    status = GATTServApp_RegisterService( findMeTargetAttrTbl, 
                                          GATT_NUM_ATTRS( findMeTargetAttrTbl ),
                                          GATT_MAX_ENCRYPT_KEY_SIZE,
                                          &findMeCBs );
  }

  return ( status );
}
 /*********************************************************************
 * @fn      HidMouse_AddService
 *
 * @brief   Initializes the Simple Profile service by registering
 *          GATT attributes with the GATT server.
 *
 * @param   services - services to add. This is a bit map and can
 *                     contain more than one service.
 *
 * @return  Success or Failure
 */
bStatus_t HidMouse_AddService(uint32 services)
{
  uint8 status = SUCCESS;

  if (services & HIDMOUSE_SERVICE)
  {
    // Register GATT attribute list and CBs with GATT Server App
    status = GATTServApp_RegisterService(hidMouseAttrTbl, 
                                         GATT_NUM_ATTRS(hidMouseAttrTbl),
                                         GATT_MAX_ENCRYPT_KEY_SIZE,
                                         &hidMouseCBs);
  }

  return (status);
}
/*********************************************************************
 * @fn      Barometer_AddService
 *
 * @brief   Initializes the Sensor Profile service by registering
 *          GATT attributes with the GATT server.
 *
 * @return  Success or Failure
 */
bStatus_t Barometer_AddService( void )
{
  bStatus_t ret;

  ret = util_initCharacteristicConfig(&sensorDataConfig);
  if (ret != SUCCESS)
  {
    return ret;
  }

  // Register GATT attribute list and CBs with GATT Server App
  return GATTServApp_RegisterService( sensorAttrTable,
                                      GATT_NUM_ATTRS (sensorAttrTable),
                                      GATT_MAX_ENCRYPT_KEY_SIZE,
                                      &sensorCBs );
}
示例#30
0
/*********************************************************************
* @fn      CcService_AddService
*
* @brief   Initializes the service by registering
*          GATT attributes with the GATT server.
*
* @return  Success or Failure
*/
bStatus_t CcService_AddService( void )
{
  bStatus_t ret;

  ret = util_initCharacteristicConfig(&ccDataConfig);
  if (ret != SUCCESS)
  {
    return ret;
  }

  // Register GATT attribute list and CBs with GATT Server App
  return GATTServApp_RegisterService( ccServiceAttrTbl,
                                      GATT_NUM_ATTRS (ccServiceAttrTbl),
                                      GATT_MAX_ENCRYPT_KEY_SIZE,
                                      &ccServiceCBs );
}