Hello,
I am using MSP-EXP430F5438 and PAN1323ETU. I want to enter pin code "0000" automatically to connect PAN1323 to my PC. I am using SSP demo to the the required job. I cannot enter the pin code automatically through code and hence pairing with PC cannot be achieved. Pincoderesponse function is called in atpincoderequest. The code under Pincoderesponse is as follows:
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_BD_ADDR(CurrentRemoteBD_ADDR, NullADDR))
{
/* 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, 0, 0, 0, 0, 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 = 4; //(Byte_t)(BTPS_StringLength(TempParam->Params[0].strParam));
GAP_Authentication_Information.Authentication_Data.PIN_Code = PINCode;
/* Submit the Authentication Response. */
Result = GAP_Authentication_Response(BluetoothStackID, CurrentRemoteBD_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. */
// Display(("done"));
ASSIGN_BD_ADDR(CurrentRemoteBD_ADDR, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
// ASSIGN_BD_ADDR(CurrentRemoteBD_ADDR, 0xBC, 0x77, 0x37, 0x40, 0x13, 0x47);
}
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);
}
What are the extra changes to be made in the code? Also I wanted to the know the exact steps required for connecting PAN1323 to PC.
Thanks in advance!