Skip to content

File ManusSDKInterCore.cpp

File List > api > cppSDK > SDKBase > ManusSDKInterCore.cpp

Go to the documentation of this file

// This file is to allow us to use Inter Core functionality from in Manus Core using the SDK DLL. //
#include "ManusSDKTypes.h"
#include "ManusSDKExtendedTypes.h"

#include "ManusSDK.h"
#include "ManusSDKExtended.h"

#include "PlatformSpecific.hpp"

#ifndef _MANUS_CORE_LITE
SDKReturnCode InterCore_Initialize()
{
    return SDKReturnCode::SDKReturnCode_FunctionNotAvailable;
}

SDKReturnCode InterCore_Start()
{
    return SDKReturnCode::SDKReturnCode_FunctionNotAvailable;
}

SDKReturnCode InterCore_ShutDown()
{
    return SDKReturnCode::SDKReturnCode_FunctionNotAvailable;
}

SDKReturnCode InterCore_RegisterCallbackForInterCoreStream(InterCoreStreamCallback_t p_InterCoreStreamCallback)
{
    return SDKReturnCode::SDKReturnCode_FunctionNotAvailable;
}

SDKReturnCode InterCore_GetInterCoreStreamGloveData(Glove* p_Gloves, uint32_t p_GloveCount)
{
    return SDKReturnCode::SDKReturnCode_FunctionNotAvailable;
}

SDKReturnCode InterCore_GetNetDeviceLandscapeData(NetDeviceLandscapeData* p_NetDeviceLandscape)
{
    return SDKReturnCode::SDKReturnCode_FunctionNotAvailable;
}

SDKReturnCode InterCore_GetNumberOfAvailableNetDevices(uint32_t& p_NumberOfAvailablePeers)
{
    return SDKReturnCode::SDKReturnCode_FunctionNotAvailable;
}

SDKReturnCode InterCore_GetAvailableNetDevices(InterCorePeerInfo* p_Hosts, const uint32_t p_NumberOfAvailablePeers)
{
    return SDKReturnCode::SDKReturnCode_FunctionNotAvailable;
}

SDKReturnCode InterCore_ConnectToNetDevice(InterCorePeerInfo p_Peer)
{
    return SDKReturnCode::SDKReturnCode_FunctionNotAvailable;
}

SDKReturnCode InterCore_DisconnectFromNetDevice(InterCorePeerInfo p_Peer)
{
    return SDKReturnCode::SDKReturnCode_FunctionNotAvailable;
}

SDKReturnCode InterCore_SetIsNetDevice(bool p_IsNetDevice)
{
    return SDKReturnCode::SDKReturnCode_FunctionNotAvailable;
}

SDKReturnCode InterCore_GetIsNetDevice(bool& p_IsNetDevice)
{
    return SDKReturnCode::SDKReturnCode_FunctionNotAvailable;
}

SDKReturnCode InterCore_SetAutoFindNetDevices(bool p_AutoFind)
{
    return SDKReturnCode::SDKReturnCode_FunctionNotAvailable;
}

SDKReturnCode InterCore_GetAutoFindNetDevices(bool& p_AutoFind)
{
    return SDKReturnCode::SDKReturnCode_FunctionNotAvailable;
}

SDKReturnCode InterCore_SetAutoConnectNetDevices(bool p_AutoConnect)
{
    return SDKReturnCode::SDKReturnCode_FunctionNotAvailable;
}

SDKReturnCode InterCore_GetAutoConnectNetDevices(bool& p_AutoConnect)
{
    return SDKReturnCode::SDKReturnCode_FunctionNotAvailable;
}

SDKReturnCode InterCore_StartRecording(const ManusTimestamp p_Timestamp, bool& p_Result)
{
    p_Result = false;
    return SDKReturnCode::SDKReturnCode_FunctionNotAvailable;
}

SDKReturnCode InterCore_StopRecording(const ManusTimestamp p_Timestamp, bool& p_Result)
{
    p_Result = false;
    return SDKReturnCode::SDKReturnCode_FunctionNotAvailable;
}

SDKReturnCode InterCore_GetNextRecordedFrame(const uint32_t p_NetDeviceID, InterCoreStreamInfo& p_StreamInfo, bool& p_LastFrame)
{
    p_StreamInfo = InterCoreStreamInfo();
    p_LastFrame = false;
    return SDKReturnCode::SDKReturnCode_FunctionNotAvailable;
}

