• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GAPRole_GetParameter函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: DualImageConcept_processStateChangeEvt

/*********************************************************************
 * @fn      DualImageConcept_processStateChangeEvt
 *
 * @brief   Process a pending GAP Role state change event.
 *
 * @param   newState - new state
 *
 * @return  None.
 */
static void DualImageConcept_processStateChangeEvt(gaprole_States_t newState)
{
  switch ( newState )
  {
    case GAPROLE_STARTED:
      {
        uint8_t ownAddress[B_ADDR_LEN];

        GAPRole_GetParameter(GAPROLE_BD_ADDR, ownAddress);

        // Display device address
        Display_print0(dispHandle, 1, 0, Util_convertBdAddr2Str(ownAddress));
        Display_print0(dispHandle, 2, 0, "Initialized");
      }
      break;
      
    case GAPROLE_ADVERTISING:
        Display_print0(dispHandle, 2, 0, "Advertising");
      break;

    case GAPROLE_CONNECTED:
      {
        uint8_t peerAddress[B_ADDR_LEN];

        GAPRole_GetParameter(GAPROLE_CONN_BD_ADDR, peerAddress);

        Display_print0(dispHandle, 2, 0, "Connected");
        Display_print0(dispHandle, 3, 0, Util_convertBdAddr2Str(peerAddress));
      }
      break;

    case GAPROLE_WAITING: 
      Display_print0(dispHandle, 2, 0, "Disconnected");

      // Clear remaining lines
      Display_clearLines(dispHandle, 3, 5);
      break;
      
    case GAPROLE_WAITING_AFTER_TIMEOUT:
      Display_print0(dispHandle, 2, 0, "Timed Out");
      
      // Clear remaining lines
      Display_clearLines(dispHandle, 3, 5);
      break;
      
    case GAPROLE_ERROR:
      break;
      
    default:
      break;
  }
}
开发者ID:dgiovanelli,项目名称:climb.stfirmware_BLEstack2.2,代码行数:61,代码来源:dual_image_concept_img_a.c


示例2: peripheralStateNotificationCB

/*---------------------------------------------------------------------------
* Peripheral role of a state change handler.
* - newState: new state
*-------------------------------------------------------------------------*/
static void peripheralStateNotificationCB( gaprole_States_t newState )
{
  uint16 connHandle = INVALID_CONNHANDLE;

  if ( pmd.gapProfileState != newState )
  {
    switch( newState )
    {
    case GAPROLE_STARTED:
      {
        // Set the system ID from the bd addr
        uint8 systemId[8];              // from #define DEVINFO_SYSTEM_ID_LEN  8
        GAPRole_GetParameter(GAPROLE_BD_ADDR, systemId);

        // shift three bytes up
        systemId[7] = systemId[5];
        systemId[6] = systemId[4];
        systemId[5] = systemId[3];

        // set middle bytes to zero
        systemId[4] = 0;
        systemId[3] = 0;

        updateNameWithAddressInfo();        
      }
      break;      

    case GAPROLE_ADVERTISING:       
      break;

    case GAPROLE_CONNECTED:
      GAPRole_GetParameter( GAPROLE_CONNHANDLE, &connHandle );     

#if defined ( PLUS_BROADCASTER )
      osal_start_timerEx( pmd.taskId, PMD_ADV_IN_CONNECTION_EVT, ADV_IN_CONN_WAIT );
#endif
      break;

    case GAPROLE_WAITING:
      break;

    case GAPROLE_WAITING_AFTER_TIMEOUT:
      break;

    default:
      // do nothing
      break;      
    }
  }

  pmd.gapProfileState = newState;
}
开发者ID:pmd-ian,项目名称:RS-V1.2-Bluetooth,代码行数:56,代码来源:PMD_main.c


示例3: processGapStateChange

/*********************************************************************
 * @fn      processGapStateChange
 *
 * @brief   Change the GAP state.
 *          1. Connected -> disconnect and start advertising
 *          2. Advertising -> stop advertising
 *          3. Disconnected/not advertising -> start advertising
 *
 * @param   none
 *
 * @return  none
 */
