Esempio n. 1
0
    private async void StartTest()
    {
        if (ubiiNode == null)
        {
            Debug.LogError("UbiiClient not found!");
            return;
        }

        await ubiiNode.WaitForConnection();

        CreateUbiiSpecs();

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

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

        this.subToken = await ubiiNode.SubscribeTopic(topicTestPublishSubscribe,
                                                      (Ubii.TopicData.TopicDataRecord record) =>
        {
            testPosition.Set((float)record.Vector3.X, (float)record.Vector3.Y, (float)record.Vector3.Z);
        });

        testRunning = true;
    }
    private void CreateUbiiSpecs()
    {
        topicTestPublishSubscribe = "/" + ubiiClient.GetID() + "/test_publish_subscribe/object_movement";

        ubiiDevice = new Ubii.Devices.Device {
            Name = deviceName, ClientId = ubiiClient.GetID(), DeviceType = Ubii.Devices.Device.Types.DeviceType.Participant
        };
        ubiiDevice.Components.Add(new Ubii.Devices.Component {
            IoType = Ubii.Devices.Component.Types.IOType.Publisher, MessageFormat = "ubii.dataStructure.Vector3", Topic = topicTestPublishSubscribe
        });
    }
Esempio n. 3
0
    public async Task <ServiceReply> RegisterDevice(Ubii.Devices.Device ubiiDevice)
    {
        ServiceReply deviceRegReply = await networkClient.RegisterDevice(ubiiDevice);

        if (deviceRegReply.Error == null)
        {
            registeredDevices.Add(deviceRegReply.Device.Id, deviceRegReply.Device);
        }

        return(deviceRegReply);
    }
Esempio n. 4
0
    public async Task <ServiceReply> DeregisterDevice(Ubii.Devices.Device ubiiDevice)
    {
        var deviceDeregReply = await networkClient.DeregisterDevice(ubiiDevice);

        if (!registeredDevices.Remove(ubiiDevice.Id))
        {
            Debug.LogError("Device " + ubiiDevice.Name + " could not be removed from local list.");
        }
        else
        {
            Debug.Log("Deregistering " + ubiiDevice + " successful!");
        }
        return(deviceDeregReply);
    }
Esempio n. 5
0
 public Task <ServiceReply> DeregisterDevice(Ubii.Devices.Device ubiiDevice)
 {
     return(client.DeregisterDevice(ubiiDevice));
 }