简体   繁体   English

同时使用Android 3g wifi

[英]Android 3g wifi simultaneously

I am using Android studio 2 and java , and i am writing an app that i need to be connected with a piece of hardware through wifi (parrot ar drone 2) and also "trigger" some events (takeoff land etc) through 3g network. 我正在使用Android studio 2java ,并且正在编写一个应用程序,我需要通过wifi(鹦鹉ar drone 2)将其与硬件连接,还需要通过3g网络“触发”某些事件(起飞地等)。 I have made a simple app using parrot sdk that do some simple things to my drone successfully . 我已经使用parrot sdk开发了一个简单的应用程序,可以成功地对无人机执行一些简单的操作。 I am facing now the challenge that these simple things i want to be driven through my server (i am thinking of websockets). 我现在面临的挑战是,我想通过服务器来驱动这些简单的事情(我正在考虑使用websockets)。 So my problem is : If my device is connected through wifi to the drone, how could i also connect to the internet in order to get "triggered" to run some commands? 所以我的问题是:如果我的设备通过wifi连接到无人机,我又该如何连接到互联网以“触发”运行某些命令?

I was thinking that would be great if o could connect my android device to the drone and with some way be connected to internet. 我当时想,如果o可以将我的android设备连接至无人机并以某种方式连接至互联网,那将是很好的。 After some research i have found that may be this functionality be available to android 6 BUT i have not found any example yet. 经过一番研究后,我发现此功能可能适用于android 6,但我还没有找到任何示例。 Generally i trying to find a solution (software or hardware). 通常,我试图找到一种解决方案(软件或硬件)。

I appreciate a lot any kind of help or suggestion about my problem. 对于我的问题,我非常感谢任何帮助或建议。

Thx in advance 提前Thx

I don't think it is possible to connect to 2 W-Lan hotspots simultaneously with just one chip. 我认为不可能仅用一个芯片同时连接到2个W-Lan热点。 Where did you find that information? 您在哪里找到这些信息?

You can set up your Android device as a WiFi hotspot and have your drone connect to the internet via that. 您可以将Android设备设置为WiFi热点,并使无人机通过该设备连接到互联网。

At the same time your app can connect to the drone, assuming your drone has some sort of local server like connection your app connects to. 同时,假设您的无人机具有某种本地服务器(例如您的应用程序要连接的连接),您的应用程序就可以连接到无人机。

You can check this in practice quickly by setting up a Wifi hotspot, connecting your drone and then using a ping utility on the phone to make sure you can ping the drone successfully. 您可以通过设置Wifi热点,连接无人机,然后使用手机上的ping实用工具来快速检查实际情况,以确保可以成功ping无人机。

If you want to connect from a remote server to the drone then you are dependent on your network allowing inbound connections, which is often not the case. 如果要从远程服务器连接到无人机,则取决于网络是否允许入站连接,而通常情况并非如此。 A common workaround is to use some form of mobile push notifications to send a message to your app asking it to contact a server on the internet, which will then tell it what action you want to perform on the drone. 常见的解决方法是使用某种形式的移动推送通知将消息发送到您的应用程序,要求它与Internet上的服务器联系,然后它将告诉它您想要在无人机上执行什么操作。 In others words: 换句话说:

  • send message to server on the internet somewhere to tell drone to take off 向互联网上的服务器发送消息以告知无人机起飞
  • your server triggers a push notification to the app on the phone 您的服务器触发推送通知到手机上的应用程序
  • the app contacts the server and asks 'what is the message for me' 该应用程序与服务器联系并询问“给我的消息是什么”
  • the server responds to the app with the 'tell drone to take off' message 服务器用“告诉无人机起飞”消息响应应用程序
  • the app messages the drone to tell it to take off 该应用会向无人机发送消息,告知其起飞

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM