Hi,
I am trying to connect from msp430 f5438 using an android tablet using bluterm app.I am using SPPLE Demo example.I am trying to modify the PIN number used while pairing.Now the system runs this way i tries to connect from bluterm its asks for say i gave 3456 then in teraterm i gives PINCodeResponse 3456 then its paired.How can i set it to preconfigured PIN number?
I tried to chamge static int PINCodeResponse(ParameterList_t *TempParam) function like this but was of no use
static int PINCodeResponse(ParameterList_t *TempParam) { int Result; int ret_val; PIN_Code_t PINCode; GAP_Authentication_Information_t GAP_Authentication_Information; /* First, check that valid Bluetooth Stack ID exists. */ if(BluetoothStackID) { /* First, check to see if there is an on-going Pairing operation */ /* active. */ // if(!COMPARE_NULL_BD_ADDR(CurrentCBRemoteBD_ADDR)) // { /* Make sure that all of the parameters required for this */ /* function appear to be at least semi-valid. */ // if((TempParam) && (TempParam->NumberofParameters > 0) && (TempParam->Params[0].strParam) && (BTPS_StringLength(TempParam->Params[0].strParam) > 0) && (BTPS_StringLength(TempParam->Params[0].strParam) <= sizeof(PIN_Code_t))) if(1) { /* Parameters appear to be valid, go ahead and convert the */ /* input parameter into a PIN Code. */ /* Initialize the PIN code. */ ASSIGN_PIN_CODE(PINCode, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); // BTPS_MemCopy(&PINCode, TempParam->Params[0].strParam, BTPS_StringLength(TempParam->Params[0].strParam)); /* Populate the response structure. */ GAP_Authentication_Information.GAP_Authentication_Type = atPINCode; // GAP_Authentication_Information.Authentication_Data_Length = (Byte_t)(BTPS_StringLength(TempParam->Params[0].strParam)); GAP_Authentication_Information.Authentication_Data_Length = 4; GAP_Authentication_Information.Authentication_Data.PIN_Code = PINCode; /* Submit the Authentication Response. */ Result = GAP_Authentication_Response(BluetoothStackID, CurrentCBRemoteBD_ADDR, &GAP_Authentication_Information); /* Check the return value for the submitted command for */ /* success. */ if(!Result) { /* Operation was successful, inform the user. */ Display(("GAP_Authentication_Response(), Pin Code Response Success.\r\n")); /* Flag success to the caller. */ ret_val = 0; } else { /* Inform the user that the Authentication Response was */ /* not successful. */ Display(("GAP_Authentication_Response() Failure: %d.\r\n", Result)); ret_val = FUNCTION_ERROR; } /* Flag that there is no longer a current Authentication */ /* procedure in progress. */ ASSIGN_BD_ADDR(CurrentCBRemoteBD_ADDR, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); } else { /* One or more of the necessary parameters is/are invalid. */ DisplayUsage("PINCodeResponse [PIN Code]"); ret_val = INVALID_PARAMETERS_ERROR; } // } // else // { /* There is not currently an on-going authentication operation,*/ /* inform the user of this error condition. */ // Display(("PIN Code Authentication Response: Authentication not in progress.\r\n")); // ret_val = FUNCTION_ERROR; // } } else { /* No valid Bluetooth Stack ID exists. */ ret_val = INVALID_STACK_ID_ERROR; } return(ret_val); }