change to support changed IRuffyService

This commit is contained in:
Sandra Keßler 2017-07-28 13:41:10 +02:00
parent 17b0e7d71a
commit 5e845e37f7
2 changed files with 15 additions and 2 deletions

View file

@ -6,9 +6,22 @@ import org.monkey.d.ruffy.ruffy.driver.IRTHandler;
interface IRuffyService { interface IRuffyService {
void setHandler(IRTHandler handler); void addHandler(IRTHandler handler);
void removeHandler(IRTHandler handler);
/** Connect to the pump
*
* @return 0 if successful, -1 otherwise
*/
int doRTConnect(); int doRTConnect();
/** Disconnect from the pump */
void doRTDisconnect(); void doRTDisconnect();
/*What's the meaning of 'changed'?
* changed means if a button state has been changed, like btton pressed is a change and button release another*/
void rtSendKey(byte keyCode, boolean changed); void rtSendKey(byte keyCode, boolean changed);
void resetPairing(); void resetPairing();
boolean isConnected();
boolean isBoundToPump();
} }

View file

@ -51,7 +51,7 @@ public class RuffyScripter {
public RuffyScripter(final IRuffyService ruffyService) { public RuffyScripter(final IRuffyService ruffyService) {
this.ruffyService = ruffyService; this.ruffyService = ruffyService;
try { try {
ruffyService.setHandler(mHandler); ruffyService.addHandler(mHandler);
idleDisconnectMonitorThread.start(); idleDisconnectMonitorThread.start();
} catch (RemoteException e) { } catch (RemoteException e) {
throw new RuntimeException(e); throw new RuntimeException(e);