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/29 17:07] kkshin |
en:bs2_partialupdateuserfaceex [2024/05/28 17:25] (current) kkshin |
||
---|---|---|---|
Line 34: | Line 34: | ||
|0x0200 |Jobcode | | |0x0200 |Jobcode | | ||
|0x0400 |Private Message | | |0x0400 |Private Message | | ||
- | |0x0800 |Face ''(FSF2, BS3)'' | | + | |0x0800 |Face ''(Visual Face Support)'' | |
- | |0x1000 |User setting ''(FSF2, BS3)'' | | + | |0x1000 |User setting ''(Visual Face Support)'' | |
</WRAP> | </WRAP> | ||
* [In] ''//userBlob//'' : Partial user information you want to update | * [In] ''//userBlob//'' : Partial user information you want to update | ||
Line 69: | 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 93: | 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 104: | 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#) ==== | ==== Sample Code (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 141: | Line 179: | ||
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))) | ||
Line 153: | Line 191: | ||
} | } | ||
- | 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))) | ||
Line 161: | Line 199: | ||
// ... | // ... | ||
- | if ((mask & (BS2_USER_MASK)BS2UserMaskEnum.JOB) == (BS2_USER_MASK)BS2UserMaskEnum.JOB) | + | if ((maskWantUpdate & (BS2_USER_MASK)BS2UserMaskEnum.JOB) == (BS2_USER_MASK)BS2UserMaskEnum.JOB) |
{ | { | ||
Console.WriteLine("Do you want to change/delete #{0} jobs? (0:Change, 1:Delete)", userID); | Console.WriteLine("Do you want to change/delete #{0} jobs? (0:Change, 1:Delete)", userID); | ||
Line 177: | Line 215: | ||
case 1: // Delete | case 1: // Delete | ||
default: | default: | ||
- | mask &= ~(BS2_USER_MASK)BS2UserMaskEnum.JOB; | + | maskWantUpdate &= ~(BS2_USER_MASK)BS2UserMaskEnum.JOB; |
break; | break; | ||
} | } | ||
Line 188: | Line 226: | ||
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.WriteLine("Do you want to change/delete #{0} cards? (0:Change, 1:Delete)", userID); | ||
Line 205: | Line 243: | ||
default: | default: | ||
// unmasking and numCards = 0; | // unmasking and numCards = 0; | ||
- | mask &= ~(BS2_USER_MASK)BS2UserMaskEnum.CARD; | + | maskWantUpdate &= ~(BS2_USER_MASK)BS2UserMaskEnum.CARD; |
break; | break; | ||
} | } | ||
Line 217: | Line 255: | ||
// ... | // ... | ||
- | sdkResult = (BS2ErrorCode)API.BS2_PartialUpdateUserFaceEx(sdkContext, deviceID, mask, userBlob, (UInt32)numOfUser); | + | 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> | ||