SDKReturnCode InterCore_GetNextRecordedFrameGloveData(Glove* p_Gloves, uint32_t p_GloveCount)
{
    p_Gloves = nullptr;
    return SDKReturnCode::SDKReturnCode_FunctionNotAvailable;
}

SDKReturnCode InterCore_PairGlove(const uint32_t p_NetDeviceID, const uint32_t p_GloveID, bool& p_Success)
{
    p_Success = false;
    return SDKReturnCode::SDKReturnCode_FunctionNotAvailable;
}

SDKReturnCode InterCore_PairGloveToDongle(const uint32_t p_NetDeviceID, const uint32_t p_GloveID, const uint32_t p_DongleID, bool& p_Success)
{
    p_Success = false;
    return SDKReturnCode::SDKReturnCode_FunctionNotAvailable;
}

SDKReturnCode InterCore_UnpairGlove(const uint32_t p_NetDeviceID, const uint32_t p_GloveID, bool& p_Success)
{
    p_Success = false;
    return SDKReturnCode::SDKReturnCode_FunctionNotAvailable;
}

SDKReturnCode InterCore_SendHaptics(const uint32_t p_NetDeviceID, const uint32_t p_GloveID, const float* p_Powers)
{
    return SDKReturnCode::SDKReturnCode_FunctionNotAvailable;
}

SDKReturnCode InterCore_GloveCalibrationStart(const uint32_t p_NetDeviceID, const GloveCalibrationArgs p_CalibrationArgs, bool& p_Result)
{
    p_Result = false;
    return SDKReturnCode::SDKReturnCode_FunctionNotAvailable;
}

SDKReturnCode InterCore_GloveCalibrationStop(const uint32_t p_NetDeviceID, const GloveCalibrationArgs p_CalibrationArgs, bool& p_Result)
{
    p_Result = false;
    return SDKReturnCode::SDKReturnCode_FunctionNotAvailable;
}

SDKReturnCode InterCore_GloveCalibrationFinish(const uint32_t p_NetDeviceID, const GloveCalibrationArgs p_CalibrationArgs, bool& p_Result)
{
    p_Result = false;
    return SDKReturnCode::SDKReturnCode_FunctionNotAvailable;
}

SDKReturnCode InterCore_GloveCalibrationGetNumberOfSteps(const uint32_t p_NetDeviceID, const GloveCalibrationArgs p_CalibrationArgs, uint32_t& p_NumberOfSteps)
{
    p_NumberOfSteps = 0;
    return SDKReturnCode::SDKReturnCode_FunctionNotAvailable;
}

SDKReturnCode InterCore_GloveCalibrationGetStepData(const uint32_t p_NetDeviceID, const GloveCalibrationStepArgs p_CalibrationArgs, GloveCalibrationStepData& p_Data)
{
    GloveCalibrationStepData_Init(&p_Data);
    return SDKReturnCode::SDKReturnCode_FunctionNotAvailable;
}

SDKReturnCode InterCore_GloveCalibrationStartStep(const uint32_t p_NetDeviceID, const GloveCalibrationStepArgs p_CalibrationArgs, bool& p_Result)
{
    p_Result = false;
    return SDKReturnCode::SDKReturnCode_FunctionNotAvailable;
}

SDKReturnCode InterCore_GetLicenceFeatures(LicenseInfo& p_License)
{
    LicenseInfo_Init(&p_License);
    return SDKReturnCode::SDKReturnCode_FunctionNotAvailable;
}

#else
#include "CoreLite/CoreLite.hpp"

#include "CoreLite/Definitions/Common.hpp"
#include "CoreLite/Definitions/Ergonomics.hpp"
#include "CoreLite/Definitions/Gestures.hpp"
#include "CoreLite/Definitions/Landscape.hpp"
#include "CoreLite/Definitions/Transform.hpp"
#include "CoreLite/Definitions/Node.hpp"
#include "CoreLite/Definitions/SkeletonOutputStream.hpp"
#include "CoreLite/Definitions/SkeletonOutput.hpp"
#include "CoreLite/Definitions/Skeleton.hpp"
#include "CoreLite/Definitions/Version.hpp"
#include "CoreLite/Definitions/Session.hpp"
#include "CoreLite/Definitions/Calibration/CalibrationData.hpp"

