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);

Parameter

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++)

sample_getuserstatistic.cpp
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#)

sample_getuserstatistic.cs
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);