19 Replies
      Latest reply: Mar 14, 2017 1:54 AM by eskimo RSS
      Level 1 Level 1 (0 points)

        My question is fairly straight forward - can iOS create a Wi-Fi Direct group that can be joined by non-iOS devices?

         

        The only information I can find relating to iOS direct peer connectivity is https://developer.apple.com/library/prerelease/ios/documentation/MultipeerConnectivity/Reference/MultipeerConnectivityFramework/index.html

         

        More specifically, "The Multipeer Connectivity framework provides support for discovering services provided by nearby iOS devices..."

         

        Based on this I would say no, but technically speaking, there should be no limitation for Wi-Fi Direct as it is an open standard, and apps like AirDrop already use it.

        • Re: iOS and Wi-Fi Direct
          eskimo Apple Staff Apple Staff (7,180 points)

          My question is fairly straight forward - can iOS create a Wi-Fi Direct group that can be joined by non-iOS devices?

          No.  The peer-to-peer Wi-Fi implemented by iOS (and recent versions of OS X) is not compatible with Wi-Fi Direct.

          Note Just as an aside, you can access peer-to-peer Wi-Fi without using Multipeer Connectivity.  The underlying technology is Bonjour + TCP/IP, and you can access that directly from your app.  The WiTap sample code shows how.

          Based on this I would say no, but technically speaking, there should be no limitation for Wi-Fi Direct as [...] apps like AirDrop already use it.

          AirDrop does not use Wi-Fi Direct, but rather the Bonjour + TCP based peer-to-peer Wi-Fi discussed above.

          Share and Enjoy

          Quinn "The Eskimo!"
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"

            • Re: iOS and Wi-Fi Direct
              JetForMe Level 1 Level 1 (0 points)

              "AirDrop does not use Wi-Fi Direct, but rather the Bonjour + TCP based peer-to-peer Wi-Fi discussed above."

               

              How does it do this when the two devices need not be on the same network? This is the problem we're trying to solve: there's no infrastructure Wi-Fi network. Our peripheral can host a network, but we'd like to avoid making the user leave our app to go to Settings to connect to our peripheral.

               

              It seems the WiTap sample code requires all instances to be on the same network already, is that correct?

                • Re: iOS and Wi-Fi Direct
                  eskimo Apple Staff Apple Staff (7,180 points)

                  How does it do this when the two devices need not be on the same network?

                  Via an Apple-specific (not Wi-Fi Direct) peer-to-peer Wi-Fi protocol.

                  It seems the WiTap sample code requires all instances to be on the same network already, is that correct?

                  No.  Although don’t take my word for it, try it yourself:

                  1. grab two iOS devices

                    Note the only requirement is that they each must be new enough to have a Lightning connector.  Peer-to-peer Wi-Fi support is not tied to the Lightning connector, it's just a helpful coincidence that the hardware that supports peer-to-peer Wi-Fi also happens to have a Lightning connector and thus it's an easy way to identify that support.

                  2. on each, forget the infrastructure Wi-Fi network

                  3. on each, disable Bluetooth (which implements a different form of Apple-specific, Bonjour + TCP/IP peer-to-peer networking)

                  4. on each, run WiTap and start a ‘game’

                  This is the problem we're trying to solve: there's no infrastructure Wi-Fi network. Our peripheral can host a network, but we'd like to avoid making the user leave our app to go to Settings to connect to our peripheral.

                  Ah, this is the first mention of non-Apple hardware in this thread.  The situation with non-Apple hardware is more challenging because the peer-to-peer networking protocols (both Wi-Fi and Bluetooth) are not documented for third-party use.

                  Your options:

                  • In a typical home accessory setup you want the accessory to join the same infrastructure Wi-Fi as all the other devices in the home.  Apple explicitly supports this via the Wireless Accessory Configuration (WAC) mechanism.  This lets an iOS device pass its Wi-Fi configuration to the accessory so that the accessory can join the same Wi-Fi network as the iOS device is currently on.

                  You can learn more about this in WWDC 2014 Session 701 "Designing Accessories for iOS and OS X".

                  https://developer.apple.com/videos/

                  WAC is part of MFi.

                  • HomeKit accessories, also created under the aegis of MFi, have their own set of capabilities.  Let me know if you’re interested in that angle.

                  • Most other ad hoc and peer-to-peer Wi-Fi scenarios do not have good solutions.  You can generally make things work, but it tends to be a manual process.

                  Share and Enjoy

                  Quinn "The Eskimo!"
                  Apple Developer Relations, Developer Technical Support, Core OS/Hardware
                  let myEmail = "eskimo" + "1" + "@apple.com"

                    • Re: iOS and Wi-Fi Direct
                      dankey Level 1 Level 1 (0 points)

                      Is there (or will there be) support for "ad-hoc" Airplay (audio) today? (i.e like the AppleTV guest mode)

                      • Re: iOS and Wi-Fi Direct
                        Ynot Level 1 Level 1 (0 points)

                        Hi Eskimo,

                         

                        I tried to use wi-fi direct with Wi-Tap as you outlined in your previous message but have discovered a problem with it.  After about 1 minute of no tapping on either device, taps are no longer being received.  If you keep tapping every second or so there is no problem and the data continues to be sent and received, however once you stop this repeated tapping the problem occurs after about 5 seconds.

                         

                        We see the exact same issue with our own peer to peer product after we updated it to use wi-fi direct.  After about 45 seconds of no activity (ie no transmission of any data from either device), data is no longer being received. If we send a "keep-alive" packet every second it works continously.  If we change the keep-alive delay to 5 seconds it fails.  There are no errors returned from the NSStream write method or via the NSStream handleEvent: callback in either Wi-Tap or our app.

                         

                        Am I missing something?  I am about to file a bug report.

                         

                        Thanks

                        • Re: iOS and Wi-Fi Direct
                          mmopty Level 1 Level 1 (0 points)

                          HI,

                           

                          This thread is very interesting!

                           

                          In my case, I'm developping a device that I would like to connect to very easily without any infrastructure. At the beggining I though of Bluetooth but the speed of the connection isn't high enough. So I though of Wifi Direct (P2P). With Android it's possible but I would like to control my device also with iOS !

                           

                          What I understand from the answer of Eskimo is that it's not possible ?

                          "The situation with non-Apple hardware is more challenging because the peer-to-peer networking protocols (both Wi-Fi and Bluetooth) are not documented for third-party use."

                           

                          Is there any solution ?

                           

                          Thanks a lot for your documented answers !

                           

                          Marc

                            • Re: iOS and Wi-Fi Direct
                              eskimo Apple Staff Apple Staff (7,180 points)

                              What I understand from the answer of Eskimo is that it's not possible ?

                              Things haven’t changed since I posted that.

                              If your accessory is built under the aegis of MFi, you can get pretty reasonable speeds out of classic Bluetooth.  If not, Bluetooth LE is the only option, and you’re correct in saying that it’s quite slow.

                              Share and Enjoy

                              Quinn "The Eskimo!"
                              Apple Developer Relations, Developer Technical Support, Core OS/Hardware
                              let myEmail = "eskimo" + "1" + "@apple.com"

                              DTS will close for the winter holidays at the end of business on Wed, 23 Dec 2015 and re-open on Mon, 4 Jan 2016.

                                • Re: iOS and Wi-Fi Direct
                                  mmopty Level 1 Level 1 (0 points)

                                  Thank you for your prompt answer!

                                  The other problem with Bluetooth is the range which is very short... Wifi Direct could solve this !

                                  Marc

                                  • Re: iOS and Wi-Fi Direct
                                    somethingelse Level 1 Level 1 (0 points)

                                    we are in the same boat: non apple hardware box under linux wants to talk to iOS over a peer to peer wifi link similar to how WiTap is doing it, without using inftrastructure wifi or converting either the box or the iOS device into a hotspot. bluetooth is not available in our box. is it possible these days (early 2017)?

                                    Mike

                                      • Re: iOS and Wi-Fi Direct
                                        eskimo Apple Staff Apple Staff (7,180 points)

                                        is it possible these days (early 2017)?

                                        Nothing has changed in the peer-to-peer networking space, other than the fact that I’ve documented the current state of affairs in QA1942 iOS Wi-Fi Management APIs.

                                        Share and Enjoy

                                        Quinn “The Eskimo!”
                                        Apple Developer Relations, Developer Technical Support, Core OS/Hardware
                                        let myEmail = "eskimo" + "1" + "@apple.com"

                                          • Re: iOS and Wi-Fi Direct
                                            arvindsn Level 1 Level 1 (0 points)

                                            Thanks for the explanation.  Can you point me to a document that gives the API on how to stream video from a MFI certified non-Apple device to an iOS device?  None of the BT profiles listed in section 2.2 of https://developer.apple.com/hardwaredrivers/BluetoothDesignGuidelines.pdf seem to support video streaming or anything close to the 24Mbps classic BT max data rate (is there a special profile to get higher data rate)?

                                             

                                            Also, the accessory service types listed in the HomeKit spec don't mention a video camera accessory (https://developer.apple.com/reference/homekit/hmservice/accessory_service_types?language=objc)

                                              • Re: iOS and Wi-Fi Direct
                                                eskimo Apple Staff Apple Staff (7,180 points)

                                                Can you point me to a document that gives the API on how to stream video from a MFI certified non-Apple device to an iOS device?

                                                The general API for talking to MFi devices is the ExternalAccessory framework.  It’s possible that MFi might have easier integration points for video accessories but I can’t speak to that; other folks here in DTS support MFi accessory development.

                                                If you want a definitive answer here, you should open an MFi tech support incident.

                                                Share and Enjoy

                                                Quinn “The Eskimo!”
                                                Apple Developer Relations, Developer Technical Support, Core OS/Hardware
                                                let myEmail = "eskimo" + "1" + "@apple.com"

                                                  • Re: iOS and Wi-Fi Direct
                                                    arvindsn Level 1 Level 1 (0 points)

                                                    Thanks, also can you comment on the HomeKit accessory type not mentioning a video camera accessory type.  Per WWDC 2016 talk it appears that getting a video stream from HomeKit accessory is supported.  Any sample code or pointer to details on how it is done will be useful.  Will also file the ticket on MFI.

                                                    • Re: iOS and Wi-Fi Direct
                                                      arvindsn Level 1 Level 1 (0 points)

                                                      Hi Quinn, one more question.  Suppose the accessory and iOS device are connected to the same WiFi AP.  Suppose iOS device has local IP address IP1 and is listening on port P1.  If the accessory opens a TCP connection to IP1/P1 (with the iOS app running) and WiFi AP allows packet to get routed, is there something in the iOS system that will prevent  this TCP connection from being established?

                                                        • Re: iOS and Wi-Fi Direct
                                                          eskimo Apple Staff Apple Staff (7,180 points)

                                                          … can you comment on the HomeKit accessory type not mentioning a video camera accessory type.

                                                          No, sorry.  I’ve seen user-level reports of HomeKit video cameras but I’ve no idea how that works at the developer level.  Again, this is something you should pursue via MFi’s support resources.

                                                          Suppose the accessory and iOS device are connected to the same WiFi AP.  Suppose iOS device has local IP address IP1 and is listening on port P1.  If the accessory opens a TCP connection to IP1/P1 (with the iOS app running) and WiFi AP allows packet to get routed, is there something in the iOS system that will prevent this TCP connection from being established?

                                                          That should work just fine.  If I’m reading the above correctly your question is equivalent to “Can iOS run a server that listens for incoming TCP connections?”, and the answer to that is, “Yes”.  There are tonnes of apps in the store that do this.

                                                          Share and Enjoy

                                                          Quinn “The Eskimo!”
                                                          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
                                                          let myEmail = "eskimo" + "1" + "@apple.com"

                                                    • Re: iOS and Wi-Fi Direct
                                                      rwforsythe Level 1 Level 1 (0 points)

                                                      Hi eskimo...

                                                       

                                                      Very helpful FAQ, but isn't there a missing option under peer-to-peer? As I understand it, a third party device that is broadcasting a Bonjour WiFi service will be discoverable by an iOS app via the "NSNetServiceBrowser" class.

                                                       

                                                      Thanks!

                                                        • Re: iOS and Wi-Fi Direct
                                                          eskimo Apple Staff Apple Staff (7,180 points)

                                                          As I understand it, a third party device that is broadcasting a Bonjour WiFi service will be discoverable by an iOS app via the NSNetServiceBrowser class.

                                                          That’s only true if the devices can ‘see’ it other via the underlying network interface.  So, it works just fine for Ethernet and infrastructure Wi-Fi, but won’t work for peer-to-peer Wi-Fi or Bluetooth because, as the Q&A says, the on-the-wire protocols used by this peer-to-peer networking are not documented for third-party use.

                                                          Share and Enjoy

                                                          Quinn “The Eskimo!”
                                                          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
                                                          let myEmail = "eskimo" + "1" + "@apple.com"

                                            • Re: iOS and Wi-Fi Direct
                                              johnfrommadison Level 1 Level 1 (0 points)

                                              Thanks for the information.

                                               

                                              My problem with Multipeer is WiFi file transfer is slow .

                                              I get only 16 mega bits per second on iPhone 6S and 7mbps on iPhone 5.

                                              (AC and N Wifi theoretical limits are 1300 and 450 mbps)

                                               

                                              Would the Bonjour + TCP method be faster than Multipeer?

                                                • Re: iOS and Wi-Fi Direct
                                                  eskimo Apple Staff Apple Staff (7,180 points)

                                                  My problem with Multipeer is WiFi file transfer is slow .

                                                  There’s two potential issues here:

                                                  • Peer-to-peer Wi-Fi has to jump through lots of hoops to work at all, and that slows things down.

                                                  • Multipeer Connectivity was tuned for latency, not bandwidth.

                                                  Would the Bonjour + TCP method be faster than Multipeer?

                                                  My guess is that it won’t help a lot, but I recommend that you avoid guessing and simply test it yourself.  Creating a simple Bonjour + TCP performance test is a relatively small task, and it’ll definitively answer this question.

                                                  Share and Enjoy

                                                  Quinn “The Eskimo!”
                                                  Apple Developer Relations, Developer Technical Support, Core OS/Hardware
                                                  let myEmail = "eskimo" + "1" + "@apple.com"