#include "CoreLite/Service.hpp"
#include "CoreLite/InterCore/InterCoreService.hpp"

#include "CoreLite/CoreLiteConversion.hpp"

#include "CoreLite/InterCore/SLikeNet.hpp"
#include "CoreLite/Brotocol/BrotoMessage.hpp"
#include "CoreLite/Brotocol/InterCoreStreamMessage.hpp"


void InterCore_OnInterCoreStream(manusid p_NetDeviceID, CoreLite::Brotocol::InterCoreStreamMessage* p_Data);

std::unique_ptr<CoreLite::InterCore::InterCoreService> s_InterCoreService;
std::recursive_mutex s_InterCoreMootex; //This allows us to keep the gets from the callback safely.
CoreLite::Brotocol::InterCoreStreamMessage* s_CurrentIntercoreStreamMessage = nullptr;
InterCoreStreamCallback_t m_RegisteredInterCoreStreamCallback = nullptr;

CoreLite::Brotocol::InterCoreStreamMessage* s_CurrentRecordedFrameStreamMessage = nullptr;

std::vector<CoreLite::Definitions::PeerInfo> s_PeerInfo;

SDKReturnCode InterCore_Initialize()
{
    if (!s_InterCoreService)
    {
        std::lock_guard t_Lock(s_InterCoreMootex);
        s_InterCoreService = std::make_unique<CoreLite::InterCore::InterCoreService>();
        s_InterCoreService->RegisterOnInterCoreStream(InterCore_OnInterCoreStream);
        return SDKReturnCode::SDKReturnCode_Success;
    }
    return SDKReturnCode::SDKReturnCode_FunctionCalledAtWrongTime;
}

SDKReturnCode InterCore_Start()
{
    if (!s_InterCoreService) { return SDKReturnCode::SDKReturnCode_SdkNotAvailable; }
    s_InterCoreService->Start();
    return SDKReturnCode::SDKReturnCode_Success;
}

SDKReturnCode InterCore_ShutDown()
{
    if (!s_InterCoreService) { return SDKReturnCode::SDKReturnCode_SdkNotAvailable; }
    s_InterCoreService->Stop(true);
    std::lock_guard t_Lock(s_InterCoreMootex);
    s_InterCoreService.reset();
    return SDKReturnCode::SDKReturnCode_Success;
}

SDKReturnCode InterCore_RegisterCallbackForInterCoreStream(InterCoreStreamCallback_t p_InterCoreStreamCallback)
{
    std::lock_guard t_Lock(s_InterCoreMootex);
    m_RegisteredInterCoreStreamCallback = p_InterCoreStreamCallback;
    return SDKReturnCode::SDKReturnCode_Success;
}

void InterCore_OnInterCoreStream(manusid p_NetDeviceID, CoreLite::Brotocol::InterCoreStreamMessage* p_Data)
{
    if (p_Data == nullptr)return;
    std::lock_guard t_Lock(s_InterCoreMootex);
    if (m_RegisteredInterCoreStreamCallback == nullptr)return;
    s_CurrentIntercoreStreamMessage = p_Data;

    InterCoreStreamInfo t_Info;
    t_Info.frameID = p_Data->frameID;
    CoreLite::SDKConversion::TimestampToWrapper(p_Data->timestamp, t_Info.timestamp);
    t_Info.gloveDataCount = (uint32_t)p_Data->data.size();
    t_Info.hasLandscape = p_Data->deviceLandscape != nullptr;
    DeviceLandscape_Init(&t_Info.deviceLandscape);
    if (p_Data->deviceLandscape != nullptr)
    {
        CoreLite::SDKConversion::InterCoreDeviceLandscapeToWrapper(*(s_CurrentIntercoreStreamMessage->deviceLandscape), t_Info.deviceLandscape);
    }

    m_RegisteredInterCoreStreamCallback(p_NetDeviceID, &t_Info);
    s_CurrentIntercoreStreamMessage = nullptr;
}

