~~NOTOC~~
[[user_management_api]] > [[BS2_GetUserStatistic]]
----
===== BS2_GetUserStatistic =====
[+ 2.8.3] Gets the user-related statistics that the device has. \\
==== Declaration ====
#include "BS_API.h"
int BS2_GetUserStatistic(void* context, uint32_t deviceId, BS2UserStatistic* userStatistic);
[[user_management_api#BS2UserStatistic|See BS2UserStatistic Structure]]
==== Parameter ====
* [In] ''//context//'' : Context
* [In] ''//deviceId//'' : Device Id
* [Out] ''//userStatistic//'' : Pointer to store user-related statistics
==== Return Value ====
If successfully done, ''BS_SDK_SUCCESS'' will be returned. If there is an error, the corresponding error code will be returned.
\\
==== Sample Code (C++) ====
BS2UserStatistic statistic = { 0, };
int sdkResult = BS2_GetUserStatistic(context_, id, &statistic);
if (BS_SDK_SUCCESS != sdkResult)
{
printf("BS2_GetUserStatistic call failed: %d", sdkResult);
return;
}
printf("numUsers:%u", statistic.numUsers);
printf("numCards:%u", statistic.numCards);
==== Sample Code (C#) ====
BS2UserStatistic statistic;
Console.WriteLine("Trying to get user statistic");
BS2ErrorCode sdkResult = (BS2ErrorCode)API.BS2_GetUserStatistic(sdkContext, deviceID, out statistic);
if (sdkResult != BS2ErrorCode.BS_SDK_SUCCESS)
{
Console.WriteLine("Got error({0}).", sdkResult);
return;
}
Console.WriteLine("numUsers : {0}", statistic.numUsers);
Console.WriteLine("numCards : {0}", statistic.numCards);