This is an old revision of the document!


FIXME This page is not fully translated, yet. Please help completing the translation.
(remove this paragraph once the translation is finished)

User Management API > 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

  • [In] context : Context
  • [In] deviceId : Device Id
  • [Out] userStatistic : Pointer to store user-related statistics

반환값

성공적으로 수행될 경우 BS_SDK_SUCCESS를 반환하고, 에러가 발생할 경우 상응하는 에러 코드를 반환합니다.

샘플코드(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);

샘플코드(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);