1 /* *****************************************************************
3 * Copyright 2015 Samsung Electronics All Rights Reserved.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 * *****************************************************************/
21 #ifndef PIN_CALLBACK_DEF_H_
22 #define PIN_CALLBACK_DEF_H_
28 #define OXM_RANDOM_PIN_SIZE 8
31 * Function pointer to print pin code
33 typedef void (*GeneratePinCallback)(char* pinData, size_t pinSize);
36 * Function pointer to input pin code
38 typedef void (*InputPinCallback)(char* pinBuf, size_t bufSize);
41 * Function to setting generate PIN callback from user
43 * @param[in] pinCB implementation of generate PIN callback
45 void SetGeneratePinCB(GeneratePinCallback pinCB);
48 * Function to setting input PIN callback from user
50 * @param[in] pinCB implementation of input PIN callback
52 void SetInputPinCB(InputPinCallback pinCB);
55 * Function to generate random PIN.
56 * This function will send generated PIN to user via callback.
58 * @param[in,out] pinBuffer Buffer to store the generated PIN data.
59 * @param[in] bufferSize Size of buffer
60 * @return OC_STACK_SUCCESS in case of success and other value otherwise.
62 OCStackResult GeneratePin(char* pinBuffer, size_t bufferSize);
65 * Function to input PIN callback via input callback
67 * @param[in,out] pinBuffer Buffer to store the inputed PIN data.
68 * @param[in] bufferSize Size of buffer
69 * @return OC_STACK_SUCCESS in case of success and other value otherwise.
71 OCStackResult InputPin(char* pinBuffer, size_t bufferSize);
78 #endif //PIN_CALLBACK_DEF_H_