SDKReturnCode InterCore_GetInterCoreStreamGloveData(Glove* p_Gloves, uint32_t p_GloveCount)
{
    std::lock_guard t_Lock(s_InterCoreMootex);
    if (s_CurrentIntercoreStreamMessage == nullptr)return SDKReturnCode::SDKReturnCode_DataNotAvailable;
    if (p_Gloves == nullptr)return SDKReturnCode::SDKReturnCode_NullPointer;
    if (p_GloveCount != s_CurrentIntercoreStreamMessage->data.size())return SDKReturnCode::SDKReturnCode_InvalidArgument;

    for (size_t i = 0; i < s_CurrentIntercoreStreamMessage->data.size(); i++)
    {
        CoreLite::SDKConversion::GloveToWrapper(*(s_CurrentIntercoreStreamMessage->data[i]), p_Gloves[i]);
    }
    return SDKReturnCode::SDKReturnCode_Success;
}

SDKReturnCode InterCore_GetNetDeviceLandscapeData(NetDevicesLandscape* p_NetDevicesLandscape)
{
    if (!s_InterCoreService) { return SDKReturnCode::SDKReturnCode_SdkNotAvailable; }
    auto t_LS = s_InterCoreService->GetNetDeviceLandscape();
    CoreLite::SDKConversion::NetDeviceLandscapeToWrapper(t_LS, *p_NetDevicesLandscape);
    return SDKReturnCode::SDKReturnCode_Success;
}

SDKReturnCode InterCore_GetNumberOfAvailableNetDevices(uint32_t& p_NumberOfAvailablePeers)
{
    if (!s_InterCoreService) { return SDKReturnCode::SDKReturnCode_SdkNotAvailable; }
    s_PeerInfo = s_InterCoreService->GetAvailableNetDevices();
    p_NumberOfAvailablePeers = (uint32_t)s_PeerInfo.size();
    return SDKReturnCode::SDKReturnCode_Success;
}

SDKReturnCode InterCore_GetAvailableNetDevices(InterCorePeerInfo* p_Peers, const uint32_t p_NumberOfAvailablePeers)
{
    if (s_PeerInfo.size() != p_NumberOfAvailablePeers)return SDKReturnCode::SDKReturnCode_InvalidArgument;

    for (size_t i = 0; i < s_PeerInfo.size(); i++)
    {
        if (!CoreLite::SDKConversion::PeerInfoToWrapper(s_PeerInfo[i], p_Peers[i]))
        {
            return SDKReturnCode::SDKReturnCode_Error;
        }
    }
    return SDKReturnCode::SDKReturnCode_Success;
}

SDKReturnCode InterCore_ConnectToNetDevice(InterCorePeerInfo p_Peer)
{
    if (!s_InterCoreService) { return SDKReturnCode::SDKReturnCode_SdkNotAvailable; }
    CoreLite::Definitions::PeerInfo t_PInfo;
    CoreLite::SDKConversion::PeerInfoFromWrapper(p_Peer, t_PInfo);
    s_InterCoreService->ConnectToNetDevice(t_PInfo);
    return SDKReturnCode::SDKReturnCode_Success;
}

SDKReturnCode InterCore_DisconnectFromNetDevice(InterCorePeerInfo p_Peer)
{
    if (!s_InterCoreService) { return SDKReturnCode::SDKReturnCode_SdkNotAvailable; }
    CoreLite::Definitions::PeerInfo t_PInfo;
    CoreLite::SDKConversion::PeerInfoFromWrapper(p_Peer, t_PInfo);
    s_InterCoreService->DisconnectFromNetDevice(t_PInfo);
    return SDKReturnCode::SDKReturnCode_Success;
}

SDKReturnCode InterCore_SetIsNetDevice(bool p_IsNetDevice)
{
    if (!s_InterCoreService) { return SDKReturnCode::SDKReturnCode_SdkNotAvailable; }
    s_InterCoreService->SetIsNetDevice(p_IsNetDevice);
    return SDKReturnCode::SDKReturnCode_Success;
}

SDKReturnCode InterCore_GetIsNetDevice(bool& p_IsNetDevice)
{
    if (!s_InterCoreService) { return SDKReturnCode::SDKReturnCode_SdkNotAvailable; }
    p_IsNetDevice = s_InterCoreService->GetIsNetDevice();
    return SDKReturnCode::SDKReturnCode_Success;
}

