这篇教程C++ GAPRole_GetParameter函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GAPRole_GetParameter函数的典型用法代码示例。如果您正苦于以下问题:C++ GAPRole_GetParameter函数的具体用法?C++ GAPRole_GetParameter怎么用?C++ GAPRole_GetParameter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GAPRole_GetParameter函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,
示例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,
示例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); }}
开发者ID:PolymorphicLabs,项目名称:PML-Firmware,代码行数:47,
示例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,
示例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,
示例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 ); }}
开发者ID:billy-wang,项目名称:IOT,代码行数:45,
示例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,
示例8: wechat_get_mac_addrstatic 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,
示例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,
示例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,
示例11: FanPeripheralStateNotificationCallBackstatic 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,
示例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,
示例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,
示例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 );}
开发者ID:blueoxss,项目名称:Biomimetic-robot,代码行数:62,
示例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,
示例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,
示例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,
示例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,
示例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,
示例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, ¤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 ); //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,
示例21: SNP_updateConnParam/** * SNP_updateConnParam * */uint8_t SNP_updateConnParam(snpUpdateConnParamReq_t *pReq){ uint8_t enableUpdateRequest = TRUE; uint8_t status; uint8_t value; status = GAPRole_SetParameter(GAPROLE_PARAM_UPDATE_ENABLE, sizeof(uint8_t), &enableUpdateRequest); status |= GAPRole_SetParameter(GAPROLE_MIN_CONN_INTERVAL, sizeof(uint16_t), &pReq->intervalMin); status |= GAPRole_SetParameter(GAPROLE_MAX_CONN_INTERVAL, sizeof(uint16_t), &pReq->intervalMax); status |= GAPRole_SetParameter(GAPROLE_SLAVE_LATENCY, sizeof(uint16_t), &pReq->slaveLatency); status |= GAPRole_SetParameter(GAPROLE_TIMEOUT_MULTIPLIER, sizeof(uint16_t), &pReq->supervisionTimeout); if(status == bleInvalidRange) { //Error management return SNP_INVALID_PARAMS; } else if(status) { // Mix of errors return SNP_FAILURE; } //check Status, only force update if in a connection. GAPRole_GetParameter(GAPROLE_STATE, &value); if((value == GAPROLE_CONNECTED) || (value == GAPROLE_CONNECTED_ADV)) { if (GAPRole_SetParameter( GAPROLE_PARAM_UPDATE_REQ, sizeof(uint8_t), &enableUpdateRequest)) { status = SNP_INVALID_PARAMS; } } else { status = SNP_NOT_CONNECTED; } return status;}
开发者ID:victor-zheng,项目名称:BLE,代码行数:49,
示例22: Application_StopAdvertiseuint8 Application_StopAdvertise(){ if( gapProfileState != GAPROLE_CONNECTED ) { uint8 astatus; // toggle GAP advertisement status GAPRole_GetParameter( GAPROLE_ADVERT_ENABLED, &astatus ); if (astatus == TRUE) { astatus = FALSE; GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &astatus ); return SUCCESS; } } return FAILURE;}
开发者ID:WayneTung,项目名称:TI-CC254x-BLE,代码行数:18,
示例23: char4_notifybStatus_t char4_notify(uint8 state){ attHandleValueNoti_t Report; GAPRole_GetParameter(GAPROLE_CONNHANDLE, &connHandle); uint16 value = GATTServApp_ReadCharCfg( connHandle, simpleProfileChar4Config); // If notifications enabled if ( value & GATT_CLIENT_CFG_NOTIFY ) { // Set the handle Report.handle = simpleProfileAttrTbl[14].handle; Report.len = 1; osal_memcpy(Report.value, &state, 1); // Send the notification return GATT_Notification( connHandle, &Report, FALSE ); } return bleIncorrectMode;}
开发者ID:liu470895,项目名称:car_lock,代码行数:19,
示例24: SimpleBLEBroadcaster_processStateChangeEvt/********************************************************************* * @fn SimpleBLEBroadcaster_processStateChangeEvt * * @brief Notification from the profile of a state change. * * @param newState - new state * * @return none */static void SimpleBLEBroadcaster_processStateChangeEvt(gaprole_States_t newState){ switch (newState) { case GAPROLE_STARTED: { uint8 ownAddress[B_ADDR_LEN]; GAPRole_GetParameter(GAPROLE_BD_ADDR, ownAddress); // Display device address LCD_WRITE_STRING(Util_convertBdAddr2Str(ownAddress), LCD_PAGE1); LCD_WRITE_STRING("Initialized", LCD_PAGE2); } break; case GAPROLE_ADVERTISING: { LCD_WRITE_STRING("Advertising", LCD_PAGE2); } break; case GAPROLE_WAITING: { LCD_WRITE_STRING("Waiting", LCD_PAGE2); } break; case GAPROLE_ERROR: { LCD_WRITE_STRING("Error", LCD_PAGE2); } break; default: { LCD_WRITE_STRING("", LCD_PAGE2); } break; }}
开发者ID:victor-zheng,项目名称:BLE,代码行数:50,
示例25: hidDevGapStateCB/********************************************************************* * @fn hidDevGapStateCB * * @brief Notification from the profile of a state change. * * @param newState - new state * * @return none */static void hidDevGapStateCB( gaprole_States_t newState ){ // if connected if ( newState == GAPROLE_CONNECTED ) { // get connection handle GAPRole_GetParameter( GAPROLE_CONNHANDLE, &gapConnHandle ); // connection not secure yet hidDevConnSecure = FALSE; // don't start advertising when connection is closed uint8 param = FALSE; GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), ¶m ); // start idle timer hidDevStartIdleTimer(); } // if disconnected else if ( hidDevGapState == GAPROLE_CONNECTED && newState != GAPROLE_CONNECTED ) { hidDevDisconnected(); updateConnParams = TRUE; if ( pairingStatus == SMP_PAIRING_FAILED_CONFIRM_VALUE ) { // bonding failed due to mismatched confirm values hidDevInitialAdvertising(); pairingStatus = SUCCESS; } } // if started else if ( newState == GAPROLE_STARTED ) { // nothing to do for now! } hidDevGapState = newState;}
开发者ID:AlfredHunter,项目名称:Oidpen,代码行数:50,
示例26: thermometer_Advertise/********************************************************************* * @fn thermometer_Advertise * * @brief Start advertisemement when measurement is ready * * * @return none */static void thermometer_Advertise( void ){ // Advertise if not connected 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, ¤t_adv_enabled_status ); if( current_adv_enabled_status == FALSE ) { new_adv_enabled_status = TRUE; } //change the GAP advertisement status GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &new_adv_enabled_status ); }}
开发者ID:venkatarajasekhar,项目名称:CC2540,代码行数:29,
示例27: Application_StartAdvertiseuint8 Application_StartAdvertise(uint16 duration, uint16 interval){ if( gapProfileState != GAPROLE_CONNECTED ) { uint8 astatus; // toggle GAP advertisement status GAPRole_GetParameter( GAPROLE_ADVERT_ENABLED, &astatus ); if (astatus == FALSE) { //Set fast advertising interval for user-initiated connections GAP_SetParamValue( TGAP_LIM_DISC_ADV_INT_MIN, interval ); GAP_SetParamValue( TGAP_LIM_DISC_ADV_INT_MAX, interval ); GAP_SetParamValue( TGAP_LIM_ADV_TIMEOUT, duration ); astatus = TRUE; GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &astatus ); return SUCCESS; } } return FAILURE;}
开发者ID:WayneTung,项目名称:TI-CC254x-BLE,代码行数:21,
示例28: Thermometer_advertise/********************************************************************* * @fn Thermometer_advertise * * @brief Start advertisement when measurement is ready. * * @param none * * @return none */static void Thermometer_advertise(void){ // If not connected, toggle advertising. if (gapProfileState != GAPROLE_CONNECTED) { uint8_t current_adv_enabled_status; uint8_t 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; } // Change the GAP advertisement status . GAPRole_SetParameter(GAPROLE_ADVERT_ENABLED, sizeof(uint8_t), &new_adv_enabled_status); }}
开发者ID:victor-zheng,项目名称:BLE,代码行数:30,
示例29: softCmdGapStateCB/********************************************************************* * @fn softCmdGapStateCB * * @brief Notification from the profile of a state change. * * @param newState - new state * * @return none */static void softCmdGapStateCB( gaprole_States_t newState ){ // if connected if (newState == GAPROLE_CONNECTED) { linkDBItem_t *pItem; // Get connection handle GAPRole_GetParameter( GAPROLE_CONNHANDLE, &softCmdConnHandle ); // Get peer bd address if ( (pItem = linkDB_Find( softCmdConnHandle )) != NULL) { // If connected to device without bond do service discovery if ( !osal_memcmp( pItem->addr, softCmdBondedAddr, B_ADDR_LEN ) ) { softCmdDiscoveryCmpl = FALSE; } // Initiate service discovery if necessary if ( softCmdDiscoveryCmpl == FALSE ) { osal_start_timerEx( softCmdTaskId, START_DISCOVERY_EVT, DEFAULT_DISCOVERY_DELAY ); } } } // if disconnected else if (softCmdGapState == GAPROLE_CONNECTED && newState != GAPROLE_CONNECTED) { softCmdDisconnected(); // reset client characteristic configuration descriptors uint16 param = GATT_CFG_NO_OPERATION; Batt_SetParameter(BATT_PARAM_LVL_ST_CHAR_CFG, sizeof(uint16), (uint8 *) ¶m); } softCmdGapState = newState;}
开发者ID:JensenSung,项目名称:shred444,代码行数:49,
示例30: uartServ2_SetParameter/** * @fn uartServ2_SetParameter * * @brief Set a Service 2 parameter. * * @param param - Profile parameter ID * @param len - length of data to right * @param value - pointer to data to write. This is dependent on * the parameter ID and WILL be cast to the appropriate * data type (example: data type of uint16 will be cast to * uint16 pointer). * * @return bStatus_t */bStatus_t uartServ2_SetParameter(uint8 param, uint8 len, void *value){ bStatus_t ret = SUCCESS; switch (param) { case UARTSERV2_CHAR: { attHandleValueNoti_t noti; uint16 notiHandle; uint8 *pkt = (uint8 *) value; GAPRole_GetParameter(GAPROLE_CONNHANDLE, ¬iHandle); noti.handle = uartServ2AttrTbl[2].handle; noti.len = len; osal_memcpy(¬i.value[0], pkt, noti.len); GATT_Notification(notiHandle, ¬i, FALSE); // { uint8 i; dmsg(("[ble->app]:")); for (i=0; i<noti.len; i++) { dmsg((" %02x", noti.value[i])); } dmsg(("/n")); } } break; default: ret = INVALIDPARAMETER; break; } return (ret);}
开发者ID:wythe-lin,项目名称:ZTKBLE,代码行数:51,
注:本文中的GAPRole_GetParameter函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GAPRole_SetParameter函数代码示例 C++ GAErr函数代码示例 |