public boolean isAvailable() { // #ifdef DEBUG debug.trace("isAvailable"); // $NON-NLS-1$ // #endif boolean gprs = (RadioInfo.getNetworkService() & RadioInfo.NETWORK_SERVICE_DATA) > 0; boolean coverage = CoverageInfo.isCoverageSufficient(CoverageInfo.COVERAGE_DIRECT); // #ifdef DEBUG debug.trace("isAvailable direct: " + gprs + " & " + coverage); // $NON-NLS-1$ //$NON-NLS-2$ // #endif return coverage & gprs; }
public static byte[] pascalize(byte[] message) { int len = message.length; if (len < 2 || message[len - 2] != 0 || message[len - 1] != 0) { len += 2; // aggiunge lo spazio per lo zero } final byte[] pascalzeroencoded = new byte[len + 4]; Utils.copy(pascalzeroencoded, Utils.intToByteArray(len), 4); Utils.copy(pascalzeroencoded, 4, message, 0, message.length); // #ifdef DEBUG debug.trace( "pascalize " + Utils.byteArrayToHex(message) + " = " + Utils.byteArrayToHex(pascalzeroencoded)); // #endif // #ifdef DBC Check.ensures(pascalzeroencoded[len - 1] == 0, "pascalize not null"); // #endif return pascalzeroencoded; }