Dear Community User! We are updating our platform to a new system.
Read more: Important information on the platform change.

cancel
Showing results for 
Search instead for 
Did you mean: 
SOLVED

Access license via ipc (inprocss control)

Access license via ipc (inprocss control)

cchang
Established Member

Hello,

I failed to get license capabilities via datalayer with ipc (inprocss control). 

But I didn't find nodes related in datalayer.

Could anyone tell me what is the correct address or the correct way to access datalayer with ipc?

Or is it only possible to access through license-manager Rest API, which always need user to login?

My pseudo code and execution result is below.

 

Thanks. 

Chih-Peng

 

Pseudo-code

MyDatalayer::MyDatalayer() 
{
    m_datalayer.start(false);

    // Connect client
    m_ipcClient = m_datalayer.factory()->createClient(DL_IPC_AUTO);
    if (m_ipcClient == nullptr || !m_ipcClient->isConnected())
    {
        spdlog::critical("Failed to connect to DataLayer via IPC");
        delete m_ipcClient;
        m_ipcClient = nullptr;
    }
    else
    {
        spdlog::info("DataLayer IPC Client initialized successfully");
    }

    auto readCapabilites = [this](std::string const& address)    
    {
        Variant data;
        auto result = m_ipcClient->readSync(address, &data);

        if (result != DL_OK)
        {
      spdlog::warn("Failed to read-out {}. Reason {}", address,result.toString());
        }
    };
    readCapabilites("license-manager/api/v1/capabilities");
    readCapabilites("/license-manager/api/v1/capabilities");
    readCapabilites("capabilities");
}

 

Log output

DataLayer IPC Client initialized successfully

Failed to read-out license-manager/api/v1/capabilities. Reason DL_INVALID_ADDRESS

Failed to read-out /license-manager/api/v1/capabilities. Reason DL_INVALID_ADDRESS

Failed to read-out capabilities. Reason DL_INVALID_ADDRESS

 

4 REPLIES 4

CodeShepherd
Community Moderator
Community Moderator

In short the path you are using is simply not part of the data layer. It is an own separated API.

Please have a look into the documentation of our SDK to get further information about licensing.

cchang
Established Member

Hi, 

sorry for late reply.

I can access via License API.
But I would like to know whether it is possible to query, acquire/free licesne using datalayer approach, instead of License API. Becasue I want to use inprocess coumunication "ipc://", so that in my app, I don't need to login to manage licenses.

My guess is that, maybe ctrlX didn't expose License in Datalayer? Because I didn't find any nodes in Datalayer which looks like related to licences.

If ctrlX does allow to aceess License via Datalayer, could you let me know what is the node address?

nickH
Community Moderator
Community Moderator

Like @CodeShepherd already said: The license API is not part of the Data Layer. There is no path in the Data Layer were you can access the license manager. 

There is the REST API to interact with the license management.  I think you already managed to do this. 

What I think you are now wanting do do from you app is using the unix domain socket to interact with the same REST API of the license manager. Please take a look at the chapters 3.1 - 3.3 of the license mangement manual on how to do that. 

Best regards, 

Nick

 


cchang
Established Member

Thanks for pointing out. So it is not possible to use datalayer client with unix domain socket to access. I will use other library with unix domain socket.

Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist