java - 通过telnet连接esp8266 android

标签 java android multithreading telnet arduino-esp8266

我很长一段时间以来一直在尝试通过 Telnet 从 android 应用程序发送字符串到 esp8266。我希望看到 arduino IDE 串行监视器上的输出。我使用了 send string to esp8266 via android using telnet 中的代码

以下是我在连接和发送按钮上运行 Android 代码时得到的日志。

01/18 20:02:32: Launching app
Cold swapped changes.
$ adb shell am start -n "com.example.manveenkaur.optimized/com.example.manveenkaur.optimized.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Connected to process 9556 on device samsung-sm_e700h-268ada67
I/InstantRun: Instant Run Runtime started. Android package is com.example.manveenkaur.optimized, real application class is null.
D/SecWifiDisplayUtil: Metadata value : none
W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
D/PhoneWindow: *FMB* installDecor mIsFloating : false
D/PhoneWindow: *FMB* installDecor flags : -2139029248
D/ViewRootImpl: Buffer Count from app info with  ::-1 && -1 for :: com.example.manveenkaur.optimized from View :: -1 DBQ Enabled ::false false
D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
D/PhoneWindow: *FMB* isFloatingMenuEnabled mFloatingMenuBtn : null
D/PhoneWindow: *FMB* isFloatingMenuEnabled return false
I/Adreno-EGL: <qeglDrvAPI_eglInitialize:379>: EGL 1.4 QUALCOMM build:  (I716aebe4f9)
              OpenGL ES Shader Compiler Version: E031.25.03.04
              Build Date: 07/01/15 수
              Local Branch: AU_LINUX_ANDROID_LA.BR.1.1.3_RB1.05.01.00.032.031_02060873_02063264
              Remote Branch: 
              Local Patches: 
              Reconstruct Branch: 
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Get maximum texture size. GL_MAX_TEXTURE_SIZE is 4096
D/OpenGLRenderer: Enabling debug mode 0
I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@1e34142f time:924988396
D/ViewRootImpl: ViewPostImeInputStage ACTION_DOWN
D/ViewRootImpl: Buffer Count from app info with  ::-1 && -1 for :: com.example.manveenkaur.optimized from View :: -1 DBQ Enabled ::false false
D/ViewRootImpl: ViewPostImeInputStage ACTION_DOWN
D/ViewRootImpl: ViewPostImeInputStage ACTION_DOWN
D/ViewRootImpl: ViewPostImeInputStage ACTION_DOWN`

1.我无法解析此ACTION_DOWN语句

2. 我还想知道“Buffer Count from app info with::-1 && -1 for::com.example.manveenkaur.optimized from View::-1 DBQ Enabled::false false”意味着什么

3.进一步单击“断开连接”,它会显示以下内容:-

W/System.err: java.io.IOException: BufferedInputStream is closed
W/System.err:     at java.io.BufferedInputStream.streamClosed(BufferedInputStream.java:125)
W/System.err:     at java.io.BufferedInputStream.read(BufferedInputStream.java:257)
W/System.err:     at java.io.BufferedInputStream.read(BufferedInputStream.java:290)
W/System.err:     at org.apache.commons.io.input.ProxyInputStream.read(ProxyInputStream.java:98)
W/System.err:     at org.apache.commons.io.input.TeeInputStream.read(TeeInputStream.java:127)
W/System.err:     at java.io.InputStreamReader.read(InputStreamReader.java:231)
W/System.err:     at java.io.BufferedReader.fillBuf(BufferedReader.java:145)
W/System.err:     at java.io.BufferedReader.readLine(BufferedReader.java:397)
W/System.err:     at com.example.manveenkaur.optimized.PioneerController$1.run(PioneerController.java:41)
W/System.err:     at java.lang.Thread.run(Thread.java:818)  

还有 这是activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

<LinearLayout     xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.manveenkaur.optimized.MainActivity">


    <EditText
        android:id="@+id/EditTextMessage"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:hint="@string/message"
        android:inputType="text"></EditText>

    <Button
        android:id="@+id/sendButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:text="@string/send_button_text"></Button>

    <Button
        android:id="@+id/connectButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:text="@string/connect_button_text"></Button>

    <Button
        android:id="@+id/disconnectButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:text="@string/disconnect_button_text"></Button>
</LinearLayout>
</FrameLayout>

最佳答案

先问一个问题:您使用 SoftwareSerial 还是 HardwareSerial 与 ESP8266 通信?使用 SoftwareSerial 不会让您满意。

关于java - 通过telnet连接esp8266 android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41723014/

相关文章:

android - "Cannot perform this operation because the connection pool has been closed."

java - PC 和 Android 之间的 Wifi-Direct 消息

python - wxPython 非阻塞 GUI 线程和多处理?

Java - 停止具有共享对象的线程

java - 为什么 Java StringLatin1.regionMatchesCI 方法在比较字符时执行 toUpperCase() 而不是 toLowerCase()?

java - 如何在java中清除二维数组以及如何备份我的二维数组?

java - 共享偏好

multithreading - 在全局异常处理程序中处理线程异常?

java - Android Parcelable 占用更多内存

java - 字符串片段需要替换为 '<'