차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
다음 판 | 이전 판 | ||
ko:bs2_partialupdateuserfaceex [2022/08/25 10:23] kkshin 만듦 |
ko:bs2_partialupdateuserfaceex [2024/05/28 17:22] (현재) kkshin [파라미터] |
||
---|---|---|---|
줄 7: | 줄 7: | ||
[+ 2.8.3] 이미 등록된 사용자의 부분 정보를 갱신합니다. 갱신하고자 하는 사용자는 이미 등록된 존재하는 사용자이어야 합니다. \\ | [+ 2.8.3] 이미 등록된 사용자의 부분 정보를 갱신합니다. 갱신하고자 하는 사용자는 이미 등록된 존재하는 사용자이어야 합니다. \\ | ||
갱신하고자 하는 부분 정보는 mask를 이용해 선택적으로 지정할 수 있습니다. \\ | 갱신하고자 하는 부분 정보는 mask를 이용해 선택적으로 지정할 수 있습니다. \\ | ||
- | 부분 정보를 삭제하고자하는 경우, [[user_management_api#BS2User]]의 infoMask와 조합하여 삭제할 수 있습니다. | + | 부분 정보를 삭제하고자 하는 경우, [[user_management_api#BS2User]]의 infoMask와 조합하여 삭제할 수 있습니다. |
\\ | \\ | ||
==== 함수 ==== | ==== 함수 ==== | ||
줄 35: | 줄 35: | ||
|0x0200 |작업코드 | | |0x0200 |작업코드 | | ||
|0x0400 |개인메시지 | | |0x0400 |개인메시지 | | ||
- | |0x0800 |얼굴 ''(FSF2, BS3)'' | | + | |0x0800 |얼굴 ''(Visual Face 지원)'' | |
- | |0x1000 |사용자설정 ''(FSF2, BS3)'' | | + | |0x1000 |사용자설정 ''(Visual Face 지원)'' | |
</WRAP> | </WRAP> | ||
* [In] ''//userBlob//'' : 갱신하고자 하는 사용자 부분 정보 | * [In] ''//userBlob//'' : 갱신하고자 하는 사용자 부분 정보 | ||
줄 51: | 줄 51: | ||
[[BS2_PartialUpdateUserSmallEx]]\\ | [[BS2_PartialUpdateUserSmallEx]]\\ | ||
[[BS2_PartialUpdateUserFaceEx]] | [[BS2_PartialUpdateUserFaceEx]] | ||
- | ==== 샘플코드 ==== | + | ==== 샘플코드(C++) ==== |
- | C++ | + | <file cpp sample_partialupdateuserfaceex.cpp> |
- | <file cpp sample.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; | ||
int sdkResult = BS_SDK_SUCCESS; | int sdkResult = BS_SDK_SUCCESS; | ||
줄 72: | 줄 71: | ||
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; |
} | } | ||
줄 96: | 줄 95: | ||
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; | ||
} | } | ||
줄 107: | 줄 123: | ||
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> | ||
- | + | ==== 샘플코드(C#) ==== | |
- | C# | + | <file csharp sample_partialupdateuserfaceex.cs> |
- | <code cpp> | + | BS2_USER_MASK maskWantUpdate = (BS2_USER_MASK)BS2UserMaskEnum.SETTING | (BS2_USER_MASK)BS2UserMaskEnum.SETTING_EX | (BS2_USER_MASK)BS2UserMaskEnum.JOB; |
- | BS2_USER_MASK mask = (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; | ||
줄 142: | 줄 179: | ||
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); | ||
- | </code> | + | </file> |