static void processGapStateChange(void)
{
  if (gapProfileState != GAPROLE_CONNECTED)
  {
    uint8_t current_adv_enabled_status;
    uint8_t new_adv_enabled_status;

    // Find the current GAP advertising status
    GAPRole_GetParameter(GAPROLE_ADVERT_ENABLED, &current_adv_enabled_status);

    if (current_adv_enabled_status == FALSE)
    {
      new_adv_enabled_status = TRUE;
    }
    else
    {
      new_adv_enabled_status = FALSE;
    }

    // Change the GAP advertisement status to opposite of current status
    GAPRole_SetParameter(GAPROLE_ADVERT_ENABLED, sizeof(uint8_t),
                         &new_adv_enabled_status);
  }

  if (gapProfileState == GAPROLE_CONNECTED)
  {
    uint8_t adv_enabled = TRUE;

    // Disconnect
    GAPRole_TerminateConnection();

    // Start advertising
    GAPRole_SetParameter(GAPROLE_ADVERT_ENABLED, sizeof(uint8_t), &adv_enabled);
  }
}
开发者ID:PolymorphicLabs,项目名称:PML-Firmware,代码行数:47,代码来源:sensortag_keys.c


示例4: updateNameWithAddressInfo

/*---------------------------------------------------------------------------
* Add the set the last part of hte device name to the final bytes of the 
* device address. Useful when mane demo devices are located in the same room.
*-------------------------------------------------------------------------*/
void updateNameWithAddressInfo(void)
{
  //uint8 status;
  uint8 numberString[4];
  uint8 address[6];
  uint8 value;

  //status = GAPRole_GetParameter(GAPROLE_BD_ADDR, address);
  GAPRole_GetParameter(GAPROLE_BD_ADDR, address);

  value = (address[1] & 0xF0) >> 4;
  numberString[0] = getAscii(value);

  value = address[1] & 0x0F;
  numberString[1] = getAscii(value);     

  value = (address[0] & 0xF0) >> 4;
  numberString[2] = getAscii(value);

  value = address[0] & 0x0F;
  numberString[3] = getAscii(value);     

  // Replace "0000" part of "OLP425-0000"
  osal_memcpy(&attDeviceName[7], numberString, 4);
  osal_memcpy(&deviceName[9], numberString, 4);
  
  osal_memcpy(&attDeviceNameNew[7], numberString, 4);
  osal_memcpy(&deviceNameNew[9], numberString, 4);

//  status = GAPRole_SetParameter( GAPROLE_SCAN_RSP_DATA, sizeof ( deviceName ), deviceName );
//  status = GGS_SetParameter( GGS_DEVICE_NAME_ATT, GAP_DEVICE_NAME_LEN - 1, attDeviceName );   

  GAPRole_SetParameter( GAPROLE_SCAN_RSP_DATA, sizeof ( deviceName ), deviceName );
  GGS_SetParameter( GGS_DEVICE_NAME_ATT, GAP_DEVICE_NAME_LEN - 1, attDeviceName );   
}
开发者ID:pmd-ian,项目名称:RS-V1.2-Bluetooth,代码行数:39,代码来源:PMD_main.c


示例5: SNP_terminateConn

/**
 *  SNP_terminateConn
 *
 */
uint8_t SNP_terminateConn(snpTermConnReq_t *pReq)
{
    uint8_t status = SNP_SUCCESS;
  
    if(pReq->option == SNP_GAP_TERM_CONN_IMMEDIATLY)
    {
      uint16_t value;
      GAPRole_GetParameter(GAPROLE_CONNHANDLE, &value);
      if(pReq->connHandle != value)
      {
        return SNP_INVALID_PARAMS;
      }
      else
      {
        HCI_EXT_DisconnectImmedCmd(value);
      }
    }
    else if(pReq->option == SNP_GAP_TERM_CONN_DEFAULT)
    {
      status = GAPRole_TerminateConnection();
    }
    else
    {
      return SNP_INVALID_PARAMS;
    }
    return status;
}
开发者ID:victor-zheng,项目名称:BLE,代码行数:31,代码来源:simpleNP_GAP.c


示例6: simpleBLEBroadcaster_HandleKeys

