我有以下代码给我一些传感器数据:
private void computeOrientation() {
        if (SensorManager.getRotationMatrix(m_rotationMatrix, null, m_lastAccels, m_lastMagFields)) {
            SensorManager.getOrientation(m_rotationMatrix, m_orientation);
            /* 1 radian = 57.2957795 degrees */
            /*
             * [0] : yaw, rotation around z axis [1] : pitch, rotation around x
             * axis [2] : roll, rotation around y axis
             */
            float yaw = m_orientation[0] * 57.2957795f;
            float pitch = m_orientation[1] * 57.2957795f;
            float roll = m_orientation[2] * 57.2957795f;
            /* append returns an average of the last 10 values */
            m_lastYaw = m_filters[0].append(yaw);
            m_lastPitch = m_filters[1].append(pitch);
            m_lastRoll = m_filters[2].append(roll);
            yawText.setText("azi z: " + m_lastYaw);
            pitchText.setText("pitch x: " + m_lastPitch);
            rollText.setText("roll y: " + m_lastRoll);
                    //Now I want to send those 3 values over the network
                    //whenever they're calculated
}
我估计每隔几毫秒就会调用这个函数,从onSensorChanged(SensorEvent event).
我想通过互联网不断地将这些数据发送/流式传输到远程设备,该设备将使用数据流实时计算事物。
我该怎么做?通过插座?一个异步任务?入门示例源代码将不胜感激=)