SDKReturnCode InterCore_SetAutoFindNetDevices(bool p_AutoFind)
{
    if (!s_InterCoreService) { return SDKReturnCode::SDKReturnCode_SdkNotAvailable; }
    s_InterCoreService->SetAutoFindNetDevices(p_AutoFind);
    return SDKReturnCode::SDKReturnCode_Success;
}

SDKReturnCode InterCore_GetAutoFindNetDevices(bool& p_AutoFind)
{
    if (!s_InterCoreService) { return SDKReturnCode::SDKReturnCode_SdkNotAvailable; }
    p_AutoFind = s_InterCoreService->GetAutoFindNetDevices();
    return SDKReturnCode::SDKReturnCode_Success;
}

SDKReturnCode InterCore_SetAutoConnectNetDevices(bool p_AutoConnect)
{
    if (!s_InterCoreService) { return SDKReturnCode::SDKReturnCode_SdkNotAvailable; }
    s_InterCoreService->SetAutoConnectNetDevices(p_AutoConnect);
    return SDKReturnCode::SDKReturnCode_Success;
}

SDKReturnCode InterCore_GetAutoConnectNetDevices(bool& p_AutoConnect)
{
    if (!s_InterCoreService) { return SDKReturnCode::SDKReturnCode_SdkNotAvailable; }
    p_AutoConnect = s_InterCoreService->GetAutoConnectNetDevices();
    return SDKReturnCode::SDKReturnCode_Success;
}

SDKReturnCode InterCore_StartRecording(const ManusTimestamp p_Timestamp, bool& p_Result)
{
    p_Result = false;
    if (!s_InterCoreService) { return SDKReturnCode::SDKReturnCode_SdkNotAvailable; }
    CoreLite::Definitions::Timestamp t_Timestamp;
    CoreLite::SDKConversion::TimestampFromWrapper(p_Timestamp, t_Timestamp);
    p_Result = s_InterCoreService->StartRecording(t_Timestamp);
    return p_Result ? SDKReturnCode::SDKReturnCode_Success : SDKReturnCode::SDKReturnCode_Error;
}

SDKReturnCode InterCore_StopRecording(bool& p_Result)
{
    p_Result = false;
    if (!s_InterCoreService) { return SDKReturnCode::SDKReturnCode_SdkNotAvailable; }
    CoreLite::Definitions::Timestamp t_Timestamp;
    p_Result = s_InterCoreService->StopRecording();
    return p_Result ? SDKReturnCode::SDKReturnCode_Success : SDKReturnCode::SDKReturnCode_Error;
}

SDKReturnCode InterCore_GetNextRecordedFrame(const uint32_t p_NetDeviceID, InterCoreStreamInfo& p_StreamInfo, bool& p_LastFrame)
{
    p_StreamInfo = InterCoreStreamInfo();
    p_LastFrame = false;
    if (!s_InterCoreService) { return SDKReturnCode::SDKReturnCode_SdkNotAvailable; }

    CoreLite::Brotocol::InterCoreStreamMessage* t_FrameData = nullptr;
    bool t_Res = s_InterCoreService->GetNextRecordedFrame(p_NetDeviceID, t_FrameData, p_LastFrame);
    if (!t_Res)
    {
        delete t_FrameData;
        return SDKReturnCode::SDKReturnCode_Error;
    }

    // Assign recorded frame and delete previous
    delete s_CurrentRecordedFrameStreamMessage;
    s_CurrentRecordedFrameStreamMessage = t_FrameData;

    p_StreamInfo.frameID = s_CurrentRecordedFrameStreamMessage->frameID;
    CoreLite::SDKConversion::TimestampToWrapper(s_CurrentRecordedFrameStreamMessage->timestamp, p_StreamInfo.timestamp);
    p_StreamInfo.gloveDataCount = (uint32_t)s_CurrentRecordedFrameStreamMessage->data.size();
    p_StreamInfo.hasLandscape = s_CurrentRecordedFrameStreamMessage->deviceLandscape != nullptr;
    DeviceLandscape_Init(&p_StreamInfo.deviceLandscape);
    if (s_CurrentRecordedFrameStreamMessage->deviceLandscape != nullptr)
    {
        CoreLite::SDKConversion::InterCoreDeviceLandscapeToWrapper(*(s_CurrentRecordedFrameStreamMessage->deviceLandscape), p_StreamInfo.deviceLandscape);
    }

    return SDKReturnCode::SDKReturnCode_Success;
}