/*********************************************************************
 * @fn      simpleBLEBroadcaster_HandleKeys
 *
 * @brief   Handles all key events for this device.
 *
 * @param   shift - true if in shift/alt.
 * @param   keys - bit field for key events. Valid entries:
 *                 HAL_KEY_SW_2
 *                 HAL_KEY_SW_1
 *
 * @return  none
 */
static void simpleBLEBroadcaster_HandleKeys( uint8 shift, uint8 keys )
{
  VOID shift;  // Intentionally unreferenced parameter

  if ( keys & HAL_KEY_SW_1 )
  {
    advertData[6]++;
    
    GAPRole_SetParameter( GAPROLE_ADVERT_DATA, sizeof( advertData ), advertData );
  }
  
  if ( keys & HAL_KEY_SW_2 )
  {
    // ressing the right key should toggle advertising on and off
    uint8 current_adv_enabled_status;
    uint8 new_adv_enabled_status;
    
    //Find the current GAP advertisement status
    GAPRole_GetParameter( GAPROLE_ADVERT_ENABLED, &current_adv_enabled_status );
    
    if( current_adv_enabled_status == FALSE )
    {
      new_adv_enabled_status = TRUE;
    }
    else
    {
      new_adv_enabled_status = FALSE;
    }
    
    //change the GAP advertisement status to opposite of current status
    GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &new_adv_enabled_status );
  }
}
开发者ID:billy-wang,项目名称:IOT,代码行数:45,代码来源:simpleBLEBroadcaster.c


示例7: softCmd_HandleKeys

/*********************************************************************
 * @fn      softCmd_HandleKeys
 *
 * @brief   Handles all key events for this device.
 *
 * @param   shift - true if in shift/alt.
 * @param   keys - bit field for key events. Valid entries:
 *                 HAL_KEY_SW_2
 *                 HAL_KEY_SW_1
 *
 * @return  none
 */
static void softCmd_HandleKeys( uint8 shift, uint8 keys )
{
  if ( keys & HAL_KEY_SW_1 )
  {
    // if in a connection send a soft key
    if ( softCmdGapState == GAPROLE_CONNECTED )
    {
      softCmdSend( CMD_ENUM_SOFT_CMD_0 );
    }
  }
  
  if ( keys & HAL_KEY_SW_2 )
  {
    // if not in a connection, toggle advertising on and off
    if( softCmdGapState != GAPROLE_CONNECTED )
    {
      uint8 status;
      
      // toggle GAP advertisement status
      GAPRole_GetParameter( GAPROLE_ADVERT_ENABLED, &status );
      status = !status;
      GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &status );   
    }
    // if in a connection send a soft key
    else
    {
      softCmdSend( CMD_ENUM_SOFT_CMD_1 );
    }
  }
}
开发者ID:JensenSung,项目名称:shred444,代码行数:42,代码来源:softcmd.c


示例8: wechat_get_mac_addr

static void wechat_get_mac_addr(uint8 *mac_address)
{
	uint8 ownAddress[B_ADDR_LEN];
	GAPRole_GetParameter(GAPROLE_BD_ADDR, ownAddress);
	for ( uint8 i = 6; i > 0; )
	{
		i--;
		mac_address[5-i]= ownAddress[i];
	}
}
开发者ID:billy-wang,项目名称:IOT,代码行数:10,代码来源:wechatapp.c


示例9: updateUI

/*********************************************************************
 * @fn      Update UI
 *
 * @brief   Update user interface LCD and LED
 *
 * @param   none
 *
 * @return  none
 */
static void updateUI( void )
{

    LCD_WRITE_STRING( "Thermometer",  HAL_LCD_LINE_1 );

    static uint8 ownAddress[B_ADDR_LEN];

#if (defined HAL_LCD) && (HAL_LCD == TRUE)
    //number of stored measuremnts
    uint16 count =0;

    //store index
    if( thStoreIndex > thStoreStartIndex )
    {
        count = thStoreIndex - thStoreStartIndex;
    }

    if( thStoreStartIndex > thStoreIndex )
    {
        count = ( TH_STORE_MAX-thStoreStartIndex ) + thStoreIndex+1;
    }
#endif

    //State
    switch (gapProfileState)
    {
    case GAPROLE_INIT:
        LCD_WRITE_STRING( "Initialized",  HAL_LCD_LINE_2 );
        break;
    case GAPROLE_STARTED:
        LCD_WRITE_STRING( "Started",  HAL_LCD_LINE_2 );
        GAPRole_GetParameter(GAPROLE_BD_ADDR, ownAddress);
        LCD_WRITE_STRING( bdAddr2Str( ownAddress ),  HAL_LCD_LINE_3 );
        break;
    case GAPROLE_ADVERTISING:
        LCD_WRITE_STRING( "Advertising",  HAL_LCD_LINE_2 );
        LCD_WRITE_STRING( "                  ",  HAL_LCD_LINE_3 );
        LCD_WRITE_STRING_VALUE("Stored", count, 10, HAL_LCD_LINE_3 );
        break;
    case GAPROLE_WAITING:
    case GAPROLE_WAITING_AFTER_TIMEOUT:
        LCD_WRITE_STRING( "Waiting    ",  HAL_LCD_LINE_2 );
        LCD_WRITE_STRING_VALUE("Stored", count, 10, HAL_LCD_LINE_3 );
        break;
    case GAPROLE_CONNECTED:
        LCD_WRITE_STRING( "Connected  ",  HAL_LCD_LINE_2 );
        break;
    case GAPROLE_ERROR:
        LCD_WRITE_STRING( "Error      ",  HAL_LCD_LINE_2 );
        break;
    default:
        break;
    }

}
开发者ID:killets,项目名称:ThermometerBLE,代码行数:64,代码来源:thermometer.c


示例10: SensorTagConnectionControl_update

/*******************************************************************************
 * @fn      SensorTagConnectionControl_update
 *
 * @brief   Update the Connection Control service with the current connection
 *          control settings
 *
 */
void SensorTagConnectionControl_update(void)
{
  uint8_t buf[CCSERVICE_CHAR1_LEN];
  uint16_t connInterval;
  uint16_t connSlaveLatency;
  uint16_t connTimeout; 
  
  // Get the connection control data
  GAPRole_GetParameter(GAPROLE_CONN_INTERVAL, &connInterval);
  GAPRole_GetParameter(GAPROLE_SLAVE_LATENCY, &connSlaveLatency);
  GAPRole_GetParameter(GAPROLE_CONN_TIMEOUT, &connTimeout);

  buf[0] = LO_UINT16(connInterval);
  buf[1] = HI_UINT16(connInterval);
  buf[2] = LO_UINT16(connSlaveLatency);
  buf[3] = HI_UINT16(connSlaveLatency);
  buf[4] = LO_UINT16(connTimeout);
  buf[5] = HI_UINT16(connTimeout);

  CcService_setParameter(CCSERVICE_CHAR1,sizeof(buf),buf);
}
开发者ID:bgloh,项目名称:cc2650LaunchPad,代码行数:28,代码来源:SensorTag_ConnCtrl.c


示例11: FanPeripheralStateNotificationCallBack

static void FanPeripheralStateNotificationCallBack(gaprole_States_t newState)
{
	switch (newState)
	{
		case GAPROLE_STARTED:
			{
				uint8 ownAddress[B_ADDR_LEN];
				uint8 systemId[DEVINFO_SYSTEM_ID_LEN];

				GAPRole_GetParameter(GAPROLE_BD_ADDR, ownAddress);

				// use 6 bytes of device address for 8 bytes of system ID value
				systemId[0] = ownAddress[0];
				systemId[1] = ownAddress[1];
				systemId[2] = ownAddress[2];

				// set middle bytes to zero
				systemId[4] = 0x00;
				systemId[3] = 0x00;

				// shift three bytes up
				systemId[7] = ownAddress[5];
				systemId[6] = ownAddress[4];
				systemId[5] = ownAddress[3];

				DevInfo_SetParameter(DEVINFO_SYSTEM_ID, DEVINFO_SYSTEM_ID_LEN, systemId);
			}
			break;
		case GAPROLE_ADVERTISING:
			break;
		case GAPROLE_CONNECTED:
			FanConnected(fanTaskId);
			break;
		case GAPROLE_WAITING:
			{
				FanDisConnected();
				uint8 advertEnabled = FALSE;
				GAPRole_SetParameter(GAPROLE_ADVERT_ENABLED, sizeof(uint8), &advertEnabled); 
				GAPRole_SetParameter(GAPROLE_SCAN_RSP_DATA, sizeof(scanResponseData), scanResponseData);
				GGS_SetParameter(GGS_DEVICE_NAME_ATT, GAP_DEVICE_NAME_LEN, scanResponseData + 2);
				advertEnabled = TRUE;
				GAPRole_SetParameter(GAPROLE_ADVERT_ENABLED, sizeof(uint8), &advertEnabled);			
			}
			break;
		case GAPROLE_WAITING_AFTER_TIMEOUT:
			break;
		case GAPROLE_ERROR:
			break;
		default:
			break;
	}
};
开发者ID:drme,项目名称:ble-remote,代码行数:52,代码来源:fan.c


示例12: SNP_getStatus

/**
 *  SNP_getStatus
 */
void SNP_getStatus(snpGetStatusCmdRsp_t *pMsg)
{    
  extern snp_ATToperation_t  snp_ATTstore;
  GAPRole_GetParameter(GAPROLE_STATE, &pMsg->gapRoleStatus);
  GAPRole_GetParameter(GAPROLE_ADVERT_ENABLED, &pMsg->advStatus);
  if(pMsg->advStatus == FALSE) 
  {
    // Connectable Advertisement not enabled, Check of non-connectable adv 
    // enabled
    GAPRole_GetParameter(GAPROLE_ADV_NONCONN_ENABLED, &pMsg->advStatus);
  }
  
  pMsg->ATTstatus = snp_ATTstore.validity;
  if(snp_ATTstore.validity)
  {
    pMsg->ATTmethod = snp_ATTstore.method;
  }
  else
  {
    pMsg->ATTmethod = 0;
  }
}
开发者ID:ClarePhang,项目名称:ALL_SmartBatterySwitch_CC2640,代码行数:25,代码来源:simpleNP_DEV.c


示例13: peripheralStateNotificationCB

/*********************************************************************
 * @fn      peripheralStateNotificationCB
 *
 * @brief   Notification from the profile of a state change.
 *
 * @param   newState - new state
 *
 * @return  none
 */
static void peripheralStateNotificationCB( gaprole_States_t newState )
{
  switch ( newState )
  {
    case GAPROLE_STARTED:
      {    
        uint8 ownAddress[B_ADDR_LEN];
        
        GAPRole_GetParameter(GAPROLE_BD_ADDR, ownAddress);
    
        #if (defined HAL_LCD) && (HAL_LCD == TRUE)
          // Display device address 
          HalLcdWriteString( bdAddr2Str( ownAddress ),  HAL_LCD_LINE_2 );
          HalLcdWriteString( "Initialized",  HAL_LCD_LINE_3 );
        #endif // (defined HAL_LCD) && (HAL_LCD == TRUE)    
      }
      break;
      
    case GAPROLE_ADVERTISING:
      {
        #if (defined HAL_LCD) && (HAL_LCD == TRUE)
          HalLcdWriteString( "Advertising",  HAL_LCD_LINE_3 );
        #endif // (defined HAL_LCD) && (HAL_LCD == TRUE)            
      }
      break;

    case GAPROLE_WAITING:
      {
        #if (defined HAL_LCD) && (HAL_LCD == TRUE)
          HalLcdWriteString( "Waiting",  HAL_LCD_LINE_3 );
        #endif // (defined HAL_LCD) && (HAL_LCD == TRUE)            
      }
      break;          

    case GAPROLE_ERROR:
      {
        #if (defined HAL_LCD) && (HAL_LCD == TRUE)
          HalLcdWriteString( "Error",  HAL_LCD_LINE_3 );
        #endif // (defined HAL_LCD) && (HAL_LCD == TRUE)            
      }
      break;      
      
    default:
      {
        #if (defined HAL_LCD) && (HAL_LCD == TRUE)
          HalLcdWriteString( "",  HAL_LCD_LINE_3 );
        #endif // (defined HAL_LCD) && (HAL_LCD == TRUE)     
      }        
      break; 
  }
}
开发者ID:billy-wang,项目名称:IOT,代码行数:60,代码来源:simpleBLEBroadcaster.c


示例14: simpleBLEPeripheral_HandleKeys

/*********************************************************************
* @fn      simpleBLEPeripheral_HandleKeys
*
* @brief   Handles all key events for this device.
*
* @param   shift - true if in shift/alt.
* @param   keys - bit field for key events. Valid entries:
*                 HAL_KEY_SW_2
*                 HAL_KEY_SW_1
*
* @return  none
*/
static void simpleBLEPeripheral_HandleKeys( uint8 shift, uint8 keys )
{
	uint8 SK_Keys = 0;
	
	VOID shift;  // Intentionally unreferenced parameter
	
	if ( keys & HAL_KEY_SW_1 )
	{
		SK_Keys |= SK_KEY_LEFT;
	}
	
	if ( keys & HAL_KEY_SW_2 )
	{
		
		SK_Keys |= SK_KEY_RIGHT;
		
		// if device is not in a connection, pressing the right key should toggle
		// advertising on and off
		// Note:  If PLUS_BROADCASTER is define this condition is ignored and
		//        Device may advertise during connections as well. 
#ifndef PLUS_BROADCASTER  
		if( gapProfileState != GAPROLE_CONNECTED )
		{
#endif // PLUS_BROADCASTER
			uint8 current_adv_enabled_status;
			uint8 new_adv_enabled_status;
			
			//Find the current GAP advertisement status
			GAPRole_GetParameter( GAPROLE_ADVERT_ENABLED, &current_adv_enabled_status );
			
			if( current_adv_enabled_status == FALSE )
			{
				new_adv_enabled_status = TRUE;
			}
			else
			{
				new_adv_enabled_status = FALSE;
			}
			
			//change the GAP advertisement status to opposite of current status
			GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &new_adv_enabled_status );
#ifndef PLUS_BROADCASTER
		}
#endif // PLUS_BROADCASTER
	}
	
	// Set the value of the keys state to the Simple Keys Profile;
	// This will send out a notification of the keys state if enabled
	SK_SetParameter( SK_KEY_ATTR, sizeof ( uint8 ), &SK_Keys );
}
开发者ID:blueoxss,项目名称:Biomimetic-robot,代码行数:62,代码来源:simpleBLEPeripheral.c


示例15: SNP_setAdvData

/**
 *  SNP_setAdvData
 *
 */
uint8_t SNP_setAdvData(snpSetAdvDataReq_t *pReq, uint8_t len)
{
  uint8_t status = 0;
  uint8_t *pDataPtr;
  
  //Device must be started, or the set adv command will failed.
  VOID GAPRole_StartDevice(&SNP_gapRoleCBs);  
  
  if(pReq->type < SNP_ADV_DATA_MAX_IDX)
  {
    pDataPtr = advPtrTable[pReq->type].pData;
    if(pDataPtr)
    {
      ICall_free(advPtrTable[pReq->type].pData);
    }
    advPtrTable[pReq->type].pData = pDataPtr = ICall_malloc(len);
    if(pDataPtr)
    {
      advPtrTable[pReq->type].length = len;
      memcpy(pDataPtr, pReq->pData, len);
      if(pReq->type == SNP_ADV_DATA_SCAN_RSP_IDX)
      {
        status = GAPRole_SetParameter(GAPROLE_SCAN_RSP_DATA, len, pDataPtr);
      }
      else if(pReq->type == SNP_ADV_DATA_NON_CONN_IDX)
      {
        status = GAPRole_SetParameter(GAPROLE_ADVERT_DATA, len, pDataPtr);
      }
      else if(pReq->type == SNP_ADV_DATA_CONN_IDX)
      {
        uint8_t value;
        GAPRole_GetParameter(GAPROLE_STATE, &value);
        if(value == GAPROLE_CONNECTED_ADV)
        {
          status = GAPRole_SetParameter(GAPROLE_ADVERT_DATA, len, pDataPtr);        
        }      
      }
    }
    else
    {
      status = SNP_OUT_OF_RESOURCES;
    }      
  }
  else
  {
    //Error, bad type
    status = SNP_INVALID_PARAMS;
  }  
  return status;
}
开发者ID:victor-zheng,项目名称:BLE,代码行数:54,代码来源:simpleNP_GAP.c


示例16: peripheralStateNotificationCB

/*********************************************************************
 * @fn      peripheralStateNotificationCB
 *
 * @brief   Notification from the profile of a state change.
 *
 * @param   newState - new state
 *
 * @return  none
 */
static void peripheralStateNotificationCB( gaprole_States_t newState )
{
  switch ( newState )
  {
    case GAPROLE_STARTED:
    {
      uint8 ownAddress[B_ADDR_LEN];
      uint8 systemId[DEVINFO_SYSTEM_ID_LEN];

      GAPRole_GetParameter(GAPROLE_BD_ADDR, ownAddress);

      // use 6 bytes of device address for 8 bytes of system ID value
      systemId[0] = ownAddress[0];
      systemId[1] = ownAddress[1];
      systemId[2] = ownAddress[2];

      // set middle bytes to zero
      systemId[4] = 0x00;
      systemId[3] = 0x00;

      // shift three bytes up
      systemId[7] = ownAddress[5];
      systemId[6] = ownAddress[4];
      systemId[5] = ownAddress[3];

      DevInfo_SetParameter(DEVINFO_SYSTEM_ID, DEVINFO_SYSTEM_ID_LEN, systemId);
    }
    break;

    case GAPROLE_ADVERTISING:
	    HalLedSet(HAL_LED_1, HAL_LED_MODE_ON );
	    break;

    case GAPROLE_CONNECTED:

      HalLedSet(HAL_LED_1, HAL_LED_MODE_OFF );
      break;

    case GAPROLE_WAITING:
      // Link terminated intentionally: reset all sensors
      resetSensorSetup();
      break;

	  default:
	    break;
  }

  gapProfileState = newState;
}
开发者ID:AubrCool,项目名称:BLE,代码行数:58,代码来源:SensorTag.c


示例17: SNP_paramUpdateCB

/**
 *  @fn      SNP_paramUpdateCB
 *
 *  @brief   callback to be notify a update of the connection parameters 
 *           has happened.
 *
 *  @param[in]   connInterval     : interval of the connection
 *  @param[in]  connSlaveLatency  : slave latency of the connection
 *  @param[in]  connTimeout       : supervision timeout of the connection
 *
 *  @return  status of the command.
 */
void SNP_paramUpdateCB(uint16_t connInterval,
                       uint16_t connSlaveLatency,
                       uint16_t connTimeout)
{
  uint16_t param[4];
  uint16_t temp;
  GAPRole_GetParameter(GAPROLE_CONNHANDLE, &temp);
  
  param[0] = BUILD_UINT16(LO_UINT16(temp), HI_UINT16(temp)); 
  param[1] = BUILD_UINT16(LO_UINT16(connInterval), HI_UINT16(connInterval)); 
  param[2] = BUILD_UINT16(LO_UINT16(connSlaveLatency), 
                          HI_UINT16(connSlaveLatency));
  param[3] = BUILD_UINT16(LO_UINT16(connTimeout), HI_UINT16(connTimeout));
  SNP_eventToHost_send(SNP_CONN_PARAM_UPDATED_EVT, NULL, sizeof(param),
                       (uint8_t*)param);  
}
开发者ID:victor-zheng,项目名称:BLE,代码行数:28,代码来源:simpleNP_GAP.c


示例18: HeartRate_toggleAdvertising

/*********************************************************************
 * @fn      HeartRate_toggleAdvertising
 *
 * @brief   Toggle advertising state.
 *
 * @param   none
 *
 * @return  status - TRUE if advertising, FALSE otherwise.
 */
static bool HeartRate_toggleAdvertising(void)
{
  uint8_t advState;
  
  // Find the current GAP advertisement status.
  GAPRole_GetParameter(GAPROLE_ADVERT_ENABLED, &advState);
  
  // Get the opposite state.
  advState = !advState;
  
  // Change the GAP advertisement status to opposite of current status.
  GAPRole_SetParameter(GAPROLE_ADVERT_ENABLED, sizeof(uint8_t), 
                       &advState);  
  
  return advState;
}
开发者ID:victor-zheng,项目名称:BLE,代码行数:25,代码来源:heartRate.c


示例19: heartRate_HandleKeys

