Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:bs2_partialupdateuserfaceex [2022/09/07 11:09] mark [BS2_PartialUpdateUserFaceEx] |
en:bs2_partialupdateuserfaceex [2024/05/28 17:25] (current) kkshin |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | FIXME **This page is not fully translated, yet. Please help completing the translation.**\\ //(remove this paragraph once the translation is finished)// | ||
- | |||
~~NOTOC~~ | ~~NOTOC~~ | ||
[[user_management_api]] > [[BS2_PartialUpdateUserFaceEx]] | [[user_management_api]] > [[BS2_PartialUpdateUserFaceEx]] | ||
Line 10: | Line 8: | ||
You can optionally specify the partial information you want to update using the mask. \\ | You can optionally specify the partial information you want to update using the mask. \\ | ||
If you want to delete partial information, you can delete it in combination with [[user_management_api#BS2User]] infoMask. \\ | If you want to delete partial information, you can delete it in combination with [[user_management_api#BS2User]] infoMask. \\ | ||
- | ==== 함수 ==== | + | ==== Declaration ==== |
<code cpp> | <code cpp> | ||
#include "BS_API.h" | #include "BS_API.h" | ||
Line 18: | Line 16: | ||
<callout type="info"> | <callout type="info"> | ||
- | [[user management api#BS2UserFaceExBlob|BS2UserFaceExBlob 구조체 보기]] | + | [[user management api#BS2UserFaceExBlob|See BS2UserFaceExBlob structure]] |
</callout> | </callout> | ||
- | ==== 파라미터 ==== | + | ==== Parameter ==== |
* [In] ''//context//'' : Context | * [In] ''//context//'' : Context | ||
- | * [In] ''//deviceId//'' : 장치 식별자 | + | * [In] ''//deviceId//'' : Device ID |
- | * [In] ''//mask//'' : 갱신하고자 하는 사용자 부분에 대한 mask | + | * [In] ''//mask//'': Mask for the part of the user you want to update |
<WRAP group 50%> | <WRAP group 50%> | ||
- | ^값 ^설명 ^ | + | ^Value ^Description ^ |
- | |0x0002 |사용자설정(개인인증모드,유효기간) | | + | |0x0002 |User settings (personal authentication mode, validity period) | |
- | |0x0004 |사용자명 | | + | |0x0004 |User Name | |
- | |0x0008 |이미지 | | + | |0x0008 |Image | |
|0x0010 |PIN | | |0x0010 |PIN | | ||
- | |0x0020 |카드 | | + | |0x0020 |Card | |
- | |0x0040 |지문 | | + | |0x0040 |Fingerprint | |
- | |0x0080 |얼굴 | | + | |0x0080 |Face | |
- | |0x0100 |출입그룹 | | + | |0x0100 |Access group | |
- | |0x0200 |작업코드 | | + | |0x0200 |Jobcode | |
- | |0x0400 |개인메시지 | | + | |0x0400 |Private Message | |
- | |0x0800 |얼굴 ''(FSF2, BS3)'' | | + | |0x0800 |Face ''(Visual Face Support)'' | |
- | |0x1000 |사용자설정 ''(FSF2, BS3)'' | | + | |0x1000 |User setting ''(Visual Face Support)'' | |
</WRAP> | </WRAP> | ||
- | * [In] ''//userBlob//'' : 갱신하고자 하는 사용자 부분 정보 | + | * [In] ''//userBlob//'' : Partial user information you want to update |
- | * [In] ''//userCount//'' : 사용자 개수 | + | * [In] ''//userCount//'' : Number of users |
\\ | \\ | ||
- | ==== 반환값 ==== | + | ==== Return Value ==== |
- | 성공적으로 수행될 경우 ''BS_SDK_SUCCESS''를 반환하고, ''BS2_EVENT_USER_UPDATE_PARTIAL_SUCCESS'' 이벤트가 발생됩니다. \\ | + | If successful, return ''BS_SDK_SUCCESS'' and generate ''BS2_EVENT_USER_UPDATE_PARTIAL_SUCCESS'' event. \\ |
- | 실패했을 경우 상응하는 에러 코드를 반환하고, 장치 발생 오류라면 ''BS2_EVENT_USER_UPDATE_PARTIAL_FAIL'' 이벤트가 발생됩니다. | + | If it fails, it returns a corresponding error code, and if it is a device occurrence error, the event ''BS2_EVENT_USER_UPDATE_PARTIAL_FAIL'' is generated.\\ |
- | \\ | + | ==== See Also ==== |
- | ==== 함께 보기 ==== | + | |
[[BS2_PartialUpdateUser]]\\ | [[BS2_PartialUpdateUser]]\\ | ||
[[BS2_PartialUpdateUserEx]]\\ | [[BS2_PartialUpdateUserEx]]\\ | ||
Line 52: | Line 49: | ||
[[BS2_PartialUpdateUserSmallEx]]\\ | [[BS2_PartialUpdateUserSmallEx]]\\ | ||
[[BS2_PartialUpdateUserFaceEx]] | [[BS2_PartialUpdateUserFaceEx]] | ||
- | ==== 샘플코드(C++) ==== | + | ==== Sample Code (C++) ==== |
<file cpp sample_partialupdateuserfaceex.cpp> | <file cpp sample_partialupdateuserfaceex.cpp> | ||
BS2_USER_MASK maskWantUpdate = BS2_USER_MASK_SETTING | BS2_USER_MASK_SETTING_EX | BS2_USER_MASK_JOB; | BS2_USER_MASK maskWantUpdate = BS2_USER_MASK_SETTING | BS2_USER_MASK_SETTING_EX | BS2_USER_MASK_JOB; | ||
Line 72: | Line 69: | ||
if (BS_SDK_SUCCESS != (sdkResult = uc.getUserBlobUserID(user))) | if (BS_SDK_SUCCESS != (sdkResult = uc.getUserBlobUserID(user))) | ||
- | return sdkResult; | + | return sdkResult; |
if ((maskWantUpdate & BS2_USER_MASK_SETTING) == BS2_USER_MASK_SETTING) | if ((maskWantUpdate & BS2_USER_MASK_SETTING) == BS2_USER_MASK_SETTING) | ||
{ | { | ||
- | if (BS_SDK_SUCCESS != (sdkResult = uc.getUserBlobExpiryDate(setting))) | + | if (BS_SDK_SUCCESS != (sdkResult = uc.getUserBlobExpiryDate(setting))) |
- | return sdkResult; | + | return sdkResult; |
- | if (BS_SDK_SUCCESS != (sdkResult = uc.getUserBlobPrivateAuthMode(setting, deviceInfo, deviceInfoEx))) | + | if (BS_SDK_SUCCESS != (sdkResult = uc.getUserBlobPrivateAuthMode(setting, deviceInfo, deviceInfoEx))) |
- | return sdkResult; | + | return sdkResult; |
- | if (BS_SDK_SUCCESS != (sdkResult = uc.getUserBlobSecurityLevel(setting))) | + | if (BS_SDK_SUCCESS != (sdkResult = uc.getUserBlobSecurityLevel(setting))) |
- | return sdkResult; | + | return sdkResult; |
} | } | ||
if ((maskWantUpdate & BS2_USER_MASK_SETTING_EX) == BS2_USER_MASK_SETTING_EX) | if ((maskWantUpdate & BS2_USER_MASK_SETTING_EX) == BS2_USER_MASK_SETTING_EX) | ||
{ | { | ||
- | if (BS_SDK_SUCCESS != (sdkResult = uc.getUserBlobPrivateAuthModeEx(settingEx, deviceInfo, deviceInfoEx))) | + | if (BS_SDK_SUCCESS != (sdkResult = uc.getUserBlobPrivateAuthModeEx(settingEx, deviceInfo, deviceInfoEx))) |
- | return sdkResult; | + | return sdkResult; |
} | } | ||
Line 96: | Line 93: | ||
if ((maskWantUpdate & BS2_USER_MASK_JOB) == BS2_USER_MASK_JOB) | if ((maskWantUpdate & BS2_USER_MASK_JOB) == BS2_USER_MASK_JOB) | ||
{ | { | ||
- | if (BS_SDK_SUCCESS != (sdkResult = uc.getUserBlobJobCode(userBlob.job))) | + | msg.str(""); |
- | return sdkResult; | + | msg << "Do you want to change/delete #" << user.userID << " jobs? (0:Change, 1:Delete)"; |
+ | uint32_t selected = Utility::getInput<uint32_t>(msg.str()); | ||
+ | switch (selected) | ||
+ | { | ||
+ | case 0: | ||
+ | if (BS_SDK_SUCCESS != (sdkResult = uc.getUserBlobJobCode(userBlob.job))) | ||
+ | return sdkResult; | ||
+ | user.infoMask |= BS2_USER_INFO_MASK_JOB_CODE; | ||
+ | break; | ||
- | user.infoMask |= BS2_USER_INFO_MASK_JOB_CODE; | + | case 1: |
+ | default: | ||
+ | maskWantUpdate &= ~BS2_USER_MASK_JOB; | ||
+ | break; | ||
+ | } | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | // Keep | ||
+ | user.infoMask |= BS2_USER_INFO_MASK_JOB_CODE; | ||
} | } | ||
Line 107: | Line 121: | ||
if ((maskWantUpdate & BS2_USER_MASK_CARD) == BS2_USER_MASK_CARD) | if ((maskWantUpdate & BS2_USER_MASK_CARD) == BS2_USER_MASK_CARD) | ||
{ | { | ||
- | // ... | + | msg.str(""); |
+ | msg << "Do you want to change/delete #" << user.userID << " cards? (0:Change, 1:Delete)"; | ||
+ | uint32_t selected = Utility::getInput<uint32_t>(msg.str()); | ||
+ | switch (selected) | ||
+ | { | ||
+ | case 0: | ||
+ | if (BS_SDK_SUCCESS != (sdkResult = uc.getUserBlobCardInfo(&userBlob.cardObjs, user.numCards, id, deviceInfo, deviceInfoEx))) | ||
+ | return sdkResult; | ||
+ | user.infoMask |= BS2_USER_INFO_MASK_CARD; | ||
+ | break; | ||
+ | |||
+ | case 1: | ||
+ | default: | ||
+ | // unmasking and numCards = 0; | ||
+ | maskWantUpdate &= ~BS2_USER_MASK_CARD; | ||
+ | break; | ||
+ | } | ||
} | } | ||
+ | else | ||
+ | { | ||
+ | // Keep | ||
+ | user.infoMask |= BS2_USER_INFO_MASK_CARD; | ||
+ | } | ||
+ | |||
- | int sdkResult = BS2_PartialUpdateUserFaceEx(context, id, maskWantUpdate, &userBlob, 1); | + | sdkResult = BS2_PartialUpdateUserFaceEx(context, id, maskWantUpdate, &userBlob, 1); |
if (BS_SDK_SUCCESS != sdkResult) | if (BS_SDK_SUCCESS != sdkResult) | ||
{ | { | ||
- | TRACE("BS2_PartialUpdateUserFaceEx call failed: %d", sdkResult); | + | TRACE("BS2_PartialUpdateUserFaceEx call failed: %d", sdkResult); |
- | return sdkResult; | + | return sdkResult; |
} | } | ||
</file> | </file> | ||
- | + | ==== Sample Code (C#) ==== | |
- | ==== 샘플코드(C#) ==== | + | |
<file csharp sample_partialupdateuserfaceex.cs> | <file csharp sample_partialupdateuserfaceex.cs> | ||
- | BS2_USER_MASK mask = (BS2_USER_MASK)BS2UserMaskEnum.SETTING | (BS2_USER_MASK)BS2UserMaskEnum.SETTING_EX | (BS2_USER_MASK)BS2UserMaskEnum.JOB; | + | BS2_USER_MASK maskWantUpdate = (BS2_USER_MASK)BS2UserMaskEnum.SETTING | (BS2_USER_MASK)BS2UserMaskEnum.SETTING_EX | (BS2_USER_MASK)BS2UserMaskEnum.JOB; |
BS2ErrorCode sdkResult = BS2ErrorCode.BS_SDK_SUCCESS; | BS2ErrorCode sdkResult = BS2ErrorCode.BS_SDK_SUCCESS; | ||
Line 142: | Line 177: | ||
string userID; | string userID; | ||
if (BS2ErrorCode.BS_SDK_SUCCESS != (sdkResult = getUserBlobUserID(ref userBlob[0].user, out userID))) | if (BS2ErrorCode.BS_SDK_SUCCESS != (sdkResult = getUserBlobUserID(ref userBlob[0].user, out userID))) | ||
- | return; | + | return; |
- | if ((mask & (BS2_USER_MASK)BS2UserMaskEnum.SETTING) == (BS2_USER_MASK)BS2UserMaskEnum.SETTING) | + | if ((maskWantUpdate & (BS2_USER_MASK)BS2UserMaskEnum.SETTING) == (BS2_USER_MASK)BS2UserMaskEnum.SETTING) |
{ | { | ||
- | if (BS2ErrorCode.BS_SDK_SUCCESS != (sdkResult = getUserBlobExpiryDate(ref userBlob[0].setting))) | + | if (BS2ErrorCode.BS_SDK_SUCCESS != (sdkResult = getUserBlobExpiryDate(ref userBlob[0].setting))) |
- | return; | + | return; |
- | if (BS2ErrorCode.BS_SDK_SUCCESS != (sdkResult = getUserBlobPrivateAuthMode(ref userBlob[0].setting))) | + | if (BS2ErrorCode.BS_SDK_SUCCESS != (sdkResult = getUserBlobPrivateAuthMode(ref userBlob[0].setting))) |
- | return; | + | return; |
- | if (BS2ErrorCode.BS_SDK_SUCCESS != (sdkResult = getUserBlobSecurityLevel(ref userBlob[0].setting))) | + | if (BS2ErrorCode.BS_SDK_SUCCESS != (sdkResult = getUserBlobSecurityLevel(ref userBlob[0].setting))) |
- | return; | + | return; |
} | } | ||
- | if ((mask & (BS2_USER_MASK)BS2UserMaskEnum.SETTING_EX) == (BS2_USER_MASK)BS2UserMaskEnum.SETTING_EX) | + | if ((maskWantUpdate & (BS2_USER_MASK)BS2UserMaskEnum.SETTING_EX) == (BS2_USER_MASK)BS2UserMaskEnum.SETTING_EX) |
{ | { | ||
- | if (BS2ErrorCode.BS_SDK_SUCCESS != (sdkResult = getUserBlobPrivateAuthModeEx(ref userBlob[0].settingEx))) | + | if (BS2ErrorCode.BS_SDK_SUCCESS != (sdkResult = getUserBlobPrivateAuthModeEx(ref userBlob[0].settingEx))) |
- | return; | + | return; |
} | } | ||
// ... | // ... | ||
- | if ((mask & (BS2_USER_MASK)BS2UserMaskEnum.JOB) == (BS2_USER_MASK)BS2UserMaskEnum.JOB) | + | if ((maskWantUpdate & (BS2_USER_MASK)BS2UserMaskEnum.JOB) == (BS2_USER_MASK)BS2UserMaskEnum.JOB) |
{ | { | ||
- | if (BS2ErrorCode.BS_SDK_SUCCESS != (sdkResult = getUserBlobJobCode(ref userBlob[0].job))) | + | Console.WriteLine("Do you want to change/delete #{0} jobs? (0:Change, 1:Delete)", userID); |
- | return; | + | Console.Write(">> "); |
+ | int selected = Util.GetInput(0); | ||
+ | switch (selected) | ||
+ | { | ||
+ | case 0: // Change jobs | ||
+ | if (BS2ErrorCode.BS_SDK_SUCCESS != (sdkResult = getUserBlobJobCode(ref userBlob[0].job))) | ||
+ | return; | ||
- | userBlob[0].user.infoMask |= (byte)BS2UserInfoMaskEnum.JOB_CODE; | + | userBlob[0].user.infoMask |= (byte)BS2UserInfoMaskEnum.JOB_CODE; |
+ | break; | ||
+ | |||
+ | case 1: // Delete | ||
+ | default: | ||
+ | maskWantUpdate &= ~(BS2_USER_MASK)BS2UserMaskEnum.JOB; | ||
+ | break; | ||
+ | } | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | // Keep | ||
+ | userBlob[0].user.infoMask |= (byte)BS2UserInfoMaskEnum.JOB_CODE; | ||
} | } | ||
- | |||
- | // ... | ||
userBlob[0].user.numCards = 0; | userBlob[0].user.numCards = 0; | ||
- | if ((mask & (BS2_USER_MASK)BS2UserMaskEnum.CARD) == (BS2_USER_MASK)BS2UserMaskEnum.CARD) | + | if ((maskWantUpdate & (BS2_USER_MASK)BS2UserMaskEnum.CARD) == (BS2_USER_MASK)BS2UserMaskEnum.CARD) |
{ | { | ||
- | // ... | + | Console.WriteLine("Do you want to change/delete #{0} cards? (0:Change, 1:Delete)", userID); |
+ | Console.Write(">> "); | ||
+ | int selected = Util.GetInput(0); | ||
+ | switch (selected) | ||
+ | { | ||
+ | case 0: // Change cards | ||
+ | if (BS2ErrorCode.BS_SDK_SUCCESS != (sdkResult = getUserBlobCardInfo(sdkContext, deviceID, ref userBlob[0].cardObjs, ref userBlob[0].user.numCards))) | ||
+ | return; | ||
+ | |||
+ | userBlob[0].user.infoMask |= (byte)BS2UserInfoMaskEnum.CARD; | ||
+ | break; | ||
+ | |||
+ | case 1: // Delete cards on the device | ||
+ | default: | ||
+ | // unmasking and numCards = 0; | ||
+ | maskWantUpdate &= ~(BS2_USER_MASK)BS2UserMaskEnum.CARD; | ||
+ | break; | ||
+ | } | ||
} | } | ||
+ | else | ||
+ | { | ||
+ | // Keep | ||
+ | userBlob[0].user.infoMask |= (byte)BS2UserInfoMaskEnum.CARD; | ||
+ | } | ||
+ | |||
+ | // ... | ||
- | sdkResult = (BS2ErrorCode)API.BS2_PartialUpdateUserFaceEx(sdkContext, deviceID, mask, userBlob, (UInt32)1); | + | sdkResult = (BS2ErrorCode)API.BS2_PartialUpdateUserFaceEx(sdkContext, deviceID, maskWantUpdate, userBlob, (UInt32)numOfUser); |
if (BS2ErrorCode.BS_SDK_SUCCESS != sdkResult) | if (BS2ErrorCode.BS_SDK_SUCCESS != sdkResult) | ||
Console.WriteLine("BS2_PartialUpdateUserFaceEx call failed {0}", sdkResult); | Console.WriteLine("BS2_PartialUpdateUserFaceEx call failed {0}", sdkResult); | ||
</file> | </file> | ||