コード例 #1
0
 public void sendMsg(String text, String deviceId, int type) {
   Packet packet = new Packet();
   packet.type = 200;
   packet.data = text;
   try {
     out.writeObject(packet);
     db.addMsg(deviceId, text, type);
     Log.e(MSG, "Message of \"" + text + "\" sent");
   } catch (IOException e) {
     e.printStackTrace();
     Log.e(FAIL, "Failed to send message BluetoothManager => sendMsg()");
   }
 }
コード例 #2
0
  private void sendPubKey(Context context) {
    Packet packet = new Packet();
    packet.type = 300;
    packet.data = db.getPubKey(context);

    try {
      out.writeObject(packet);
      Log.e(PASS, "Sent public key");
    } catch (IOException e) {
      e.printStackTrace();
      Log.e(FAIL, "Failed to send public key in BluetoothManager => sendPubKEy()");
    }
  }