async private void RunTestSubscribePublish()
    {
        await ubiiClient.WaitForConnection();

        string topic   = "/" + ubiiClient.GetID() + "/unity3D_client/test/subcribe_publish_simple";
        bool   success = false;

        Action <TopicDataRecord> callback = (TopicDataRecord record) =>
        {
            success = record.Bool;
        };

        await ubiiClient.Subscribe(topic, callback);

        ubiiClient.Publish(new Ubii.TopicData.TopicData {
            TopicDataRecord = new Ubii.TopicData.TopicDataRecord {
                Topic = topic, Bool = true
            }
        });

        await Task.Delay(1000).ContinueWith(async(Task t) =>
        {
            await ubiiClient.Unsubscribe(topic, callback);

            if (success)
            {
                Debug.Log("RunTestSubscribePublish SUCCESS!");
            }
            else
            {
                Debug.LogError("RunTestSubscribePublish FAILURE!");
            }
        });
    }
    async private void StartTest()
    {
        if (ubiiClient == null)
        {
            Debug.LogError("UbiiClient not found!");
            return;
        }

        await ubiiClient.WaitForConnection();

        CreateUbiiSpecs();

        Ubii.Services.ServiceReply deviceRegistrationReply = await ubiiClient.RegisterDevice(ubiiDevice);

        if (deviceRegistrationReply.Device != null)
        {
            ubiiDevice = deviceRegistrationReply.Device;
        }

        await ubiiClient.Subscribe(topicTestPublishSubscribe, (Ubii.TopicData.TopicDataRecord record) =>
        {
            testPosition.Set((float)record.Vector3.X, (float)record.Vector3.Y, (float)record.Vector3.Z);
        });

        testRunning = true;
    }
Example #3
0
    async private void RunTests()
    {
        await ubiiClient.WaitForConnection();

        this.CreateSpecs();

        await Task.Delay(1000);

        RunTestStartStopSession();
    }