/*********************************************************************
 * @fn      heartRate_HandleKeys
 *
 * @brief   Handles all key events for this device.
 *
 * @param   shift - true if in shift/alt.
 * @param   keys - bit field for key events. Valid entries:
 *                 HAL_KEY_SW_2
 *                 HAL_KEY_SW_1
 *
 * @return  none
 */
static void heartRate_HandleKeys( uint8 shift, uint8 keys )
{
  if ( keys & HAL_KEY_SW_1 )
  {
    // set simulated measurement flag index
    if (++heartRateFlagsIdx == FLAGS_IDX_MAX)
    {
      heartRateFlagsIdx = 0;
    }
  }
  
  if ( keys & HAL_KEY_SW_2 )
  {
    // if not in a connection, toggle advertising on and off
    if( gapProfileState != GAPROLE_CONNECTED )
    {
      uint8 status;
      
      // Set fast advertising interval for user-initiated connections
      GAP_SetParamValue( TGAP_GEN_DISC_ADV_INT_MIN, DEFAULT_FAST_ADV_INTERVAL );
      GAP_SetParamValue( TGAP_GEN_DISC_ADV_INT_MAX, DEFAULT_FAST_ADV_INTERVAL );
      GAP_SetParamValue( TGAP_GEN_DISC_ADV_MIN, DEFAULT_FAST_ADV_DURATION );

      // toggle GAP advertisement status
      GAPRole_GetParameter( GAPROLE_ADVERT_ENABLED, &status );
      status = !status;
      GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &status );   
      
      // Set state variable
      if (status == FALSE)
      {
        heartRateAdvCancelled = TRUE;
      }
    }
    // if in a connection toggle some the battery state bits for test purposes
    else
    {
      uint8 state;
      
      Batt_GetParameter( BATT_PARAM_STATE, &state );
      state ^= BATT_FLAGS_CR_CRIT;
      Batt_SetParameter( BATT_PARAM_STATE, sizeof( uint8 ), &state );
    }
    
  }
}
开发者ID:JensenSung,项目名称:shred444,代码行数:58,代码来源:heartrate.c


示例20: bloodPressure_HandleKeys

/*********************************************************************
 * @fn      bloodPressure_HandleKeys
 *
 * @brief   Handles all key events for this device.
 *
 * @param   shift - true if in shift/alt.
 * @param   keys - bit field for key events. Valid entries:
 *                 HAL_KEY_SW_2
 *                 HAL_KEY_SW_1
 *
 * @return  none
 */
static void bloodPressure_HandleKeys( uint8 shift, uint8 keys )
{
 
  if ( keys & HAL_KEY_SW_1 )
  {
    // set simulated measurement flag index
    if (++bloodPressureFlagsIdx == FLAGS_IDX_MAX)
    {
      bloodPressureFlagsIdx = 0;
    }
  }
  
  if ( keys & HAL_KEY_SW_2 )
  {
    // if device is not in a connection, pressing the right key should toggle
    // advertising on and off and start a measurement
    if( gapProfileState != GAPROLE_CONNECTED )
    {
      uint8 current_adv_enabled_status;
      uint8 new_adv_enabled_status;
      
      //Find the current GAP advertisement status
      GAPRole_GetParameter( GAPROLE_ADVERT_ENABLED, &current_adv_enabled_status );
      
      if( current_adv_enabled_status == FALSE )
        new_adv_enabled_status = TRUE;
      else
        new_adv_enabled_status = FALSE;
      
      //change the GAP advertisement status to opposite of current status
      GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &new_adv_enabled_status );
      
      //start simulation timer (start --> cuff -->measurement ready)
      osal_start_timerEx( bloodPressureTaskId, BP_TIMER_CUFF_EVT, TIMER_CUFF_PERIOD ); 
      
      //reset cuff count
      cuffCount = 0;
     
    }
    else //connected mode, simulate some measurements
    {
      simulateMeas();
    }      
  }
}
开发者ID:HorseMa,项目名称:BLE-CC254x-1.4.0,代码行数:57,代码来源:bloodPressure.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GAPRole_SetParameter函数代码示例发布时间:2022-05-30
下一篇:
C++ GAErr函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap