Configuration API

The following APIs are used to read and write system configuration information.


BS2FactoryConfig

typedef struct {
    uint8_t major;
    uint8_t minor;
    uint8_t ext;
    uint8_t reserved[1];
} Version;
 
typedef struct {
    uint32_t deviceID;
    uint8_t macAddr[BS2_MAC_ADDR_LEN];
    uint8_t reserved[2];
    char modelName[BS2_MODEL_NAME_LEN];
    Version boardVer;
    Version kernelVer;
    Version bscoreVer;
    Version firmwareVer;
    char kernelRev[BS2_KERNEL_REV_LEN];
    char bscoreRev[BS2_BSCORE_REV_LEN];
    char firmwareRev[BS2_FIRMWARE_REV_LEN];
    uint8_t reserved2[32];
} BS2FactoryConfig;

1. deviceID
Device identifier.

2. macAddr
MAC address of the network adaptor.

3. reserved
Reserved space.

4. modelName
Model name.

5. boardVer
Hardware version.

6. kernelVer
Kernel version.

7. bscoreVer
BioStar Core version.

8. firmwareVer
Firmware version.

9. kernelRev
Kernel revision information.

10. bscoreRev
BioStar Core revision information.

11. firmwareRev
Firmware revision information.

12. reserved2
Reserved space.

BS2SystemConfig

BS2_SetSystemConfig must be called after calling BS2_GetSystemConfig and completing necessary settings except for tamperOn.

typedef struct {
    uint8_t notUsed[16 * 16 * 3];
    int32_t timezone;
    uint8_t syncTime;
    uint8_t serverSync;
    uint8_t deviceLocked;
    uint8_t useInterphone;
    uint8_t useUSBConnection;
    uint8_t keyEncrypted;
    uint8_t useJobCode;
    uint8_t useAlphanumericID; 
    uint32_t cameraFrequency; 
    bool secureTamper;private:  
    bool tamperOn;// (write protected) 
    uint8_t reserved[2];uint8_t ​reserved2[20];     
} BS2SystemConfig;

1. notUsed
Not used.

2. timezone
Represents standard time zone in seconds.

3. syncTime
Stores when synchronization with BioStar has occurred.

4. serverSync
Reserved variable.

5. deviceLocked
Decides whether to show lock screen in stand-by mode.

6. useInterphone
Decides whether to use intercom.

7. useUSBConnection
This is not used anymore. (The device automatically detects USB connection.)

8. keyEncrypted
Decides whether to use OSDP secure key.

9. useJobCode
Decides whether to use job codes.

10. useAlphanumericID
Decides whether to use alphanumeric ID.

11. cameraFrequency
Frequency of the camera.

Value Description
1 50Hz
2 60Hz

*12. secureTamper
Flag to determine whether to use a security tamper.
When Tamper on, the following data is deleted from the device. (User, log, data encryption key, SSL certificate)

13. tamperOn
The information to manage the tampering internally, which should not be set.
Be sure to call BS2_SetSystemConfig after completing the necessary settings except for tamperOn after BS2_GetSystemConfig.

14. reserved1
Reserved space.

15. reserved2
Reserved space.

BS2AuthConfig

typedef struct {
    uint32_t authSchedule[BS2_NUM_OF_AUTH_MODE];
    uint8_t useGlobalAPB;
    uint8_t globalAPBFailAction;
    uint8_t useGroupMatching;
    uint8_t reserved
    uint8_t reserved[28];
    uint8_t usePrivateAuth;
    uint8_t faceDetectionLevel;
    uint8_t useServerMatching;
    uint8_t useFullAccess;
    uint8_t matchTimeout;
    uint8_t authTimeout;
    uint8_t numOperators;
    uint8_t reserved2[1];
    struct {
        char userID[BS2_USER_ID_SIZE];
        uint8_t level;
        uint8_t reserved[3];
    } operators[BS2_MAX_OPERATORS];
} BS2AuthConfig;

1. authSchedule
Stores schedules for different types of authentication modes.

It has the following meanings in the value of the array.
If the value in the array is greater than 0, the corresponding authentication mode is enabled.
Biometric information in the descriptions below refers to the fingerprint or face depending on the device.

Value Code Description
0 BS2_AUTH_MODE_BIOMETRIC_ONLY Biometric only
1 BS2_AUTH_MODE_BIOMETRIC_PIN Biometric + PIN
2 BS2_AUTH_MODE_CARD_ONLY Card only
3 BS2_AUTH_MODE_CARD_BIOMETRIC Card + Biometric
4 BS2_AUTH_MODE_CARD_PIN Card + PIN
5 BS2_AUTH_MODE_CARD_BIOMETRIC_OR_PIN Card + Biometric or PIN
6 BS2_AUTH_MODE_CARD_BIOMETRIC_PIN Card + Biometric + PIN
7 BS2_AUTH_MODE_ID_BIOMETRIC ID + Biometric
8 BS2_AUTH_MODE_ID_PIN ID + PIN
9 BS2_AUTH_MODE_ID_BIOMETRIC_OR_PIN ID + Biometric or PIN
10 BS2_AUTH_MODE_ID_BIOMETRIC_PIN ID + Biometric + PIN

2. useGlobalAPB
Decides whether to enable global APB zone.

3. globalAPBFailAction
Default action that will be executed when the BioStar application cannot determine if the authentication has violated global APB rules.

Value Description
0 Not use
1 Operate as soft APB
2 Operate as hard APB

4. useGroupMatching
Decides whether to use face group matching.

5. reserved
Reserved space.

6. usePrivateAuth
Decides whether to use private authentication mode.

7. faceDetectionLevel
Level of face detection in user authentication. If the detected face level is lower than the configuration, it will be processed as authentication fail.

Value Description
0 Face detection not used
1 Normal mode
2 Strict mode

Only valid for devices with a camera.

8. useServerMatching
Decides whether to perform fingerprint/face matchings on the server.

9. useFullAccess
Decides whether to allow full access to all authenticated users regardless to the access group rules.

10. matchTimeout
Timeout in seconds for fingerprint/face matching.

11. authTimeout
Timeout in seconds for the user authentication response.

12. numOperators
The number of operators defining user privileges.

13. reserved2
Reserved space.

14. userID
User identifier.

15. level
Specifies the privilege of the user when accessing to the device's menu.

Value Description
0 No privilege
1 Administrative privilege
2 Privilege to change the system settings
3 Privilege to change user information

CAUTION
To add an operator, the numOperators field needs to be set equivalent to the number of operators that will be added.

16. reserved
Reserved space.


BS2StatusConfig

typedef struct {
    struct {
        uint8_t enabled;
        uint8_t reserved[1];
        uint16_t count;
        BS2LedSignal signal[BS2_LED_SIGNAL_NUM];
    } led[BS2_DEVICE_STATUS_NUM];
    uint8_t reserved1[32];
    struct {
        uint8_t enabled;
        uint8_t reserved[1];
        uint16_t count;
        BS2BuzzerSignal signal[BS2_BUZZER_SIGNAL_NUM];
    } buzzer[BS2_DEVICE_STATUS_NUM];
    uint8_t configSyncRequired;
    uint8_t reserved2[31];
} BS2StatusConfig;

1. enabled
Decides whether to use the LED.

2. reserved
Reserved space.

3. count
Number of LED signal execution count. When it is set as 0, repeats infinitely.

4. signal
List of LED signal patterns, which can be configured up to 3 patterns.

5. reserved1
Reserved space.

6. enabled
Decides whether to use the buzzer.

7. reserved
Reserved space.

8. count
Number of buzzer signal execution count. When it is set as 0, repeats infinitely.

9. signal
List of buzzer signal patterns, which can be configured up to 3 patterns.

10. configSyncRequired
If the device's configuration has been modified, this value will be set to true.

11. reserved2
Reserved space.


BS2DisplayConfig

typedef struct {
    uint32_t language;
    uint8_t background;
    uint8_t volume;
    uint8_t bgTheme;
    uint8_t dateFormat;
    uint16_t menuTimeout;
    uint16_t msgTimeout;
    uint16_t backlightTimeout;
    uint8_t displayDateTime;
    uint8_t useVoice;
    uint8_t timeFormat;
    uint8_t homeFormation;
    uint8_t useUserPhrase;
    uint8_t reserved[1];
    uint8_t shortcutHome[BS2_MAX_SHORTCUT_HOME];
    uint8_t tnaIcon[16];
    uint8_t reserved1[32];
} BS2DisplayConfig;

1. language
Language code.

Value Description
0 Korean
1 English
2 Custom

2. background
Background image type.

Value Description
0 LOGO
1 NOTICE
2 SLIDE
3 PDF

3. volume
The volume of sound. The volume can be set from 0 to 100. 0 means no sound.

4. bgTheme
Theme type.

Value Description
0 Logo image
1 Notice
2 Slide show
3 PDF

5. dateFormat
Date format.

Value Description
0 YYYY/MM/DD
1 MM/DD/YYYY
2 DD/MM/YYYY

6. menuTimeout
Timeout in seconds for lock screen when the user is inactive. The timeout can be set from 0 to 255 seconds. 0 means no lock screen.

7. msgTimeout
Message timeout in milliseconds. The timeout can be set from 500 to 5000 milliseconds.

8. backlightTimeout
Backlight timeout in seconds.

9. displayDateTime
Decides whether to display clock on screen.

10. useVoice
Decides whether to use voice instruction.

11. timeFormat
Time format.

Value Description
0 12 hour
1 24 hour

However, Linux OS devices like BioStation 2, BioStation L2, BioLite N2 and FaceLite have opposite settings.(0 = 24 hour / 1 = 12 hour)

12. homeFormation
Home screen settings(Currently, not used).

Value Description
1 Interphone
2 Shortcut 1
3 Shortcut 2
4 Shortcut 3
5 Shortcut 4

13. useUserPhrase
Flag that determines whether to use the user phrase feature.

14. shortcutHome
Home screen layout(Currently, not used).

15. tnaIcon
Icon displayed on the device corresponding to the job code.

16. reserved1
Reserved space.

BS2IpConfig

typedef struct {
    uint8_t connectionMode;
    uint8_t useDHCP;
    uint8_t useDNS;
    uint8_t reserved[1];
    char ipAddress[BS2_IPV4_ADDR_SIZE];
    char gateway[BS2_IPV4_ADDR_SIZE];
    char subnetMask[BS2_IPV4_ADDR_SIZE];
    char serverAddr[BS2_IPV4_ADDR_SIZE];
    uint16_t port;
    uint16_t serverPort;
    uint16_t mtuSize;
    uint8_t baseband;
    uint8_t reserved2[1];
    uint16_t sslServerPort;
    uint8_t reserved3[30];
} BS2IpConfig;

1. connectionMode
Represents the connection mode between BioStar and devices. There are two modes depending on who initiates the connection: Direct mode (0x0) and Server mode (0x1). The Direct mode means that BioStar initiates the connection to the devices and the Server mode means that the devices initiate the connection to the server. The default connection mode of a device is the Direct mode.

2. useDHCP
Decides whether to use DHCP.

3. useDNS
Decides whether to use server address or server URL.

4. reserved
Reserved space.

5. ipAddress
IP address assigned to the device.

6. gateway
IP address of the gateway.

7. subnetMask
Subnet mask of the device.

8. serverAddr
IP address of BioStar. Used only in the server mode.

9. port
Port number of the device.

10. serverPort
Port number of BioStar. Used only in the server mode.

11. mtuSize
MTU1) size for the TCP/IP communication.

12. baseband
Bandwidth of the device. The value can be set to 10MB/S or 100 MB/S.

13. reserved2
Reserved space.

14. sslServerPort
Used when the connectionMode is set as server SSL mode, which is the port of the SDK application.

15. reserved3
Reserved space.

BS2IpConfigExt

typedef struct {
    char dnsAddr[BS2_IPV4_ADDR_SIZE];
    char serverUrl[BS2_URL_SIZE];
    uint8_t reserved[32];
} BS2IpConfigExt;

1. dnsAddr
DNS server address.

2. serverUrl
URL of the BioStar application server. The maximum length is 256 characters.

3. reserved
Reserved space.

BS2TNAConfig

typedef struct {
    uint8_t tnaMode;
    uint8_t tnaKey;
    uint8_t tnaRequired;
    uint8_t reserved[1];
    uint32_t tnaSchedule[BS2_MAX_TNA_KEY];
    uint8_t unused[BS2_MAX_TNA_KEY];
} BS2TNAInfo;
 
typedef struct {
    char tnaLabel[BS2_MAX_TNA_KEY][BS2_MAX_TNA_LABEL_LEN];
    uint8_t unused[BS2_MAX_TNA_KEY];
} BS2TNAExtInfo;
 
typedef struct {
    BS2TNAInfo tnaInfo;
    BS2TNAExtInfo tnaExtInfo;
    uint8_t reserved2[32];
} BS2TNAConfig;

1. tnaMode
Time and attendance management mode.

Value Description
0 Not used
1 Applying time and attendance code according to a user
2 Applying time and attendance code according to a T&A schedule
3 Applying the time and attendance code that the previous user has selected
4 Using a fixed time and attendance code

2. tnaKey
Represents time and attendance code. This is mapped to a key on the device.

Device Type T&A Code Mapped Key Value
BioStation 2BS2_TNA_UNSPECIFIED(N/A)0
BS2_TNA_KEY_1F11
BS2_TNA_KEY_2F22
BS2_TNA_KEY_3F33
BS2_TNA_KEY_4F44
BS2_TNA_KEY_515
BS2_TNA_KEY_626
BS2_TNA_KEY_737
BS2_TNA_KEY_848
BS2_TNA_KEY_959
BS2_TNA_KEY_10610
BS2_TNA_KEY_11711
BS2_TNA_KEY_12812
BS2_TNA_KEY_13913
BS2_TNA_KEY_14Call14
BS2_TNA_KEY_15015
BS2_TNA_KEY_16Esc16



3. tnaRequired
Decides whether to time and attendance code entry is mandatory when the time and attendance management mode is set to 1.

4. reserved
Reserved space.

5. tnaSchedule
Specifies a schedule for a time and attendance code.

6. unused
Not used.

7. tnaLabel
A label that shows the meaning of the time and attendance code.

8. unused
Not used.

BS2CardConfig

typedef struct {
    uint8_t primaryKey[6];
    uint8_t reserved1[2];
    uint8_t secondaryKey[6];
    uint8_t reserved2[2];    
    uint16_t startBlockIndex;
    uint8_t reserved[6];
} BS2MifareCard;
 
typedef struct {
    uint8_t primaryKey[8];
    uint8_t secondaryKey[8];   
    uint16_t startBlockIndex;
    uint8_t reserved[6];
} BS2IClassCard;
 
typedef struct {
    uint8_t primaryKey[16];
    uint8_t secondaryKey[16];   
    uint8_t appID[3];
    uint8_t fileID;
    uint8_t encryptionType;
    uint8_t reserved[3];
} BS2DesFireCard;
 
typedef struct {
    uint8_t byteOrder;
    uint8_t useWiegandFormat;
    uint8_t dataType;
    uint8_t useSecondaryKey;
    BS2MifareCard mifare;
    BS2IClassCard iclass;
    BS2DesFireCard desfire;
    uint8_t formatID;
    uint8_t cipher;
    uint8_t reserved[24];
} BS2CardConfig;

1. primaryKey
Primary encryption key to access the Mifare card information.

2. reserved1
Reserved space.

3. secondaryKey
Secondary encryption key to access the Mifare card information.

4. reserved2
Reserved space.

5. startBlockIndex
Start block index on the Mifare data storage.

6. reserved
Reserved space.

7. primaryKey
Primary encryption key to access the iClass card information.

8. secondaryKey
Secondary encryption key to access the iClass card information..

9. startBlockIndex
Start block index on the Mifare data storage.

10. reserved
Reserved space.

11. primaryKey
Primary encryption key to access the DesFire card information.

12. secondaryKey
Secondary encryption key to access the Desfire card information.

13. appID
Application Id that is stored inside the DesFire card for user authentication.

14. fileID
File ID that is stored inside the DesFire card, which will be used by the application to read and write data.

15. encryptionType
Type of data encryption. AES will be supported soon.

Value Description
0 DES/3DES
1 AES

16. reserved
Reserved space.

17. byteOrder
Order of how the byte of the card is stored. When it is set as 0, will function as MSB2). When it is set as 1, will function as LSB3).

18. useWiegandFormat
Decides whether to use Wiegand format.

19. dataType
Type of card data.

Value Description
0 Binary
1 ASCII
2 UTF16
3 BCD

20. useSecondaryKey
Decides whether to use the secondary encryption key.

21. formatID
ID that is used when the card configuration needs to be managed from the database on the BioStar application.

22. cipher
Activates 'Keypad card ID' option.
Default value is 0, it is only valid for XPass D2 Gangbox Keypad type.

Value Description
0 Deactivate
1 Activate

23. reserved5
Reserved space.

BS2FingerprintConfig

typedef struct {
    uint8_t securityLevel;
    uint8_t fastMode;
    uint8_t sensitivity;
    uint8_t sensorMode;
    uint16_t templateFormat;
    uint16_t scanTimeout;
    uint8_t successiveScan;
    uint8_t advancedEnrollment;
    uint8_t showImage;
    uint8_t lfdLevel;
    uint8_t reserved1[32];
} BS2FingerprintConfig;

1. securityLevel
Fingerprint authentication security level. This is used across the system.

Value Description
0 Basic
1 Highly secure
2 The most highly secure

2. fastMode
Fingerprint matching speed.

Value Description
0 Automatic
1 Basic
2 High
3 Very High

3. sensitivity
Sensitivity of the fingerprint sensor.

Value Description
0 Lowest
1 Level 1
2 Level 2
3 Level 3
4 Level 4
5 Level 5
6 Level 6
7 Highest

4. sensorMode
Decides the sensor mode. 0 means the sensor is always on. 1 means the sensor is activated when the finger is near the sensor.

5. templateFormat
Fingerprint template type.

Value Description
0 Suprema
1 ISO
2 ANSI

6. scanTimeout
Fingerprint scanning timeout in seconds. The default is 10 seconds.

7. successiveScan
Not Used.

8. advancedEnrollment
Decides whether to utilize fingerprint quality information. If the option is disabled, the BS_SDK_ERROR_CAPTURE_LOW_QUALITY / BS_SDK_ERROR_EXTRACTION_LOW_QUALITY error codes are not returned even if the quality of fingerprint image acquired is low.

9. showImage
Decides whether to display scanned fingerprint image on the screen.

10. lfdLevel
Configuration for the LFD sensitivity.

Value Description
0 Not Use
1 Strict
2 More Strict
3 Most Strict

11. reserved1
Reserved space.

BS2Rs485Config

typedef struct {
    uint32_t baudRate;
    uint8_t channelIndex;
    uint8_t useRegistance;
    uint8_t numOfDevices;
    uint8_t reserved[1];
    BS2Rs485SlaveDevice slaveDevices[BS2_RS485_MAX_SLAVES_PER_CHANNEL];
} BS2Rs485Channel;
 
typedef struct {
    uint8_t mode;
    uint8_t numOfChannels;
    uint8_t reserved[2];
    uint8_t reserved1[32];
    BS2Rs485Channel channels[BS2_RS485_MAX_CHANNELS];
} BS2Rs485Config;

1. baudRate
The RS-485 communication speed which can be configured as below.

Value
9600
19200
38400
57600
115200

2. channelIndex
Communication channel index of the RS-485 network.

3. useRegistance
Decides whether to use a resistance.

4. numOfDevices
Number of slave devices.

5. slaveDevices
List of slave devices, which can be configured up to 32 devices.

6. mode
Decides the operating mode on the RS-485 network.

Value Description
0 Not use
1 Master
2 Slave
3 Standalone

7. numOfChannels
Number of RS-485 channel.

8. reserved
Reserved space.

9. reserved1
Reserved space.

10. channels
List of RS-485 channels, which can be configured up to 4 channels.

BS2WiegandConfig

typedef struct {
    uint32_t length;
    uint8_t idFields[BS2_WIEGAND_MAX_FIELDS][BS2_WIEGAND_FIELD_SIZE];
    uint8_t parityFields[BS2_WIEGAND_MAX_PARITIES][BS2_WIEGAND_FIELD_SIZE];
    BS2_WIEGAND_PARITY parityType[BS2_WIEGAND_MAX_PARITIES];
    uint8_t parityPos[BS2_WIEGAND_MAX_PARITIES];
} BS2WiegandFormat;
 
typedef struct {
    uint8_t mode;
    uint8_t useWiegandBypass;
    uint8_t useFailCode;
    uint8_t failCode;
    uint16_t outPulseWidth;
    uint16_t outPulseInterval;
    uint32_t formatID;
    BS2WiegandFormat format;
    uint16_t wiegandInputMask;
    uint16_t wiegandCardMask;
    uint8_t wiegandCSNIndex;
    uint8_t reserved[27];
} BS2WiegandConfig;

1. length
The length of the wiegand card format.

2. idFields
You can set 4 id fields maximum. Each field's id needs to be inserted from the beginning to the end starting from the end of the array. For example, Standard 26bit wiegand card data is made up as “P FFFFFFFF NNNNNNNNNNNNNNNN P”. The Facility Code is “0 11111111 0000000000000000 0”, so it has the value of 0x01FE0000, and the Card Number has the value of 0x0001FFFE.

// for Facillity Code
idFields[0][28] = 0x01; 
idFields[0][29] = 0xFE; 
idFields[0][30] = 0x00; 
idFields[0][31] = 0x00; 
 
// for Card Number
idFields[1][28] = 0x00;
idFields[1][29] = 0x01;
idFields[1][30] = 0xFF;
idFields[1][31] = 0xFE;

3. parityFields
You can set 4 parity fields maximum, and enter the beginning and the end of the range where to check the parity.

4. parityType
Set the parity type.

Value Description
0 Does not check parity
1 check odd parity
2 check even parity

5. parityPos
Select the position of the parity bit on the wiegand card data.

6. mode
Set the wiegand Input/Output mode.

Value Description
0 Input
1 Output
2 In/Output

7. useWiegandBypass
The flag that indicates whether to send out a card data.

Value Description
0 Output when authenticated.
1 Output without authentication.

8. useFailCode
The flag that indicates whether to send out a fail code when a card fails to authenticate.

9. failCode
Fail code value to replace the card data.

Value
0x00
0xFF

10. outPulseWidth
Output pulse width having a range of 20 ~ 100 us.

11. outPulseInterval
Output pulse frequency having a range of 200 ~ 20000 us.

12. formatID
The value used to distinguish the wiegand card format in the application, and this is not used from the device.

13. format
Wiegand format structure.

14. wiegandInputMask
Input mask for the wiegand input of the slave and wiegand device.

15. wiegandCardMask
Input mask for the wiegand input of the master device.

16. wiegandCSNIndex
Index that determines in which format the device will send out a wiegand ouput after the card has been read. This field is used only for Mifare and EM devices. Please check the useWiegandFormat field of the BS2CardConfig structure before configuring.

17. reserved
Reserved space

BS2WiegandDeviceConfig

typedef struct {
    uint32_t deviceID;
    uint16_t port;
    uint8_t switchType;
    uint8_t reserved[1];
} BS2WiegandTamperInput;
 
typedef struct {
    uint32_t deviceID;
    uint16_t port;
    uint8_t reserved[10];
} BS2WiegandLedOutput;
 
typedef struct {
    uint32_t deviceID;
    uint16_t port;
    uint8_t reserved[34];
} BS2WiegandBuzzerOutput;
 
typedef struct {
    BS2WiegandTamperInput tamper;
    BS2WiegandLedOutput led[BS2_WIEGAND_STATUS_NUM];
    BS2WiegandBuzzerOutput buzzer;
    uint32_t reserved[32];
} BS2WiegandDeviceConfig;

1. deviceID
ID of the device which will receive the tamper signal of the Wiegand card reader.

2. port
Input port for the Wiegand card reader's tamper.

3. switchType
If the switch type is normally open, and the input isgnal is on, it will set off the trigger.

Value Description
0Normally open
1Normally closed

4. reserved
Reserved space.

5. deviceID
ID of the device which will send the LED signal to the Wiegand card reader.

6. port
Output port for the Wiegand card reader's LED signal.

7. reserved
Reserved space.

8. deviceID
ID of the device which will send the buzzer signal to the Wiegand card reader.

9. port
Output port for the Wiegand card reader's buzzer signal.

10. reserved
Reserved space.

10. led
List of devices sending LED signals of the Wiegand card reader, which can be configured up to 2 devices.

Value Description
0 Red LED
1 Green LED

BS2InputConfig

typedef struct {
    uint16_t minValue;
    uint16_t maxValue;
} BS2SVInputRange;
 
typedef struct {
    uint32_t deviceID;
    uint16_t port;
    uint8_t reserved[10];
} BS2WiegandLedOutput;
 
typedef struct {
    BS2SVInputRange shortInput;
    BS2SVInputRange openInput;
    BS2SVInputRange onInput;
    BS2SVInputRange offInput;
} BS2SupervisedInputConfig;
 
typedef struct {
    uint8_t numInputs;
    uint8_t numSupervised;
    uint16_t reseved;
    struct {
        uint8_t portIndex;
        uint8_t enabled;
        uint8_t supervised_index;
        uint8_t reserved[5];
        BS2SupervisedInputConfig config;
    } supervised_inputs[BS2_MAX_INPUT_NUM];
} BS2InputConfig;

1. minValue
Minimum voltage which has a range from 0 ~ 3300(3.3v).

2. maxValue
Maximum voltage which has a range from 0 ~ 3300(3.3v).

3. shortInput
Range of the voltage which will be distinguished as short input.

4. openInput
Range of the voltage which will be distinguished as open input.

5. onInput
Range of the voltage which will be distinguished as on input.

6. offInput
Range of the voltage which will be distinguished as off input.

7. numInputs
Number of input ports.

8. numSupervised
Number of the supervised input ports.

9. portIndex
Input port number.

10. enabled
Decides whether to use as a supervised input.

11. supervised_index
Type of supervised input's resistance value.

Value Description
0 1k resistance
1 2.2k resistance
2 4.7k resistance
3 10k resistance
255 Custom

12. reserved
Reserved space.

13. config
Configuration that distinguishes the supervised input signal type. This configuration will be valid only when the supervised input's resistance is set as custom .

BS2WlanConfig

typedef struct {
    uint8_t enabled;
    uint8_t operationMode;
    uint8_t authType;
    uint8_t encryptionType;
    char essid[BS2_WLAN_SSID_SIZE];
    char authKey[BS2_WLAN_KEY_SIZE];
    uint8_t reserved2[32];
} BS2WlanConfig;

1. enabled
Decides whether to use the wireless LAN.

2. operationMode
Type of wireless LAN.

Value Description
0 infrastructure
1 Ad-hoc

3. authType
Type of Wireless LAN authentication.

Value Description
0 Open
1 Shared
2 WPA-PSK
3 WPA2-PSK

4. encryptionType
Type of wireless LAN encryption.

Value Description
0 None
1 WEP
2 TKIP/AES
3 AES
3 TKIP

5. essid
ESS ID of the wireless network.

6. authKey
Password of the wireless network.

7. reserved
Reserved space.

BS2Trigger

typedef struct {
    uint16_t code;
    uint8_t reserved[2];
} BS2EventTrigger;
 
typedef struct {
    uint8_t port;
    uint8_t switchType;
    uint16_t duration;
    uint32_t scheduleID;
} BS2InputTrigger;
 
typedef struct {
    uint32_t type;
    uint32_t scheduleID;
} BS2ScheduleTrigger;
 
typedef struct {
    uint32_t deviceID;
    uint8_t type;
    uint8_t reserved[3];
 
    union {
        BS2EventTrigger event;
        BS2InputTrigger	input;
        BS2ScheduleTrigger schedule;
    }
} BS2Trigger;

1. code
Event log that will set off the trigger.

2. reserved
Reserved space.

3. port
Input port number that will set off the trigger.

4. switchType
If the switch type is normally open, and the input isgnal is on, it will set off the trigger.

Value Description
0Normally open
1Normally closed

5. duration
The duration time of the signal that will set off the trigger. The unit of time is milliseconds and the minimum value is 100.

6. scheduleID
ID of the time schedule when to operate the trigger.

7. type
Type of the schedule trigger.

Value Description
0Start schedule trigger
1End schedule trigger

8. scheduleID
ID of the time schedule when to operate the trigger.

9. deviceID
ID of the device that will perform the trigger.

10. type
Type of trigger.

Value Description
0None
1Event trigger
2Input trigger
3Schedule trigger

BS2Action

typedef struct {
    uint32_t signalID;
    uint16_t count;
    uint16_t onDuration;
    uint16_t offDuration;
    uint16_t delay;
} BS2Signal;
 
typedef struct {
    uint8_t portIndex;
    uint8_t reserved[3];
    BS2Signal signal;
} BS2OutputPortAction;
 
typedef struct {
    uint8_t relayIndex;
    uint8_t reserved[3];
    BS2Signal signal;
} BS2RelayAction;
 
typedef struct {
    uint8_t color;
    uint8_t reserved[1];
    uint16_t duration;
    uint16_t delay;
} BS2LedSignal;
 
typedef struct {
    uint16_t count;
    uint8_t reserved[2];
    BS2LedSignal signal[3];
} BS2LedAction;
 
typedef struct {
    uint8_t tone;
    uint8_t fadeout;
    uint16_t duration;
    uint16_t delay;
} BS2BuzzerSignal;
 
typedef struct {
    uint16_t count;
    uint8_t reserved[2];
    BS2BuzzerSignal signal[3];
} BS2BuzzerAction;
 
typedef struct {
    uint8_t duration;
    uint8_t reserved[3];
    uint32_t displayID;
    uint32_t resourceID;
} BS2DisplayAction;
 
typedef struct {
    uint8_t count;
    uint16_t soundIndex;
    uint8_t reserved[5];
} BS2SoundAction;
 
typedef struct {
    uint32_t deviceID;
    uint8_t type;
    uint8_t ​stopFlag;
    uint16_t delay;
    union {
        BS2RelayAction relay;
        BS2OutputPortAction outputPort;
        BS2DisplayAction display;
        BS2SoundAction sound;
        BS2LedAction led;
        BS2BuzzerAction buzzer;
    };
} BS2Action;

1. signalID
Index that is used to manage the signal type from the application.

2. count
Number of signal execution count.

3. onDuration
Duration of the ON signal. The unit of time is milliseconds.

4. offDuration
Duration of the OFF signal. The unit of time is milliseconds.

5. delay
Delay time before the signal starts. The unit of time is milliseconds/ For example, count(2), onDuration(100), offDuration(100), delay(50) will execute a signal as below.

50ms waitsignal on(100)signal off(100)signal on(100)signal off(100)

6. portIndex
Number of the TTL output port.

7. reserved
Reserved Space.

8. relayIndex
Number of the TTL output port.

9. reserved
Reserved Space.

10. color
LED colory type.

Value Description
0LED Off
1Red LED
2Yellow LED
3Green LED
4Blue-Green LED
5Blue LED
6Magenta LED
7White LED

11. reserved
Reserved space.

12. duration
Duration of the LED. The unit of time is milliseconds.

13. delay
Delay before the LED flickers. The unit of time is milliseconds.

14. count
Number of LED signal count. When set as 0 it is disabled, and when set as -1 it will repeat infinitely.

15. reserved
Reserved space.

16. tone
Volume of the buzzer.

Value Description
0No sound
1Low
2Medium
3High

17. count
Number of buzzer signal count. When set as 0 it is disabled, and when set as -1 it will repeat infinitely.

18. reserved
Reserved space.

19. duration
Duration of the display operation. The unit of time is milliseconds.

20. reserved
Reserved space.

21. displayID
Not supported yet.

22. resourceID
Not supported yet.

23. count
Number of the sound signal count.

24. soundIndex
Index of the sound resource.

Value Description
0Welcome sound
1Auth success sound
2Auth fail sound

25. deviceID
ID of the device that will execute the action.

26. type
Action types.

Value Description
0None
1Lock device
2Unlock device
3Reboot device
4Release alarm
5General input
6Relay action
7TTL action
8Sound action
9Display action
10Buzzer action
11Led action
12Fire alarm input

27. stopFlag
Specifies the condition to stop the Action.
If this value is set to 1 and the signal is detected through the door sensor, the action will stop.
If this value is set to 2, it can be stopped only by the current action information.
In general, related APIs that stop an action are called with a zone id, in which case all devices in the zone will stop the action.
By setting stopFlag to 2 and and loading action information, you can selectively control only the alarms of that device.

Value Description
0Don't stop
1Stop if door is closed
2Stop by command(Added in V2.6.0)

28. delay
Action delay. Unit is millisecond(ms).

BS2TriggerActionConfig

typedef struct {
    uint8_t numItems;
    uint8_t reserved[3];
    BS2TriggerAction items[BS2_MAX_TRIGGER_ACTION];
    uint8_t reserved2[32];
} BS2TriggerActionConfig;

1. numItems
Number of trigger actions.

2. reserved
Reserved space.

3. items
List of trigger actions, which can be configured up to 128 trigger actions.

4. reserved2
Reserved space.

BS2EventConfig

typedef struct {
    uint32_t numImageEventFilter;
    struct {
        uint8_t mainEventCode;
        uint8_t reserved[3];
        uint32_t scheduleID;
    } imageEventFilter[BS2_EVENT_MAX_IMAGE_CODE_COUNT];
    uint8_t reserved[32];
} BS2EventConfig;

1. numImageEventFilter
Number of image log filters.

2. mainEventCode
Main code of the log where the image log will be placed.

3. reserved
Reserved space.

4. scheduleID
ID of the time schedule when to store the image logs.

5. reserved
Reserved space.

BS2WiegandMultiConfig

typedef struct {
    uint32_t formatID;
    BS2WiegandFormat format;    
    uint8_t reserved[32];       
} BS2WiegandInConfig;
 
typedef struct {    
    BS2WiegandInConfig formats[MAX_WIEGAND_IN_COUNT];    
    uint8_t reserved[32];
} BS2WiegandMultiConfig;

1. formatID
Wiegand format index.

2. format
Wiegand format structure.

3. reserved
Reserved space.

4. formats
Available to configure up to 15 formats.

5. reserved
Reserved space.

BS1CardConfig

typedef struct {
	enum {
		MIFARE_KEY_SIZE = 6,
		MIFARE_MAX_TEMPLATE = 4,
 
		VALID_MAGIC_NO = 0x1f1f1f1f,
	};
 
	// Options
	uint32_t 	magicNo;
	uint32_t 	disabled;
	uint32_t 	useCSNOnly; 		// default 0
	uint32_t 	bioentryCompatible; // default 0
 
	// Keys
	uint32_t	useSecondaryKey;
	uint32_t 	reserved1;
	uint8_t 	primaryKey[MIFARE_KEY_SIZE];
	uint8_t		reserved2[2];
	uint8_t 	secondaryKey[MIFARE_KEY_SIZE];
	uint8_t		reserved3[2];
 
	// Layout
	uint32_t 	cisIndex;
	uint32_t 	numOfTemplate;
	uint32_t 	templateSize;
	uint32_t 	templateStartBlock[MIFARE_MAX_TEMPLATE];
 
	uint32_t 	reserve4[15];
 
} BS1CardConfig;

1. magicNo
Not used.

2. disabled
Not used.

3. useCSNOnly
Flag that indicates whether to read the v1 ToC cards.

4. bioentryCompatible
Not used.

5. useSecondaryKey
Not used.

6. reserved1
Reserved space.

7. primaryKey
Not used.

8. reserved2
Reserved space.

9. secondaryKey
Not used.

10. reserved3
Reserved Space.

11. cisIndex
Not used.

12. numOfTemplate
Number of template that is used.

13. templateSize
Size of each template.

14. templateStartBlock
Not used.

15. reserve4
Reserved Space.

BS2SystemConfigExt

typedef struct {
	uint8_t primarySecureKey[SEC_KEY_SIZE];
	uint8_t secondarySecureKey[SEC_KEY_SIZE];
 
	uint8_t reserved3[32];                               
} BS2SystemConfigExt;

1. primarySecureKey
Primary encryption key used between master and slave devices.

2. secondarySecureKey
Secondary encryption key used between master and slave devices.

3. reserved3
Reserved space.

BS2VoipConfig

typedef struct {
	BS2_URL			serverUrl;			/// 
	BS2_PORT		serverPort;			/// 
	BS2_USER_ID		userID;				/// 
	BS2_USER_ID		userPW;				/// 
 
	uint8_t			exitButton;			/// << *, #, 0~9
	uint8_t			dtmfMode;			/// 
	BS2_BOOL		bUse;				/// 
	uint8_t			reseverd[1];		/// 
 
        uint32_t                numPhonBook;        
	BS2UserPhoneItem 	phonebook[BS2_VOIP_MAX_PHONEBOOK];  /// 
 
	uint8_t                 reserved2[32];		///
} BS2VoipConfig;

1. serverUrl
URL of the SIP server.

2. serverPort
Port number of the SIP server.

3. userID
User ID to access the SIP server.

4. userPW
Password that is used to access the SIP server.

5. exitButton
Button to be used as an exit button. (*, #, 0~9)

Value Description
0 *
1 #
2 ~ 11 0 ~ 9

6. dtmfMode
Tone of the keypad.

7. bUse
Flag that determines whether the VoIP feature is used.

8. reseverd
Reserved space.

9. numPhonBook
Number of phone books.

10. phonebook
List of extension numbers, which can be configured up to 32.

8. reserved2
Reserved space.

BS2FaceConfig

typedef struct {
	BS2_FACE_SECURITY_LEVEL       securityLevel;	
	BS2_FACE_LIGHT_CONDITON       lightCondition;			
	BS2_FACE_ENROLL_THRESHOLD     enrollThreshold;			
	BS2_FACE_DETECT_SENSITIVITY   detectSensitivity;	
 
	uint16_t                      enrollTimeout;	
	uint8_t                       reserved3[32];						
} BS2FaceConfig;

1. securityLevel
Face authentication security level. This is used across the system. .

Value Description
0 Basic
1 Highly secure
2 Most highly secure

2. lightCondition
Configuration of the light condition.

Value Description
0 Indoor
1 Outdoor
2 Automatic

3. enrollThreshold
Threshold of face enrollment.

Value Description
0 THRESHOLD_0
1 THRESHOLD_1
2 THRESHOLD_2
3 THRESHOLD_3
4 THRESHOLD_4 (Default)
5 THRESHOLD_5
6 THRESHOLD_6
7 THRESHOLD_7
8 THRESHOLD_8
9 THRESHOLD_9

4. detectSensitivity
Configuration of sensitivity on detecting the face.

Value Description
0 Off
1 Low
2 Basic
3 High

5. enrollTimeout
Timeout period of face scanning which is 60 seconds by default.

6. reserved3
Reserved space.

BS2Rs485ConfigEX

typedef struct {
    uint32_t baudRate;
    uint8_t channelIndex;
    uint8_t useRegistance;
    uint8_t numOfDevices;
    uint8_t reserved[1];
    BS2Rs485SlaveDeviceEX slaveDevices[BS2_RS485_MAX_SLAVES_PER_CHANNEL];
} BS2Rs485ChannelEX;
 
typedef struct {
    uint8_t mode[BS2_RS485_MAX_CHANNELS_EX];
    uint8_t numOfChannels;
    uint8_t reserved[2];
    uint8_t reserved1[32];
    BS2Rs485ChannelEX channels[BS2_RS485_MAX_CHANNELS];
} BS2Rs485ConfigEX;

1. baudRate
The RS-485 communication speed which can be configured as below.

Value
9600
19200
38400
57600
115200

2. channelIndex
Communication channel index of the RS-485 network.

3. useRegistance
Decides whether to use a resistance.

4. numOfDevices
Number of slave devices.

5. slaveDevices
List of slave devices, which can be configured up to 32 devices.

6. mode
Decides the operating mode on the RS-485 network.

Value Description
0 Not use
1 Master
2 Slave
3 Standalone

7. numOfChannels
Number of RS-485 channel.

8. reserved
Reserved space.

9. reserved1
Reserved space.

10. channels
List of RS-485 channels, which can be configured up to 8 channels.

BS2CardConfigEx

typedef struct {
    uint8_t oid_ADF[13];			///   //valid value//{0x2A,0x85,0x70,0x81,0x1E,0x10,0x00,0x07,0x00,0x00,0x02,0x00,0x00}                          
    uint8_t size_ADF;				//
    uint8_t reserved1[2];			///
    uint8_t oid_DataObjectID[8];		
    uint16_t size_DataObject[8];		
    uint8_t primaryKeyAuth[16];			//valid value
    uint8_t secondaryKeyAuth[16];		/// //valid value
    uint8_t reserved2[24];
} BS2SeosCard;
typedef struct {
    BS2SeosCard seos;	
    uint8_t reserved[24];
} BS2CardConfigEx;

1. oid_ADF
ADF Address (Non changable)

2. size_ADF
ADF size

3. reserved1
Reserved sapce

4. oid_DataObjectID
DataObject ID

5. size_DataObject
DataObject size

6. primaryKeyAuth
Primary encryption key to access the Seoscard information

7. secondaryKeyAuth
Secondary encryption key to access the Seoscard information

8. reserved2
Reserved space

9. seos
BS2SeosCard information

10. reserved
Reserved space

BS2DstConfig

enum {
	BS2_MAX_DST_SCHEDULE = 2,
};
 
typedef struct {
	uint16_t year;		// year, 0 means every year.
	uint8_t month;		// [0, 11] : months since January
	int8_t ordinal;		// [0, -1] : first, second, ..., last
	uint8_t weekDay;	// [0, 6] : days since Sunday
	uint8_t hour;		// [0, 23]
	uint8_t minute;		// [0, 59]
	uint8_t second;		// [0, 59]
} BS2WeekTime;
 
typedef struct {
	BS2WeekTime startTime;
	BS2WeekTime endTime;
	int32_t timeOffset;	// in seconds
	uint8_t reserved[4];
} BS2DstSchedule;
 
typedef struct {
	uint8_t numSchedules;
	uint8_t reserved[31];
 
	BS2DstSchedule schedules[BS2_MAX_DST_SCHEDULE];
} BS2DstConfig;

1. year
Means year, and if set to 0, it means yearly.

2. month
Means month, and has a value between 0 and 11 [January-December].

3. ordinal
It starts with 0 and means the order of first, second, etc.

4. weekDay
Day of the week, 0 means Sunday, 1 means Monday.

5. hour
Specifies the time in 24-hour format.

6. minute
Specifies the minute.

7. second
Specifies the seconds.

8. startTime
It means start date and time.

9. endTime
It means the end date.

10. timeOffset
You can apply the DST time in seconds.
For example, if you want to apply 1 hour, enter 3600.

11. reserved
Reserved space.

12. numSchedules
The number of DST schedules to apply.

13. schedules
DST schedule, up to two can be specified.

BS2Configs

typedef struct {
    uint32_t configMask;
    BS2FactoryConfig factoryConfig;
    BS2SystemConfig systemConfig;
    BS2AuthConfig authConfig;
    BS2StatusConfig statusConfig;
    BS2DisplayConfig displayConfig;
    BS2IpConfig ipConfig;
    BS2IpConfigExt ipConfigExt;
    BS2TNAConfig tnaConfig;
    BS2CardConfig cardConfig;
    BS2FingerprintConfig fingerprintConfig;
    BS2Rs485Config rs485Config;
    BS2WiegandConfig wiegandConfig;
    BS2WiegandDeviceConfig wiegandDeviceConfig;
    BS2InputConfig inputConfig;
    BS2WlanConfig wlanConfig;
    BS2TriggerActionConfig triggerActionConfig;
    BS2EventConfig eventConfig;
    BS2WiegandMultiConfig wiegandMultiConfig;
    BS1CardConfig card1xConfig;
    BS2SystemConfigExt systemExtConfig;
    BS2VoipConfig voipConfig;
    BS2FaceConfig faceConfig;
} BS2Configs;

1. configMask
Mask value of the configuration to be retrieved or set.

Value Description
0x0000None
0x0001Factory configuration
0x0002System configuration
0x0004TCP/IP configuration
0x0008RS485 configuration
0x0010Wireless LAN configuration
0x0020Authentication configuration
0x0040Card configuration
0x0080Fingerprint configuration
0x0100Face configuration
0x0200Trigger Action configuration
0x0400Display configuration
0x0800Sound configuration
0x1000Status Signal(LED, Buzzer) configuration
0x2000Wiegand configuration
0x4000USB configuration
0x8000Time and Attendance configuration
0x10000Videophone configuration
0x20000Interphone configuration
0x40000Voice over IP configuration
0x80000Input(Supervised input) configuration
0x100000Wiegand IO Device configuration
0x200000Time and Attendance configuration
0x400000DNS and Server url configuration
0x800000Event configuration
0x10000001x Card configuration
0x2000000Multi-Wiegand configuration
0x4000000Extended System configuration
0x8000000Daylight Saving configuration (Deprecated)
0x10000000RS485 Extended configuration
0x20000000Extended Card configuration
0x40000000Daylight Saving configuration
0xFFFFFFFFAll configuration
1)
Maximum Transmission Unit
2)
Most Significant Bit
3)
Least Significant Bit