![]() |
c urgent probleme de capture d'evenemet
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
c urgent probleme de capture d'evenemet
salut
je travaille sur vc++, j'utilise une console , j'ai une fonction de prototype suivant ; GAP_Perform_Inquiry(BluetoothStackID,itGeneralInquiry, 0, 0, 10, 5,GAP_EventCallback,(unsigned long)0); avec GAP_EventCallback est un pointeur sur fonction qui s'active des qu'il ya un evenement par exemple (faire un inquiry) cette fonction est definit en bas , mais mon probleme que Result = GAP_Perform_Inquiry(BluetoothStackID,itGeneralInquiry, 0, 0, 10, 5,GAP_EventCallback,(unsigned long)0); me retourne un Result >0 (c a dire succes ) mais l'evenement ne se declenche pas et je sais pas pkoi ,j'ai essaie avec le debugueur mais apparament il n'entre pas a l'interieur de la fonction GAP_EventCallback et GAPEventData pointe sur un zero ;vous n'avez pas une solution c urgent static void BTPSAPI GAP_EventCallback( unsigned int BluetoothStackID,GAP_Event_Data_t *GAPEventData, unsigned long CallbackParameter) { int Index; int Result; char temp[128]; Byte_t StatusResult, Num_Keys_Written; BoardStr_t BoardStr; GAP_Inquiry_Event_Data_t *GAP_Inquiry_Event_Data; GAP_Remote_Name_Event_Data_t *GAP_Remote_Name_Event_Data; GAP_Authentication_Information_t GAP_Authentication_Information; HCI_Stored_Link_Key_Info_t HCI_Stored_Link_Key_Info; printf("5555"); if((BluetoothStackID) && (GAPEventData)) {printf("!"); switch(GAPEventData->Event_Data_Type) {printf("2"); case etInquiry_Result: /* Bluetooth Stack has the results from a previously */ /* issued GAP Inquiry. */ GAP_Inquiry_Event_Data = GAPEventData->Event_Data.GAP_Inquiry_Event_Data; if(GAP_Inquiry_Event_Data) { /* Inform the user of how many Devices were found. */ printf(" GAP Inquiry Result: %d Found", GAP_Inquiry_Event_Data->Number_Devices); /* If Devices were found, let's add the Devices to our */ /* Local Board List (and inform the User of the Boards */ /* that were found). */ if((GAP_Inquiry_Event_Data->Number_Devices) && (GAP_Inquiry_Event_Data->GAP_Inquiry_Data)) { for(Index=0; (Index<GAP_Inquiry_Event_Data->Number_Devices) && (Index < (sizeof(BoardList)/sizeof(BD_ADDR_t))); Index++) { BoardList[Index] = GAP_Inquiry_Event_Data->GAP_Inquiry_Data[Index].BD_ADDR; BD_ADDRToStr(GAP_Inquiry_Event_Data->GAP_Inquiry_Data[Index].BD_ADDR, &BoardStr); printf(" GAP Inquiry Result: %d: %s", (Index+1), BoardStr); } /* Inform the Main GUI Application to populate the */ /* Inquiry List Box. */ PopulateInquiryList(GAP_Inquiry_Event_Data->Number_Devices); /*PopulateInquiryListFromThread(GAP_Inquiry_Event_Data->Number_Devices);*/ } } break; case etAuthentication: /* An Authentication Event occurred, determine which Type of*/ /* Authentication Event occurred. */ switch(GAPEventData->Event_Data.GAP_Authentication_Event_Data->GAP_Authentication_Event_Type) { case atLinkKeyRequest: BD_ADDRToStr(GAPEventData->Event_Data.GAP_Authentication_Event_Data->Remote_Device, &BoardStr); sprintf(temp, "GAP_LinkKeyRequest : %s.", BoardStr); /* Setup the Authentication Information Response */ /* structure. */ GAP_Authentication_Information.GAP_Authentication_Type = atLinkKey; GAP_Authentication_Information.Authentication_Data_Length = 0; /* Submit the Authentication Response. */ Result = GAP_Authentication_Response(BluetoothStackID, GAPEventData->Event_Data.GAP_Authentication_Event_Data->Remote_Device, &GAP_Authentication_Information); /* Check the result of the submitted command. */ if(!Result) { printf("GAP_Authentication_Response() Success."); } else { printf("GAP_Authentication_Response() Failure: %d.", TRUE); } break; BD_ADDRToStr(GAPEventData->Event_Data.GAP_Authentication_Event_Data->Remote_Device, &BoardStr); sprintf(temp, "GAP_PINCodeRequest: %s.", BoardStr); /*CurrentRemoteBDADDR = GAPEventData->Event_Data.GAP_Authentication_Event_Data->Remote_Device; GeneratePinCodeFromThread();*/ break; case atAuthenticationStatus: /* An Authentication Status Event occurred, display */ /* all relevant information. */ BD_ADDRToStr(GAPEventData->Event_Data.GAP_Authentication_Event_Data->Remote_Device, &BoardStr); printf( "GAP_AuthenticationStatus : %d Board: %s.", GAPEventData->Event_Data.GAP_Authentication_Event_Data->Authentication_Event_Data.Authentication_Status, BoardStr); break; case atLinkKeyCreation: /* A Link Key Creation Event occurred, first display */ /* the Remote Device that caused this Event. */ BD_ADDRToStr(GAPEventData->Event_Data.GAP_Authentication_Event_Data->Remote_Device, &BoardStr); printf( "GAP_LinkKeyCreation : %s.", BoardStr); /* The BD_ADDR of the Remote Device has been displayed*/ /* now display the Link Key being created. */ sprintf(temp, "Link Key: 0x"); for(Index = 0; Index < sizeof(Link_Key_t); Index++) { sprintf(&(temp[strlen(temp)]), "%02X", ((Byte_t *)(&(GAPEventData->Event_Data.GAP_Authentication_Event_Data->Authentication_Event_Data.Link_Key)))[Index]); } printf(&(temp[strlen(temp)]), "."); HCI_Stored_Link_Key_Info.BD_ADDR = GAPEventData->Event_Data.GAP_Authentication_Event_Data->Remote_Device; HCI_Stored_Link_Key_Info.Link_Key = GAPEventData->Event_Data.GAP_Authentication_Event_Data->Authentication_Event_Data.Link_Key; Result = HCI_Write_Stored_Link_Key(BluetoothStackID, 1, &HCI_Stored_Link_Key_Info, &StatusResult, &Num_Keys_Written); if(!Result) { printf("Link Key Saved Successfully."); } else { printf("Failure to Save Link Key."); } break; } break; case etRemote_Name_Result: /* Bluetooth Stack has responded to a previously issued */ /* Remote Name Request that was issued. */ GAP_Remote_Name_Event_Data = GAPEventData->Event_Data.GAP_Remote_Name_Event_Data; if(GAP_Remote_Name_Event_Data) { /* Inform the user of the Result. */ BD_ADDRToStr(GAP_Remote_Name_Event_Data->Remote_Device, &BoardStr); printf("GAP Remote Name Result : BD_ADDR: %s", BoardStr); if(GAP_Remote_Name_Event_Data->Remote_Name) printf("GAP Remote Name Result : Name : %s.", GAP_Remote_Name_Event_Data->Remote_Name); else printf( "Remote Name : NULL Pointer."); } break; } } } |
#2
|
||||
|
||||
Re: c urgent probleme de capture d'evenemet
Mdr, je dirais que le problème vient de ta fonction qui ne retourne rien et qui reçoit des mauvais paramètres...
Non plus sérieusement j'en sais strictement rien, j'suis pas une bete en C, j'espere que quelqu'un pourra plus t'aider... |
#3
|
||||
|
||||
Re: c urgent probleme de capture d'evenemet
Tu as vérifié que tes fonctions prises a part renvoient quelques choses... Ton prototype est erroné tu ne précise pas les types, tu a copié deux fois ton appel de fonction (un oubli je pense...)
|
![]() |
Bookmarks |
«
Previous Thread
|
Next Thread
»
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Petit probléme avec outlook express !!! | Alexlesioux | Internet, Réseaux et Sécurité | 11 | 31-08-2004 07:16 |
PROBLEME URGENT SVP | LXir | Programmation (C/C++, Delphi, VB, etc.) | 1 | 21-03-2004 11:22 |
Probléme de lenteurs... | chalouf | Discussions sur le site et/ou le forum | 11 | 22-01-2003 19:37 |
Probleme site!! | chalouf | Discussions sur le site et/ou le forum | 4 | 21-10-2002 21:06 |
Problème forum | claude922 | Discussions sur le site et/ou le forum | 15 | 21-10-2002 07:04 |
All times are GMT +2. The time now is 22:03.
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.