SDKReturnCode InterCore_GetNextRecordedFrameGloveData(Glove* p_Gloves, uint32_t p_GloveCount)
{
    if (s_CurrentRecordedFrameStreamMessage == nullptr) return SDKReturnCode::SDKReturnCode_DataNotAvailable;
    if (p_Gloves == nullptr) return SDKReturnCode::SDKReturnCode_NullPointer;
    if (p_GloveCount != s_CurrentRecordedFrameStreamMessage->data.size()) return SDKReturnCode::SDKReturnCode_InvalidArgument;

    for (size_t i = 0; i < s_CurrentRecordedFrameStreamMessage->data.size(); i++)
    {
        CoreLite::SDKConversion::GloveToWrapper(*(s_CurrentRecordedFrameStreamMessage->data[i]), p_Gloves[i]);
    }
    return SDKReturnCode::SDKReturnCode_Success;
}

SDKReturnCode InterCore_PairGlove(const uint32_t p_NetDeviceID, const uint32_t p_GloveID, bool& p_Success)
{
    p_Success = false;
    if (!s_InterCoreService) { return SDKReturnCode::SDKReturnCode_SdkNotAvailable; }
    bool t_Result = s_InterCoreService->PairGlove(p_NetDeviceID, p_GloveID, p_Success);
    return t_Result ? SDKReturnCode::SDKReturnCode_Success : SDKReturnCode::SDKReturnCode_Error;
}

SDKReturnCode InterCore_PairGloveToDongle(const uint32_t p_NetDeviceID, const uint32_t p_GloveID, const uint32_t p_DongleID, bool& p_Success)
{
    p_Success = false;
    if (!s_InterCoreService) { return SDKReturnCode::SDKReturnCode_SdkNotAvailable; }
    bool t_Result = s_InterCoreService->PairGlove(p_NetDeviceID, p_GloveID, p_DongleID, p_Success);
    return t_Result ? SDKReturnCode::SDKReturnCode_Success : SDKReturnCode::SDKReturnCode_Error;
}

SDKReturnCode InterCore_UnpairGlove(const uint32_t p_NetDeviceID, const uint32_t p_GloveID, bool& p_Success)
{
    p_Success = false;
    if (!s_InterCoreService) { return SDKReturnCode::SDKReturnCode_SdkNotAvailable; }
    bool t_Result = s_InterCoreService->UnpairGlove(p_NetDeviceID, p_GloveID, p_Success);
    return t_Result ? SDKReturnCode::SDKReturnCode_Success : SDKReturnCode::SDKReturnCode_Error;
}

SDKReturnCode InterCore_SendHaptics(const uint32_t p_NetDeviceID, const uint32_t p_GloveID, const float* p_Powers)
{
    if (!s_InterCoreService) { return SDKReturnCode::SDKReturnCode_SdkNotAvailable; }
    std::array<float, 5> t_Powers = { p_Powers[0],p_Powers[1],p_Powers[2],p_Powers[3],p_Powers[4] };
    bool t_Res = s_InterCoreService->SendHaptics(p_NetDeviceID, p_GloveID, t_Powers);
    return t_Res ? SDKReturnCode::SDKReturnCode_Success : SDKReturnCode::SDKReturnCode_Error;
}

SDKReturnCode InterCore_GloveCalibrationStart(const uint32_t p_NetDeviceID, const GloveCalibrationArgs p_CalibrationArgs, bool& p_Result)
{
    p_Result = false;
    if (!s_InterCoreService) { return SDKReturnCode::SDKReturnCode_SdkNotAvailable; }
    bool t_Res = s_InterCoreService->GloveCalibrationStart(p_NetDeviceID, p_CalibrationArgs.gloveId, p_Result);
    return t_Res ? SDKReturnCode::SDKReturnCode_Success : SDKReturnCode::SDKReturnCode_Error;
}

