git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@427 05563f52-14a8-4384-a975-3d1654cca0fa
127 lines
3.7 KiB
C
127 lines
3.7 KiB
C
// -----------------------------------------------------------------------------
|
|
/// @file PIN.h
|
|
/// @brief File description
|
|
// -----------------------------------------------------------------------------
|
|
// Micro-Key bv
|
|
// Industrieweg 28, 9804 TG Noordhorn
|
|
// Postbus 92, 9800 AB Zuidhorn
|
|
// The Netherlands
|
|
// Tel: +31 594 503020
|
|
// Fax: +31 594 505825
|
|
// Email: support@microkey.nl
|
|
// Web: www.microkey.nl
|
|
// -----------------------------------------------------------------------------
|
|
/// $Revision: $
|
|
/// $Author: $
|
|
/// $Date: $
|
|
// (c) 2015 Micro-Key bv
|
|
// -----------------------------------------------------------------------------
|
|
|
|
/**
|
|
* %PIN implementation
|
|
* \defgroup PIN Package PIN
|
|
* \ingroup hsb-mrts
|
|
* @{
|
|
*/
|
|
|
|
#ifndef PIN_H_
|
|
#define PIN_H_
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Include files
|
|
// -----------------------------------------------------------------------------
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include "stm32f10x.h"
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Constant and macro definitions
|
|
// -----------------------------------------------------------------------------
|
|
|
|
#define PIN_NUMBER_OF_DIGITS (4)
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Type definitions.
|
|
// -----------------------------------------------------------------------------
|
|
|
|
struct PIN
|
|
{
|
|
char firstDigit;
|
|
char secondDigit;
|
|
char thirdDigit;
|
|
char fourthDigit;
|
|
|
|
char pinchangeFirstInsert[5];
|
|
char pinchangeSecondInsert[5];
|
|
};
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Function declarations
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
/** ----------------------------------------------------------------------------
|
|
* PIN_generateDefaultPIN
|
|
* Description of function
|
|
*
|
|
* @param self
|
|
* @param
|
|
* @return void
|
|
*
|
|
* @todo
|
|
* -----------------------------------------------------------------------------
|
|
*/
|
|
extern void PIN_generateDefaultPIN(struct PIN* self);
|
|
|
|
|
|
/** ----------------------------------------------------------------------------
|
|
* PIN_isOK
|
|
* Description of function
|
|
*
|
|
* @param self
|
|
* @param PinToVerify
|
|
* @return bool
|
|
*
|
|
* @todo
|
|
* -----------------------------------------------------------------------------
|
|
*/
|
|
extern bool PIN_isOK(struct PIN* self, char* const pin);
|
|
|
|
|
|
/** ----------------------------------------------------------------------------
|
|
* PIN_changePinFirstInsert
|
|
* Transmits the first PIN insertion in order to change the current PIN
|
|
*
|
|
* @param self
|
|
* @param firstPinInsert
|
|
* @return void
|
|
*
|
|
* @todo
|
|
* -----------------------------------------------------------------------------
|
|
*/
|
|
extern void PIN_changePinFirstInsert(struct PIN* self, char* const firstPinInsert);
|
|
|
|
|
|
/** ----------------------------------------------------------------------------
|
|
* PIN_changePinSecondInsert
|
|
* transmits the second PIN insertion in order to change the current PIN.
|
|
* Only accepts second insert after first insert has been called. Afterwards,
|
|
* both inserts a compared. If equal, the new PIN is registered. Otherwise an
|
|
* error message is generated
|
|
*
|
|
* @param self
|
|
* @param firstPinInsert
|
|
* @return ErrorStatus SUCCESS if both PIN inserts are equal
|
|
* ERROR otherwise
|
|
*
|
|
* @todo
|
|
* -----------------------------------------------------------------------------
|
|
*/
|
|
extern ErrorStatus PIN_changePinSecondInsert(struct PIN* self, char* const secondPinInsert);
|
|
|
|
#endif /* PIN_H_ */
|
|
|
|
/** @} */
|