通过 Android 手机中的耳机插孔发送数据
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10248649/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Sending Data through Headphone Hyman in Android phones
提问by Payam Mohajeri
I'm currently dealing with a new project and I have to send data through headphone Hyman with specific voltage, then i can work on that voltage.
我目前正在处理一个新项目,我必须通过具有特定电压的耳机插孔发送数据,然后我才能在该电压下工作。
so here i need to program the specific voltage depends on my data. is it possible that i can access the output voltage of headphones in android and then create a application to control that voltage?
所以在这里我需要根据我的数据对特定电压进行编程。是否有可能我可以在 android 中访问耳机的输出电压,然后创建一个应用程序来控制该电压?
采纳答案by davehale23
Here is a HackADay article dealing with this issue. http://hackaday.com/2010/02/01/android-audio-serial-connection/It offers working code which was quite a bit simpler than I thought it would be.
这是一篇关于这个问题的 HackADay 文章。 http://hackaday.com/2010/02/01/android-audio-serial-connection/它提供了比我想象的要简单得多的工作代码。
Although, like others have suggested, including thisvery similar SO post, you might have an easier time using the USB port.
虽然,就像其他人所建议的那样,包括这篇非常相似的 SO 帖子,您可能会更轻松地使用 USB 端口。
回答by Rizwan
the simplest way to catch input data from audio Hyman in android or iphone is through recording http://developer.android.com/reference/android/media/AudioRecord.html
从 android 或 iphone 中的音频插孔捕获输入数据的最简单方法是通过录制 http://developer.android.com/reference/android/media/AudioRecord.html
think something similar like playing a linear pcm audio file , I have n't tried but I believe it should work
想想类似播放线性 pcm 音频文件的东西,我没有尝试过,但我相信它应该可以工作
回答by user3704718
you could maybe try turning your data into binary for example when your listening to music your head phone Hyman changes +- vibrating to make a sound so you could make +- = 0 and -+ = 1
您可以尝试将您的数据转换为二进制,例如当您听音乐时,您的耳机插孔发生变化 +- 振动发出声音,这样您就可以使 +- = 0 和 -+ = 1
回答by Chad
I believe you will have to dive deep into Assembly type language, however, why the headphone Hyman? As I understand it, only reverberations and sound are transmittable through the headphone Hyman. I believe it would be more feasiable to output voltage through the Mini-USB port.
我相信您将不得不深入研究汇编语言,但是,为什么要使用耳机插孔?据我了解,只有混响和声音可以通过耳机插孔传输。我相信通过 Mini-USB 端口输出电压会更可行。
I think this site may be of some help regarding my method:
我认为这个网站可能对我的方法有帮助: