示例#1
0
    IEnumerator WriteUpdate()
    {
        var wait = new WaitForSeconds(0.5f);

        for (;;)
        {
            yield return(wait);

            if (m_isConnect)
            {
                m_buffer = JsonBinaryUtility.ToByteArray(Input.acceleration);
                if (!Bluetooth.Write(m_buffer))
                {
                    Bluetooth.Close();
                    m_isConnect = false;
                }
                // bufferのクリア
                for (int i = 0; i < m_buffer.Length; ++i)
                {
                    m_buffer[i] = 0;
                }
            }
        }
    }
示例#2
0
 public void OnWrite()
 {
     byte[] data = JsonBinaryUtility.ToByteArray(Input.acceleration);
     Bluetooth.Write(data);
 }