本文整理汇总了C++中GAPRole_SetParameter函数的典型用法代码示例。如果您正苦于以下问题:C++ GAPRole_SetParameter函数的具体用法?C++ GAPRole_SetParameter怎么用?C++ GAPRole_SetParameter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GAPRole_SetParameter函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
开发者ID:PolymorphicLabs,项目名称:PML-Firmware,代码行数:47,代码来源:sensortag_keys.c
示例2: 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 );
}
}
开发者ID:billy-wang,项目名称:IOT,代码行数:45,代码来源:simpleBLEBroadcaster.c
示例3: simpleTopology_init
/*********************************************************************
* @fn simpleTopology_init
*
* @brief Called during initialization and contains application
* specific initialization (ie. hardware initialization/setup,
* table initialization, power up notification, etc), and
* profile initialization/setup.
*
* @param None.
*
* @return None.
*/
static void simpleTopology_init(void)
{
// ******************************************************************
// N0 STACK API CALLS CAN OCCUR BEFORE THIS CALL TO ICall_registerApp
// ******************************************************************
// Register the current thread as an ICall dispatcher application
// so that the application can send and receive messages.
ICall_registerApp(&selfEntity, &sem);
// Create an RTOS queue for message from profile to be sent to app.
appMsgQueue = Util_constructQueue(&appMsg);
Util_constructClock(&scanClock, SensorTagMultiRoleTest_scanStartHandler,
SCAN_EVENT_PERIOD, SCAN_EVENT_PERIOD, TRUE, SCAN_EVENT);
// Setup the GAP
{
/*-------------------PERIPHERAL-------------------*/
uint16_t advInt = DEFAULT_ADVERTISING_INTERVAL;
GAP_SetParamValue(TGAP_LIM_DISC_ADV_INT_MIN, advInt);
GAP_SetParamValue(TGAP_LIM_DISC_ADV_INT_MAX, advInt);
GAP_SetParamValue(TGAP_GEN_DISC_ADV_INT_MIN, advInt);
GAP_SetParamValue(TGAP_GEN_DISC_ADV_INT_MAX, advInt);
GAP_SetParamValue(TGAP_LIM_ADV_TIMEOUT, ADV_DURATION);
/*-------------------CENTRAL-------------------*/
GAP_SetParamValue(TGAP_GEN_DISC_SCAN, DEFAULT_SCAN_DURATION);
GAP_SetParamValue(TGAP_GEN_DISC_SCAN_INT, DEFAULT_SCAN_INT);
GAP_SetParamValue(TGAP_GEN_DISC_SCAN_WIND, DEFAULT_SCAN_WIND);
GAP_SetParamValue(TGAP_LIM_DISC_SCAN_INT, DEFAULT_SCAN_INT);
GAP_SetParamValue(TGAP_LIM_DISC_SCAN_WIND, DEFAULT_SCAN_WIND);
}
// Setup the GAP Role Profile
{
/*--------PERIPHERAL-------------*/
// For all hardware platforms, device starts advertising upon initialization
uint8_t initialAdvertEnable = FALSE;
// By setting this to zero, the device will go into the waiting state after
// being discoverable for 30.72 second, and will not being advertising again
// until the enabler is set back to TRUE
uint16_t advertOffTime = 0;
GAPRole_SetParameter(GAPROLE_ADVERT_ENABLED, sizeof(uint8_t),
&initialAdvertEnable, NULL);
GAPRole_SetParameter(GAPROLE_ADVERT_OFF_TIME, sizeof(uint16_t),
&advertOffTime, NULL);
GAPRole_SetParameter(GAPROLE_ADVERT_DATA, sizeof(advertData), advertData, NULL);
// Register with GAP for HCI/Host messages
GAP_RegisterForMsgs(selfEntity);
}
VOID GAPRole_StartDevice(&simpleTopology_gapRoleCBs);
}
开发者ID:chr1s77,项目名称:OldRUThSensorTag,代码行数:68,代码来源:multi_role.c
示例4: SNP_stopAdv
/**
* @fn SNP_stopAdv
*
*/
uint8_t SNP_stopAdv(void)
{
//Disable Advertising.
uint8_t start = FALSE;
GAPRole_SetParameter(GAPROLE_ADVERT_ENABLED, sizeof(uint8_t),
&start);
GAPRole_SetParameter(GAPROLE_ADV_NONCONN_ENABLED, sizeof(uint8_t),
&start);
return SNP_SUCCESS;
}
开发者ID:victor-zheng,项目名称:BLE,代码行数:14,代码来源:simpleNP_GAP.c
示例5: CyclingSensor_handleResetEvt
/*********************************************************************
* @fn CyclingSensor_handleResetEvt
*
* @brief "soft" resets the device. This puts the device into a waiting
* state, clears all white list, bonding and GATT service handle
* information about previously previously connected devices.
*
* @param none
*
* @return none
*/
static void CyclingSensor_handleResetEvt(void)
{
static uint8_t isWLClear = FALSE;
if (gapProfileState == GAPROLE_CONNECTED)
{
// Exit the connection.
GAPRole_TerminateConnection();
}
else if (gapProfileState == GAPROLE_ADVERTISING)
{
uint8_t value = FALSE;
// Turn off advertising.
GAPRole_SetParameter(GAPROLE_ADVERT_ENABLED, sizeof(uint8_t), &value);
}
else if (USING_WHITE_LIST == TRUE && isWLClear == FALSE)
{
// Set internal white list flag to true.
isWLClear = TRUE;
// Disable white list use with advertising.
sensorUsingWhiteList = FALSE;
// Temporary variable.
uint8_t value = GAP_FILTER_POLICY_ALL;
// Turn off white list filter policy.
GAPRole_SetParameter(GAPROLE_ADV_FILTER_POLICY, sizeof(uint8_t), &value);
// Clear the white list.
HCI_LE_ClearWhiteListCmd();
}
else if ((gapProfileState == GAPROLE_STARTED) ||
(gapProfileState == GAPROLE_WAITING) ||
(gapProfileState == GAPROLE_WAITING_AFTER_TIMEOUT))
{
uint8_t eraseBonds = TRUE;
// Stop the periodic expirations of the reset clock.
Util_stopClock(&resetClock);
// Set internal white list flag to false for next reset event.
isWLClear = FALSE;
// Erase all bonds.
GAPBondMgr_SetParameter(GAPBOND_ERASE_ALLBONDS, 0, &eraseBonds);
// Turn on GREEN LED for set time.
//HalLedSet(HAL_LED_1, HAL_LED_MODE_BLINK);
}
}
开发者ID:ClarePhang,项目名称:ALL_SmartBatterySwitch_CC2640,代码行数:63,代码来源:cyclingSensor.c
示例6: 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
示例7: 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
示例8: hidDevInitialAdvertising
/*********************************************************************
* @fn hidDevInitialAdvertising
*
* @brief Start advertising for initial connection
*
* @return None.
*/
static void hidDevInitialAdvertising( void )
{
uint8 param;
VOID GAP_SetParamValue( TGAP_LIM_DISC_ADV_INT_MIN, HID_INITIAL_ADV_INT_MIN );
VOID GAP_SetParamValue( TGAP_LIM_DISC_ADV_INT_MAX, HID_INITIAL_ADV_INT_MAX );
VOID GAP_SetParamValue( TGAP_LIM_ADV_TIMEOUT, HID_INITIAL_ADV_TIMEOUT );
// Setup adverstising filter policy first
param = GAP_FILTER_POLICY_ALL;
VOID GAPRole_SetParameter( GAPROLE_ADV_FILTER_POLICY, sizeof( uint8 ), ¶m );
param = TRUE;
VOID GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), ¶m );
}
开发者ID:AlfredHunter,项目名称:Oidpen,代码行数:22,代码来源:hiddev.c
示例9: MysensorTag_updateAdvertisingData
void MysensorTag_updateAdvertisingData(void)
{
uint16_t RawTemperature, RawHumidity;
bStatus_t st1,st2,st3, st4;
uint8_t period, config, HumiditySensorON=1;
uint8_t HumRawData[4]; // humidity sensor raw data
float temperature,humidity; // temperature and humidity measurements in Celcius and %
// set parameter
st1 = Humidity_setParameter(SENSOR_CONF,1,&HumiditySensorON); // turn on
//SensorTagHum_processCharChangeEvt(SENSOR_CONF); // enable humidity sensing
// SensorTag_enqueueMsg(ST_CHAR_CHANGE_EVT, SERVICE_ID_HUM, SENOSR_CONF);
// get parameter
st2 = Humidity_getParameter(SENSOR_PERI, &period);
st3 = Humidity_getParameter(SENSOR_CONF, &config);
st4 = Humidity_getParameter(SENSOR_DATA, &HumRawData);
// raw temperature and humidity
RawTemperature = HumRawData[0] | (HumRawData[1]<<8);
RawHumidity = HumRawData[2] | (HumRawData[3]<<8);
sensorHdc1000Convert(RawTemperature, RawHumidity,&temperature, &humidity);
// update advertisement data
advertData[KEY_STATE_OFFSET+1] = (uint8_t)temperature;
advertData[KEY_STATE_OFFSET+2] = (uint8_t)humidity;
GAPRole_SetParameter(GAPROLE_ADVERT_DATA, sizeof(advertData), advertData);
}
开发者ID:bgloh,项目名称:Sensortag-CC2650,代码行数:30,代码来源:SensorTag.c
示例10: 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
示例11: timeAppDisconnected
/*********************************************************************
* @fn timeAppDisconnected
*
* @brief Handle disconnect.
*
* @return none
*/
static void timeAppDisconnected( void )
{
// Initialize state variables
timeAppDiscState = DISC_IDLE;
timeAppPairingStarted = FALSE;
timeAppDiscPostponed = FALSE;
// stop periodic measurement
osal_stop_timerEx( bloodPressureTaskId, BP_TIMER_CUFF_EVT );
// reset bloodPressure measurement client configuration
uint16 param = 0;
BloodPressure_SetParameter(BLOODPRESSURE_MEAS_CHAR_CFG, sizeof(uint16), (uint8 *) ¶m);
// reset bloodPressure intermediate measurement client configuration
BloodPressure_SetParameter(BLOODPRESSURE_IMEAS_CHAR_CFG, sizeof(uint16), (uint8 *) ¶m);
uint8 advEnable = FALSE;
//disable advertising on disconnect
GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &advEnable );
}
开发者ID:HorseMa,项目名称:BLE-CC254x-1.4.0,代码行数:33,代码来源:bloodPressure.c
示例12: 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
示例13: SimpleBLEPeripheral_ProcessEvent
/*********************************************************************
* @fn SimpleBLEPeripheral_ProcessEvent
*
* @brief Simple BLE Peripheral Application Task event processor. This function
* is called to process all events for the task. Events
* include timers, messages and any other user defined events.
*
* @param task_id - The OSAL assigned task ID.
* @param events - events to process. This is a bit map and can
* contain more than one event.
*
* @return events not processed
*/
uint16 SimpleBLEPeripheral_ProcessEvent( uint8 task_id, uint16 events )
{
VOID task_id; // OSAL required parameter that isn't used in this function
if ( events & SYS_EVENT_MSG )
{
uint8 *pMsg;
if ( (pMsg = osal_msg_receive( simpleBLEPeripheral_TaskID )) != NULL )
{
simpleBLEPeripheral_ProcessOSALMsg( (osal_event_hdr_t *)pMsg );
// Release the OSAL message
VOID osal_msg_deallocate( pMsg );
}
// return unprocessed events
return (events ^ SYS_EVENT_MSG);
}
if ( events & SBP_START_DEVICE_EVT )
{
P0_7 = 0; //防止继电器跳变,初始化为高
P0DIR |= BV(7); //设置为输出
P0SEL &=~BV(7); //设置该脚为普通GPIO
//HCI_EXT_SetTxPowerCmd (HCI_EXT_TX_POWER_MINUS_23_DBM);
// Start the Device
VOID GAPRole_StartDevice( &simpleBLEPeripheral_PeripheralCBs );
// Start Bond Manager
VOID GAPBondMgr_Register( &simpleBLEPeripheral_BondMgrCBs );
return ( events ^ SBP_START_DEVICE_EVT );
}
if ( events & SBP_PERIODIC_EVT )
{
//成功写入后,重启从机
HAL_SYSTEM_RESET();
return (events ^ SBP_PERIODIC_EVT);
}
#if defined ( PLUS_BROADCASTER )
if ( events & SBP_ADV_IN_CONNECTION_EVT )
{
uint8 turnOnAdv = TRUE;
// Turn on advertising while in a connection
GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &turnOnAdv );
return (events ^ SBP_ADV_IN_CONNECTION_EVT);
}
#endif // PLUS_BROADCASTER
// Discard unknown events
return 0;
}
开发者ID:HoobeeTechnology,项目名称:Hoobee,代码行数:70,代码来源:simpleBLEPeripheral.c
示例14: gapApplicationInit
/*---------------------------------------------------------------------------
* Initialization of GAP properties.
*-------------------------------------------------------------------------*/
static void gapApplicationInit(void)
{
// For the CC2540DK-MINI keyfob, device doesn't start advertising until button is pressed
uint8 initial_advertising_enable = TRUE;
// By setting this to zero, the device will go into the waiting state after
// being discoverable for 30.72 second, and will not being advertising again
// until the enabler is set back to TRUE
uint16 gapRole_AdvertOffTime = 0;
uint8 enable_update_request = DEFAULT_ENABLE_UPDATE_REQUEST;
uint16 desired_min_interval = DEFAULT_DESIRED_MIN_CONN_INTERVAL;
uint16 desired_max_interval = DEFAULT_DESIRED_MAX_CONN_INTERVAL;
uint16 desired_slave_latency = DEFAULT_DESIRED_SLAVE_LATENCY;
uint16 desired_conn_timeout = DEFAULT_DESIRED_CONN_TIMEOUT;
// Set the GAP Role Parameters
GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &initial_advertising_enable );
GAPRole_SetParameter( GAPROLE_ADVERT_OFF_TIME, sizeof( uint16 ), &gapRole_AdvertOffTime );
GAPRole_SetParameter( GAPROLE_SCAN_RSP_DATA, sizeof ( deviceName ), deviceName );
GAPRole_SetParameter( GAPROLE_ADVERT_DATA, sizeof( advertData ), advertData );
GAPRole_SetParameter( GAPROLE_PARAM_UPDATE_ENABLE, sizeof( uint8 ), &enable_update_request );
GAPRole_SetParameter( GAPROLE_MIN_CONN_INTERVAL, sizeof( uint16 ), &desired_min_interval );
GAPRole_SetParameter( GAPROLE_MAX_CONN_INTERVAL, sizeof( uint16 ), &desired_max_interval );
GAPRole_SetParameter( GAPROLE_SLAVE_LATENCY, sizeof( uint16 ), &desired_slave_latency );
GAPRole_SetParameter( GAPROLE_TIMEOUT_MULTIPLIER, sizeof( uint16 ), &desired_conn_timeout );
// Set the GAP Attributes
GGS_SetParameter( GGS_DEVICE_NAME_ATT, GAP_DEVICE_NAME_LEN, attDeviceName );
// Setup the GAP Bond Manager
{
uint8 pairMode = GAPBOND_PAIRING_MODE_WAIT_FOR_REQ;
uint8 mitm = TRUE;
uint8 ioCap = GAPBOND_IO_CAP_DISPLAY_ONLY;
uint8 bonding = TRUE;
GAPBondMgr_SetParameter( GAPBOND_PAIRING_MODE, sizeof ( uint8 ), &pairMode );
GAPBondMgr_SetParameter( GAPBOND_MITM_PROTECTION, sizeof ( uint8 ), &mitm );
GAPBondMgr_SetParameter( GAPBOND_IO_CAPABILITIES, sizeof ( uint8 ), &ioCap );
GAPBondMgr_SetParameter( GAPBOND_BONDING_ENABLED, sizeof ( uint8 ), &bonding );
}
// Set max output power and reciever gain
HCI_EXT_SetTxPowerCmd(HCI_EXT_TX_POWER_4_DBM);
HCI_EXT_SetRxGainCmd(HCI_EXT_RX_GAIN_HIGH);
}
开发者ID:pmd-ian,项目名称:RS-V1.2-Bluetooth,代码行数:50,代码来源:PMD_main.c
示例15: performPeriodicTask
/*********************************************************************
* @fn performPeriodicTask
*
* @brief Perform a periodic application task. This function gets
* called every five seconds as a result of the SBP_PERIODIC_EVT
* OSAL event. In this example, the value of the third
* characteristic in the SimpleGATTProfile service is retrieved
* from the profile, and then copied into the value of the
* the fourth characteristic.
*
* @param none
*
* @return none
*/
static void performPeriodicTask( void )
{
uint8 pos = FALSE, txpwr = 0;
Batt_MeasLevel( );
GAPRole_SetParameter(GAPROLE_ADVERT_ENABLED, sizeof(uint8), &pos);
advertData[11] = Battery2Asc(battLevel);
advertData[12] = (P0 & 1<<4) ? 0x31 : 0x30;
advertData[13] = (P0 & 1<<5) ? 0x31 : 0x30;
advertData[14] = (P0 & 1<<6) ? 0x31 : 0x30;
advertData[15] = '0' + advert_internal/100;
advertData[16] = '0' + (advert_internal/10)%10;
advertData[17] = '0' + advert_internal%10;
ProxReporter_GetParameter(PP_TX_POWER_LEVEL, &txpwr);
advertData[18] = txpwr + '0';
HCI_LE_SetAdvDataCmd( sizeof( advertData ), advertData );
pos = TRUE;
GAPRole_SetParameter(GAPROLE_ADVERT_ENABLED, sizeof(uint8), &pos);
}
开发者ID:cuipeng,项目名称:smartdoor,代码行数:35,代码来源:simpleBLEPeripheral.c
示例16: 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 );
}
开发者ID:blueoxss,项目名称:Biomimetic-robot,代码行数:62,代码来源:simpleBLEPeripheral.c
示例17: Rename_Device
/*---------------------------------------------------------------------------
* 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 Rename_Device(uint8 *name)
{
//uint8 status;
osal_memcpy(&attDeviceName[0], name, 21);
osal_memcpy(&deviceName[0], name, 21);
//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,代码行数:19,代码来源:PMD_main.c
示例18: HidDev_Close
/*********************************************************************
* @fn HidDev_Close
*
* @brief Close the connection or stop advertising.
*
* @return None.
*/
void HidDev_Close( void )
{
uint8 param;
// if connected then disconnect
if ( hidDevGapState == GAPROLE_CONNECTED )
{
GAPRole_TerminateConnection();
}
// else stop advertising
else
{
param = FALSE;
GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), ¶m );
}
}
开发者ID:AlfredHunter,项目名称:Oidpen,代码行数:23,代码来源:hiddev.c
示例19: 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
示例20: 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
注:本文中的GAPRole_SetParameter函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论