mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-17 05:09:53 +01:00
Logging for modem plugin.
This commit is contained in:
@@ -71,6 +71,8 @@ class ModemPlugin implements DuplexPlugin, Modem.Callback {
|
|||||||
modem = modemFactory.createModem(this, portName);
|
modem = modemFactory.createModem(this, portName);
|
||||||
try {
|
try {
|
||||||
modem.init();
|
modem.init();
|
||||||
|
if(LOG.isLoggable(INFO))
|
||||||
|
LOG.info("Initialised modem on " + portName);
|
||||||
running = true;
|
running = true;
|
||||||
return true;
|
return true;
|
||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
@@ -90,6 +92,8 @@ class ModemPlugin implements DuplexPlugin, Modem.Callback {
|
|||||||
modem = modemFactory.createModem(this, portName);
|
modem = modemFactory.createModem(this, portName);
|
||||||
try {
|
try {
|
||||||
modem.init();
|
modem.init();
|
||||||
|
if(LOG.isLoggable(INFO))
|
||||||
|
LOG.info("Initialised modem on " + portName);
|
||||||
return true;
|
return true;
|
||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString());
|
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString());
|
||||||
@@ -136,9 +140,11 @@ class ModemPlugin implements DuplexPlugin, Modem.Callback {
|
|||||||
try {
|
try {
|
||||||
if(!modem.dial(number)) continue;
|
if(!modem.dial(number)) continue;
|
||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
|
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString());
|
||||||
if(resetModem()) continue;
|
if(resetModem()) continue;
|
||||||
else break;
|
else break;
|
||||||
}
|
}
|
||||||
|
if(LOG.isLoggable(INFO)) LOG.info("Outgoing call connected");
|
||||||
ModemTransportConnection conn = new ModemTransportConnection();
|
ModemTransportConnection conn = new ModemTransportConnection();
|
||||||
callback.outgoingConnectionCreated(c, conn);
|
callback.outgoingConnectionCreated(c, conn);
|
||||||
try {
|
try {
|
||||||
@@ -162,7 +168,7 @@ class ModemPlugin implements DuplexPlugin, Modem.Callback {
|
|||||||
try {
|
try {
|
||||||
if(!modem.dial(number)) return null;
|
if(!modem.dial(number)) return null;
|
||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
// Reinitialise the modem
|
if(LOG.isLoggable(WARNING)) LOG.warning(e.toString());
|
||||||
resetModem();
|
resetModem();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -184,6 +190,7 @@ class ModemPlugin implements DuplexPlugin, Modem.Callback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void incomingCallConnected() {
|
public void incomingCallConnected() {
|
||||||
|
if(LOG.isLoggable(INFO)) LOG.info("Incoming call connected");
|
||||||
callback.incomingConnectionCreated(new ModemTransportConnection());
|
callback.incomingConnectionCreated(new ModemTransportConnection());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,6 +212,7 @@ class ModemPlugin implements DuplexPlugin, Modem.Callback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void dispose(boolean exception, boolean recognised) {
|
public void dispose(boolean exception, boolean recognised) {
|
||||||
|
if(LOG.isLoggable(INFO)) LOG.info("Call disconnected");
|
||||||
try {
|
try {
|
||||||
modem.hangUp();
|
modem.hangUp();
|
||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user