GAP.docx

上传人:b****4 文档编号:6917667 上传时间:2023-05-10 格式:DOCX 页数:15 大小:18.35KB
下载 相关 举报
GAP.docx_第1页
第1页 / 共15页
GAP.docx_第2页
第2页 / 共15页
GAP.docx_第3页
第3页 / 共15页
GAP.docx_第4页
第4页 / 共15页
GAP.docx_第5页
第5页 / 共15页
GAP.docx_第6页
第6页 / 共15页
GAP.docx_第7页
第7页 / 共15页
GAP.docx_第8页
第8页 / 共15页
GAP.docx_第9页
第9页 / 共15页
GAP.docx_第10页
第10页 / 共15页
GAP.docx_第11页
第11页 / 共15页
GAP.docx_第12页
第12页 / 共15页
GAP.docx_第13页
第13页 / 共15页
GAP.docx_第14页
第14页 / 共15页
GAP.docx_第15页
第15页 / 共15页
亲,该文档总共15页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

GAP.docx

《GAP.docx》由会员分享,可在线阅读,更多相关《GAP.docx(15页珍藏版)》请在冰点文库上搜索。

GAP.docx

GAP

BLEProtocol

GAPAPI

FUNCTIONS

MadebyfjcGZU-tek2013-01-30

/*-------------------------------------------------------------------

*FUNCTIONS-InitializationandConfiguation

*/

/**

*@briefCalledtosetupthedevice.Calljustonceoninitialization.

*

*NOTE:

Wheninitializationiscomplete,thecallingappwillbe

*senttheGAP_DEVICE_INIT_DONE_EVENT

*

*@paramtaskID-DefaulttaskIDtosendevents.

*@paramprofileRole-GAPProfileRoles:

@refGAP_PROFILE_ROLE_DEFINES

*@parammaxScanResponses-maximumnumbertoscanresponses

*wecanreceiveduringadevicediscovery.

*@parampIRK-pointertoIdentityRootKey,NULLKEY(allzeroes)iftheapp

*wantstheGAPtogeneratethekey.

*@parampSRK-pointertoSignResolvingKey,NULLKEYiftheapp

*wantstheGAPtogeneratethekey.

*@parampSignCounter-32bitvalueusedintheSMSigning

*algorithmthatshallbeinitializedtozeroandincremented

*witheverynewsigning.Thisvariablemustalsobemaintained

*bytheapplication.

*

*@returnSUCCESS-Processing,expectGAP_DEVICE_INIT_DONE_EVENT,

*INVALIDPARAMETER-forinvalidprofileroleorrolecombination,

*bleIncorrectMode-troublecommunicatingwithHCI

*/

externbStatus_tGAP_DeviceInit(uint8taskID,

uint8profileRole,

uint8maxScanResponses,

uint8*pIRK,

uint8*pSRK,

uint32*pSignCounter);

/**

*@briefCalledtosetupaGAPAdvertisement/ScanResponsedatatoken.

*

*NOTE:

Thedataintheseitemsarestoredaslowbytefirst(OTAformat).

*Thepassedinstructure"token"shouldbeallocatedbythecallingapp/profile

*andnotreleaseduntilaftercallingGAP_RemoveAdvToken().

*

*@parampToken-Advertisement/Scanresponsetokentowrite.

*

*@returnSUCCESS-advertisementtokenaddedtotheGAPlist

*INVALIDPARAMETER-InvalidAdvertisementTypeorpAttrDataisNULL

*INVALID_MEM_SIZE-Thetokenstakeuptoomuchspaceanddon'tfitintoAdvertismentdataandScanResponseData

*bleInvalidRange-tokenIDalreadyexists.

*bleIncorrectMode-notaperipheraldevice

*bleMemAllocError-memoryallocationfailure,

*/

externbStatus_tGAP_SetAdvToken(gapAdvDataToken_t*pToken);

/**

*@briefCalledtoreadaGAPAdvertisement/ScanResponsedatatoken.

*

*@paramadType-Advertisementtypetoget

*

*@returnpointertotheadvertisementdatatokenstructure,NULLifnotfound.

*/

externgapAdvDataToken_t*GAP_GetAdvToken(uint8adType);

/**

*@briefCalledtoremoveaGAPAdvertisement/ScanResponsedatatoken.

*

*@paramadType-Advertisementtypetoremove

*

*@returnpointertothetokenstructureremovedfromtheGAPADTypelist

*NULLiftherequestedadTypewasn'tfound.

*/

externgapAdvDataToken_t*GAP_RemoveAdvToken(uint8adType);

/**

*@briefCalledtorebuildandloadAdvertisementandScanResponsedatafromexisting

*GAPAdvertisementTokens.

*

*@returnSUCCESSorbleIncorrectMode

*/

externbStatus_tGAP_UpdateAdvTokens(void);

/**

*@briefSetaGAPParametervalue.Usethisfunctiontochange

*thedefaultGAPparametervalues.

*

*@paramparamID-parameterID:

@refGAP_PARAMETER_ID_DEFINES

*@paramparamValue-newparamvalue

*

*@returnSUCCESSorINVALIDPARAMETER(invalidparamID)

*/

externbStatus_tGAP_SetParamValue(gapParamIDs_tparamID,uint16paramValue);

/**

*@briefGetaGAPParametervalue.

*

*@paramparamID-parameterID:

@refGAP_PARAMETER_ID_DEFINES

*

*@returnGAPParametervalueor0xFFFFifinvalid

*/

externuint16GAP_GetParamValue(gapParamIDs_tparamID);

/**

*@briefSetupthedevice'saddresstype.IfADDRTYPE_PRIVATE_RESOLVE

*isselected,theaddresswillchangeperiodically.

*

*@paramaddrType-@refGAP_ADDR_TYPE_DEFINES

*@parampStaticAddr-OnlyusedwithADDRTYPE_STATIC

*orADDRTYPE_PRIVATE_NONRESOLVEtype.

*NULLtoautogenerateotherwisetheapplication

*canspecifytheaddressvalue

*

*@returnSUCCESS:

addresstypeupdated,

*bleNotReady:

Can'tbecalleduntilGAP_DeviceInit()iscalled

*andtheinitprocessiscompleted,

*bleIncorrectMode:

can'tchangewithanactiveconnection,

*orINVALIDPARAMETER.

*

*Ifreturnvalueisn'tSUCCESS,theaddresstyperemains

*thesameasbeforethiscall.

*/

externbStatus_tGAP_ConfigDeviceAddr(uint8addrType,uint8*pStaticAddr);

/**

*@briefRegisteryourtaskIDtoreceiveextra(unwanted)

*HCIstatusandcompleteevents.

*

*@paramtaskID-DefaulttaskIDtosendevents.

*

*@returnnone

*/

externvoidGAP_RegisterForHCIMsgs(uint8taskID);

/*-------------------------------------------------------------------

*FUNCTIONS-DeviceDiscovery

*/

/**

*@briefStartadevicediscoveryscan.

*

*@parampParams-DeviceDiscoveryparameters

*

*@returnSUCCESS:

scanstarted,

*bleIncorrectMode:

invalidprofilerole,

*bleAlreadyInRequestedMode:

notavailable

*/

externbStatus_tGAP_DeviceDiscoveryRequest(gapDevDiscReq_t*pParams);

/**

*@briefCancelanexistingdevicediscoveryrequest.

*

*@paramtaskID-usedtoreturnGAP_DEVICE_DISCOVERY_EVENT

*

*@returnSUCCESS:

cancelstarted,

*bleInvalidTaskID:

Notthetaskthatstarteddiscovery,

*bleIncorrectMode:

notindiscoverymode

*/

externbStatus_tGAP_DeviceDiscoveryCancel(uint8taskID);

/**

*@briefSetuporchangeadvertising.Alsostartsadvertising.

*

*@paramtaskID-usedtoreturnGAP_DISCOVERABLE_RESPONSE_EVENT

*@parampParams-advertisingparameters

*

*@returnSUCCESS:

advertisingstarted,

*bleIncorrectMode:

invalidprofilerole,

*bleAlreadyInRequestedMode:

notavailableatthistime,

*bleNotReady:

advertisingdataisn'tsetupyet.

*/

externbStatus_tGAP_MakeDiscoverable(uint8taskID,gapAdvertisingParams_t*pParams);

