mvrdevelopment / libMVRgdtf

Other
4 stars 0 forks source link

queryServices() always returns empty InitialFiles list for each stations #45

Closed zactrack-dev closed 1 month ago

zactrack-dev commented 5 months ago

When running queryServices() (as taken from example_client.cpp) and fetching the InitialFiles list from the discovered stations, the list is always empty, even if the discovered station already has committed files.

Tested with a grandMA3 onPC version 2.0.0.4 with an enabled MVR station and 1 or multiple committed MVR files. Also tested with a second istance of libMVRgdtf and committed PseudoFiles. Same behavior.

welcome[bot] commented 5 months ago

Thanks for opening your first issue here! Be sure to follow the issue template!

moritzstaffel commented 5 months ago

Hi @zactrack-dev, Thanks for reporting, we will have a look on it.

pwinkler-ds commented 2 months ago

Hi @zactrack-dev

do I understand right that you look for initial files like this:

void StartFetchTest()
{
    std::cout << "Starting Fetch Test \n";

    // First start gma3, enable Mvr xchange and commit some files
    // Then run this code, it is expected that only 1 service is running.

    IMVRxchangeServicePtr service = IMVRxchangeServicePtr(VectorworksMVR::IID_IMVRxchangeService);

    IMVRxchangeService::OnMessageArgs msgArgs;
    msgArgs.IncomingCallback = onMsgTest;
    msgArgs.ReturningCallback = returnCallback;
    service->OnMessage(msgArgs);

    size_t serviceCnt = 0;
    service->QueryLocalServices(serviceCnt);

    ConnectToLocalServiceArgs args;

    for (size_t i = 0; i < serviceCnt; i++)
    {
        service->GetLocalServiceAt(i, args);

        std::cout << "Found :" << args.InitialFiles.size() << "Initial Files for " << args.Service << "\n";     

    }
}

this is not implemented and as I know not intended.

You need to join the local service (ConnectToLocalService) to receive the initial list in the answer. Currently ConnectToLocalService expects the servicename without the subdomain(_mvrxchange._tcp.local.) in the coming verison this will not matter.

void returnCallback(const VectorworksMVR::IMVRxchangeService::IMVRxchangeMessage& sentMsg, const VectorworksMVR::IMVRxchangeService::IMVRxchangeMessage& args, void* context)
{
    if (args.Type == MVRxchangeMessageType::MVR_JOIN_RET)
    {
        std::cout << "Available Files on station " << args.JOIN.Provider << " -> " << args.JOIN.StationName << ":" << std::endl;

        for (auto& it : args.JOIN.Commits)
        {
            std::cout << "File: " << it.Comment << "  Site: " << it.FileSize << "\n";
        }
    }