Skip to content

Commit

Permalink
added functionality to send bytes to wifi p2p devices
Browse files Browse the repository at this point in the history
  • Loading branch information
bayosip committed Nov 14, 2021
1 parent 5511864 commit 341d4b3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,17 @@ public void sendInstructionsToRemoteDevice(@Nullable String deviceAddress,
p2pService.writeInstructions(instructions);
}

private ServiceConnection mConnection =
@Override
public void sendInstructionsToConnectedDevice(String deviceAddr, @Nullable UUID charxDescriptor, byte[] data) {
p2pService.writeInstructions(data);
}

@Override
public void sendInstructionsToConnectedDevice(String deviceAddr, byte[] data) {
p2pService.writeInstructions(data);
}

private final ServiceConnection mConnection =
/*
* Defines callbacks for p2pService binding, passed to bindService()
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ public void writeInstructions(String instruct) {
sendReceive.write(instruct.getBytes());
}

public void writeInstructions(byte[] data) {
if(sendReceive!=null)
sendReceive.write(data);
}

private void disconnect() {
p2pManager.cancelConnect(p2pChannel, new WifiP2pManager.ActionListener() {
@Override
Expand Down

0 comments on commit 341d4b3

Please sign in to comment.