Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.

Has anyone successfully used DirectPairing in HoloToolKit?

There seems to be scant detail on the specifics of using DirectPairing from the Sharing HoloToolKit directory. I am still keen to transfer data of some sort from the HoloLens or HoloLens Emulator to the PC via this route. From what I see is if the HoloLens takes the role of

PairingRole = Role.Connector;

and the PC takes the role of

PairingRole = Role.Receiver;

and we choose in the HoloLens or HoloLens Emulator

RemoteAddress = "localhost";

what do we choose on the PC for the RemoteAddress? I am guessing this maybe the IPv4 address of the HoloLens perhaps?

Best Answers

Answers

  • Following up internally.

  • If the role is set to Receiver, then the RemoteAddress field isn't used. When the role is Connector, you should set the RemoteAddress field to the IP address of the device you want to connect to (which should be running as 'Receiver'). So in your case, the RemoteAddress field should be the IP of your PC

  • Hi @wheelchairman .are you success about direct pairing?
    I also have same problem..
    please tell me your result.

    -thanks.

  • Hi littlewing, I am not sure I found the proper answer to this question however I did find a way round it. This is what I did:-

    1) Download the Windows-universal-samples-master.zip from [https://github.com/Microsoft/Windows-universal-samples]
    2) From the unzipped directory compile and link the example 'DatagramSocket'
    3)Choose (5) Multicast/Broadcast from the list and select the 'Broadcast' option. The Status Text block at the bottom of the screen ought to show 'Listening on port 22113.

    Now this example is waiting for any App to send a message on port 22113.

    In the App I am developing for the Hololens, I modified and added a fragment of the DatagramSocket example to send information to this DatagramSocket example. There are send and receive routines in the Microsoft example for you to take inspiration from. I used the 'SendMessage' routine and modified it to suite my own needs. I have a public static string called

    public static string message_to_send;

    Every time there is an update, I am able to alter this and over write this message with anything I want. So my code looks like this (apologies to Microsoft for the butchery of their code)

        private async void SendMessage()
        {
            sendoutput = "";
            string stringToSend = "";
            if (message_to_send.Length == 0) return;
            stringToSend = message_to_send;
            message_to_send = "";
            try
            {
                IOutputStream outputStream;
                HostName remoteHostname = new HostName(remoteaddress);
                outputStream = await listenerSocket.GetOutputStreamAsync(remoteHostname, service_name);
    
                // Send out some multicast or broadcast data. Datagrams generated by the IOutputStream will use
                // <source host, source port> information obtained from the parent socket (i.e., 'listenSocket' in
                // this case).
                //const string stringToSend = "Hello";
                DataWriter writer = new DataWriter(outputStream);
                writer.WriteString(stringToSend);
                await writer.StoreAsync();
            }
            catch (Exception exception)
            {
                // If this is an unknown status it means that the error is fatal and retry will likely fail.
                if (SocketError.GetStatus(exception.HResult) == SocketErrorStatus.Unknown)
                {
                    throw;
                }
            }
        }
    

    I'm afraid my coding is not the best in the world but I hope you get the picture and it helps you in some way.

  • edited October 2016

    @neerajwadhwa said:
    Following up internally.

    Does anyone managed to get DirectPairing of 2 HoloLenses without using sharing server? Is it possible?

    Also I have big problems getting in sync in like 50% sync try attempts using sharing server solution :(

  • Dear Neat_Ware_FUBAR77,
    I am no expert here but I found in the example I was using from the UWP list of examples, DataGramSocket allows you to directly talk to another port on the same intranet. Now if you have 2 Hololenses and you want to have a dialog just between this pair, you can talk using the DataGramSocket App where you know each of their IP address is. You can find out what it is on the Hololens by going into settings and clicking the 'advanced' button. Might be worth making this port 'static' here and stop it moving around in value when your launch stuff. (Sorry I can't help with this issue as my geeky son did this for me when I was not looking!) Before committing anything, try it with your PC by setting up a port (eg the one I use is the same as the example (22113) but you can choose) and select the 'multicast' group where you can specify IP addresses you can send and receiver from). If it works, plump it in as an App you can run on both Hololenses where you know the static IP address they have on your WiFi intranet.

    Probably not the correct or offical way to do it but it might be worth a try - Good luck!

Sign In or Register to comment.