//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#ifndef __TIZENRT__
#include <memory.h>
+#endif
#include "ocstack.h"
#include "ocrandom.h"
static GeneratePinCallback gGenPinCallback = NULL;
static InputPinCallback gInputPinCallback = NULL;
+static ClosePinDisplayCallback gClosePinDispalyCallback = NULL;
typedef struct PinOxmData {
uint8_t pinData[OXM_RANDOM_PIN_MAX_SIZE + 1];
gGenPinCallback = pinCB;
}
+void SetClosePinDisplayCB(ClosePinDisplayCallback closeCB)
+{
+ if (NULL == closeCB)
+ {
+ OIC_LOG(ERROR, TAG, "Failed to set a callback for closing a pin.");
+ return;
+ }
+
+ gClosePinDispalyCallback = closeCB;
+}
+
+
void UnsetInputPinCB()
{
gInputPinCallback = NULL;
gGenPinCallback = NULL;
}
+void UnsetClosePinDisplayCB()
+{
+ gClosePinDispalyCallback = NULL;
+}
+
+void ClosePinDisplay()
+{
+ if (gClosePinDispalyCallback)
+ {
+ gClosePinDispalyCallback();
+ }
+}
+
/**
* Internal function to generate PIN element according to pinType.
* This function assumes the pinType is valid.
{
return defaultRetValue;
}
+ else
+ {
+ curIndex -= 1;
+ }
return allowedCharacters[OCGetRandomRange(0, curIndex)];
}
if(gInputPinCallback)
{
gInputPinCallback(pinBuffer, bufferSize);
- OICStrcpy(g_PinOxmData.pinData, OXM_RANDOM_PIN_MAX_SIZE + 1, pinBuffer);
- g_PinOxmData.pinSize = strlen(g_PinOxmData.pinData);
+ OICStrcpy((char*)(g_PinOxmData.pinData), OXM_RANDOM_PIN_MAX_SIZE + 1, pinBuffer);
+ g_PinOxmData.pinSize = strlen((char*)(g_PinOxmData.pinData));
}
else
{
return OC_STACK_OK;
}
-#ifdef _ENABLE_MULTIPLE_OWNER_
+#ifdef MULTIPLE_OWNER
OCStackResult SetPreconfigPin(const char *pinBuffer, size_t pinLength)
{
if(NULL == pinBuffer || OXM_PRECONFIG_PIN_MAX_SIZE < pinLength)
return OC_STACK_OK;
}
-#endif //_ENABLE_MULTIPLE_OWNER_
+#endif //MULTIPLE_OWNER
#ifdef __WITH_DTLS__
return ret;
}
-#ifdef _ENABLE_MULTIPLE_OWNER_
+#ifdef MULTIPLE_OWNER
int32_t GetDtlsPskForMotRandomPinOxm( CADtlsPskCredType_t type,
const unsigned char *UNUSED1, size_t UNUSED2,
unsigned char *result, size_t result_length)
return ret;
}
-#endif //_ENABLE_MULTIPLE_OWNER_
+#endif //MULTIPLE_OWNER
#endif //__WITH_DTLS__