当前位置: 首页>>代码示例>>C++>>正文


C++ GATTServApp_RegisterService函数代码示例

本文整理汇总了C++中GATTServApp_RegisterService函数的典型用法代码示例。如果您正苦于以下问题:C++ GATTServApp_RegisterService函数的具体用法?C++ GATTServApp_RegisterService怎么用?C++ GATTServApp_RegisterService使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GATTServApp_RegisterService函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ProxPeriph_AddService

/*********************************************************************
 * @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 );
}
开发者ID:DRuffer,项目名称:coinForth,代码行数:39,代码来源:proxperiph.c

示例2: UartProfile_AddService

/**
 * @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);
}
开发者ID:wythe-lin,项目名称:ZTKBLE,代码行数:26,代码来源:uartserv.c

示例3: SimpleProfile_AddService

/*********************************************************************
 * @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 );
}
开发者ID:aidaima,项目名称:RemoteControl-Car,代码行数:40,代码来源:simpleGATTprofile_Bridge.c

示例4: SK_AddService

/*********************************************************************
 * @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 );
}
开发者ID:JensenSung,项目名称:shred444,代码行数:36,代码来源:simplekeys.c

示例5: OADTarget_addService

/*********************************************************************
 * @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);
}
开发者ID:ClarePhang,项目名称:ALL_SmartBatterySwitch_CC2640,代码行数:37,代码来源:oad_target.c

示例6: DevInfo_AddService

/*********************************************************************
 * @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 );
}
开发者ID:AubrCool,项目名称:BLE,代码行数:15,代码来源:devinfoservice-st.c

示例7: HeartRate_AddService

/*********************************************************************
 * @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);
}
开发者ID:wzyy2,项目名称:ECG-BLE,代码行数:41,代码来源:heartrateservice.c

示例8: SK_AddService

/*********************************************************************
 * @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);
}
开发者ID:ClarePhang,项目名称:BLE_cc2650,代码行数:37,代码来源:simplekeys.c

示例9: Audio_AddService

/*********************************************************************
 * @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;
}
开发者ID:dgiovanelli,项目名称:climb.stfirmware_BLEstack2.2,代码行数:43,代码来源:audio_profile.c

示例10: ClimbProfile_AddService

/*********************************************************************
 * @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 );
}
开发者ID:smartcommunitylab,项目名称:sco.climb.driverapp,代码行数:41,代码来源:CLIMBProfile.c

示例11: ExampleService_AddService

/*********************************************************************
 * @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 );
}
开发者ID:androdenpark,项目名称:Ti-Wireless-Chip-Demo,代码行数:40,代码来源:exampleService.c

示例12: Reset_addService

/*********************************************************************
 * @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);
}
开发者ID:victor-zheng,项目名称:BLE,代码行数:18,代码来源:oadResetService.c

示例13: Display_addService

/*********************************************************************
 * @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 );
}
开发者ID:ClarePhang,项目名称:ALL_SmartBatterySwitch_CC2640,代码行数:16,代码来源:displayservice.c

示例14: Test_AddService

/*********************************************************************
 * @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 );
}
开发者ID:aidaima,项目名称:RemoteControl-Car,代码行数:19,代码来源:testservice.c

示例15: ProxReporter_AddService

/*********************************************************************
 * @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 );
}
开发者ID:DRuffer,项目名称:coinForth,代码行数:58,代码来源:proxreporter.c


注:本文中的GATTServApp_RegisterService函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。