/**

*@briefSetuporchangeadvertisingandscanresponsedata.

*

*NOTE:

ifthereturnstatusfromthisfunctionisSUCCESS,

*thetaskisn'tcompleteuntiltheGAP_ADV_DATA_UPDATE_DONE_EVENT

*issenttothecallingapplicationtask.

*

*@paramtaskID-taskIDoftheapprequestingthechange

*@paramadType-TRUE-advertisementdata,FALSE-scanresponsedata

*@paramdataLen-OctetlengthofadvertData

*@parampAdvertData-advertisingorscanresponsedata

*

*@returnSUCCESS:

dataaccepted,

*bleIncorrectMode:

invalidprofilerole,

*/

externbStatus_tGAP_UpdateAdvertisingData(uint8taskID,uint8adType,

uint8dataLen,uint8*pAdvertData);

/**

*@briefStopsadvertising.

*

*@paramtaskID-oftaskthatcalledGAP_MakeDiscoverable

*

*@returnSUCCESS:

stoppingdiscoverablemode,

*bleIncorrectMode:

notindiscoverablemode,

*bleInvalidTaskID:

notcorrecttask

*/

externbStatus_tGAP_EndDiscoverable(uint8taskID);

/**

*@briefResolvesaprivateaddressagainstanIRK.

*

*@parampIRK-pointertotheIRK

*@parampAddr-pointertotheResovablePrivateaddress

*

*@returnSUCCESS:

match,

*FAILURE:

don'tmatch,

*INVALIDPARAMETER:

parametersinvalid

*/

externbStatus_tGAP_ResolvePrivateAddr(uint8*pIRK,uint8*pAddr);

/*-------------------------------------------------------------------

*FUNCTIONS-LinkEstablishment

*/

/**

*@briefEstablishalinktoaslavedevice.

*

*@parampParams-linkestablishmentparameters

*

*@returnSUCCESS:

startedestablishlinkprocess,

*bleIncorrectMode:

invalidprofilerole,

*bleNotReady:

ascanisinprogress,

*bleAlreadyInRequestedMode:

can抰processnow,

*bleNoResources:

Toomanylinks

*/

externbStatus_tGAP_EstablishLinkReq(gapEstLinkReq_t*pParams);

/**

*@briefTerminatealinkconnection.

*

*@paramtaskID-requestingapp'staskid.

*@paramconnectionHandle-connectionhandleoflinktoterminate

*or@refGAP_CONN_HANDLE_DEFINES

*

*@returnSUCCESS:

Terminatestarted,

*bleIncorrectMode:

NoLinktoterminate,

*bleInvalidTaskID:

notappthatestablishedlink

*/

externbStatus_tGAP_TerminateLinkReq(uint8taskID,uint16connectionHandle);

/**

*@briefReturnsthenumberofactiveconnections.

*

*@returnNumberofactiveconnections.

*/

externuint8GAP_NumActiveConnections(void);

/*-------------------------------------------------------------------

*FUNCTIONS-Pairing

*/

/**

*@briefStarttheAuthenticationprocesswiththerequesteddevice.

*ThisfunctionisusedtoInitiate/Allowpairing.

*Calledbybothmasterandslavedevice(CentralandPeripheral).

*

*NOTE:

Thisfunctioniscalledafterthelinkisestablished.

*

*@parampParams-Authenticationparameters

*@parampPairReq-EntertheseparametersifthePairingRequestwasalreadyreceived.

*NULL,ifwaitingforPairingRequestorifinitiating.

*

*@returnSUCCESS,

*bleIncorrectMode:

Notcorrectprofilerole,

*INVALIDPARAMETER,

*bleNotConnected,

*bleAlreadyInRequestedMode,

*FAILURE-notworkable.

*/

externbStatus_tGAP_Authenticate(gapAuthParams_t*pParams,gapPairingReq_t*pPairReq);

/**

*@briefSendaPairingFailedmessageandendanyexistingpairing.

*

*@paramconnectionHandle-connectionhandle.

*@paramreason-PairingFailedreasoncode.

*

*@returnSUCCESS-functionwassuccessful,

*bleMemAllocError-memoryallocationerror,

*INVALIDPARAMETER-oneoftheparameterswereinvalid,

*bleInvalidRange-oneoftheparameterswerenotwithinrange.

*/

externbStatus_tGAP_TerminateAuth(uint16connectionHandle,uint8reason);

/**

*@briefUpdatethepasskeyinstringformat.Thisfunctioniscal

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 总结汇报 > 实习总结

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2