SDKReturnCode InterCore_GloveCalibrationStop(const uint32_t p_NetDeviceID, const GloveCalibrationArgs p_CalibrationArgs, bool& p_Result)
{
    p_Result = false;
    if (!s_InterCoreService) { return SDKReturnCode::SDKReturnCode_SdkNotAvailable; }
    bool t_Res = s_InterCoreService->GloveCalibrationStop(p_NetDeviceID, p_CalibrationArgs.gloveId, p_Result);
    return t_Res ? SDKReturnCode::SDKReturnCode_Success : SDKReturnCode::SDKReturnCode_Error;
}

SDKReturnCode InterCore_GloveCalibrationFinish(const uint32_t p_NetDeviceID, const GloveCalibrationArgs p_CalibrationArgs, bool& p_Result)
{
    p_Result = false;
    if (!s_InterCoreService) { return SDKReturnCode::SDKReturnCode_SdkNotAvailable; }
    bool t_Res = s_InterCoreService->GloveCalibrationFinish(p_NetDeviceID, p_CalibrationArgs.gloveId, p_Result);
    return t_Res ? SDKReturnCode::SDKReturnCode_Success : SDKReturnCode::SDKReturnCode_Error;
}

SDKReturnCode InterCore_GloveCalibrationGetNumberOfSteps(const uint32_t p_NetDeviceID, const GloveCalibrationArgs p_CalibrationArgs, uint32_t& p_NumberOfSteps)
{
    p_NumberOfSteps = 0;
    if (!s_InterCoreService) { return SDKReturnCode::SDKReturnCode_SdkNotAvailable; }
    bool t_Res = s_InterCoreService->GloveCalibrationGetNumberOfSteps(p_NetDeviceID, p_CalibrationArgs.gloveId, p_NumberOfSteps);
    return t_Res ? SDKReturnCode::SDKReturnCode_Success : SDKReturnCode::SDKReturnCode_Error;
}

SDKReturnCode InterCore_GloveCalibrationGetStepData(const uint32_t p_NetDeviceID, const GloveCalibrationStepArgs p_CalibrationArgs, GloveCalibrationStepData& p_Data)
{
    GloveCalibrationStepData_Init(&p_Data);
    if (!s_InterCoreService) { return SDKReturnCode::SDKReturnCode_SdkNotAvailable; }
    CoreLite::Definitions::Calibration::CalibrationStepData t_StepData;
    bool t_Res = s_InterCoreService->GloveCalibrationGetStepData(p_NetDeviceID, p_CalibrationArgs.gloveId, p_CalibrationArgs.stepIndex, t_StepData);
    CoreLite::SDKConversion::CopyGloveCalibrationStepDataToWrapper(t_StepData, p_Data);
    return t_Res ? SDKReturnCode::SDKReturnCode_Success : SDKReturnCode::SDKReturnCode_Error;
}

SDKReturnCode InterCore_GloveCalibrationStartStep(const uint32_t p_NetDeviceID, const GloveCalibrationStepArgs p_CalibrationArgs, bool& p_Result)
{
    p_Result = false;
    if (!s_InterCoreService) { return SDKReturnCode::SDKReturnCode_SdkNotAvailable; }
    bool t_Res = s_InterCoreService->GloveCalibrationStartStep(p_NetDeviceID, p_CalibrationArgs.gloveId, p_CalibrationArgs.stepIndex, p_Result);
    return t_Res ? SDKReturnCode::SDKReturnCode_Success : SDKReturnCode::SDKReturnCode_Error;
}

SDKReturnCode InterCore_GetLicenceFeatures(LicenseInfo& p_License)
{
    LicenseInfo_Init(&p_License);
    if (!s_InterCoreService) { return SDKReturnCode::SDKReturnCode_SdkNotAvailable; }
    bool t_Res = false;
    auto t_License = s_InterCoreService->GetLicense();
    if (t_License != nullptr)
    {
        t_Res = CoreLite::SDKConversion::LicenseInfoToWrapper(*t_License->GetFeatureInfo(), p_License);
        delete t_License;
    }
    else
    {
        t_Res = CoreLite::SDKConversion::LicenseInfoToWrapper(CoreLite::Definitions::LicenseFeatureInfo(), p_License);
    }
    return t_Res ? SDKReturnCode::SDKReturnCode_Success : SDKReturnCode::SDKReturnCode_Error;
}

#endif