本文整理汇总了C++中GAPRole_GetParameter函数的典型用法代码示例。如果您正苦于以下问题:C++ GAPRole_GetParameter函数的具体用法?C++ GAPRole_GetParameter怎么用?C++ GAPRole_GetParameter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GAPRole_GetParameter函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
示例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;
}
示例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, ¤t_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);
}
}
示例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 );
}
示例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;
}
示例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, ¤t_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 );
}
}
示例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 );
}
}
}
示例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];
}
}
示例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;
}
}
示例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);
}
示例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;
}
};
示例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;
}
}
示例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;
}
}
示例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, ¤t_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 );
}
示例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;
}