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:14] mark [샘플코드(C++)] |
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 36: | 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 71: | 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 95: | 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 106: | 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 141: | 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> | ||