Java Code Examples for org.pmw.tinylog.Logger#debug()
The following examples show how to use
org.pmw.tinylog.Logger#debug() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MFRC522Test.java From diozero with MIT License | 6 votes |
private static MFRC522.UID getID(MFRC522 mfrc522) { // If a new PICC placed to RFID reader continue if (! mfrc522.isNewCardPresent()) { return null; } Logger.debug("A card is present!"); // Since a PICC placed get Serial and continue MFRC522.UID uid = mfrc522.readCardSerial(); if (uid == null) { return null; } // There are Mifare PICCs which have 4 byte or 7 byte UID care if you use 7 byte PICC // I think we should assume every PICC as they have 4 byte UID // Until we support 7 byte PICCs Logger.info("Scanned PICC's UID: {}", Hex.encodeHexString(uid.getUidBytes())); mfrc522.haltA(); return uid; }
Example 2
Source File: WifiScanner.java From trackworktime with GNU General Public License v3.0 | 6 votes |
public void onWifiScanFinished(boolean success) { if(success) { latestScanResults.clear(); latestScanResults.addAll(wifiManager.getScanResults()); latestScanResultTime = DateTimeUtil.getCurrentDateTime(); } if(!scanRequested) { Logger.debug("Another app initiated wifi-scan, caching results."); return; } if(wifiScanListener == null) { Logger.warn("Cannot dispatch scan results! " + WifiScanListener.class.getSimpleName() + " was null!"); } else if(success) { wifiScanListener.onScanResultsUpdated(latestScanResults); } else { wifiScanListener.onScanRequestFailed(Result.FAIL_RESULTS_NOT_UPDATED); } scanRequested = false; }
Example 3
Source File: MPU9150DMPDriver.java From diozero with MIT License | 6 votes |
/** * Set DMP output rate. Only used when DMP is on. * @param rate Desired fifo rate (Hz). * @throws RuntimeIOException if an I/O error occurs */ public void dmp_set_fifo_rate(int rate) throws RuntimeIOException { Logger.debug("dmp_set_fifo_rate({})", rate); if (rate > DMP_SAMPLE_RATE) { Logger.warn( "Requested rate ({}) was greater than DMP_SAMPLE_RATE ({})", rate, DMP_SAMPLE_RATE); return; } int div = DMP_SAMPLE_RATE / rate - 1; Logger.debug("dmp_set_fifo_rate(), div={}", div); byte[] tmp = new byte[2]; tmp[0] = (byte) ((div >> 8) & 0xFF); tmp[1] = (byte) (div & 0xFF); mpu.mpu_write_mem(DMP612.D_0_22, 2, tmp); byte[] regs_end = { DINAFE, DINAF2, DINAAB, (byte) 0xc4, DINAAA, DINAF1, DINADF, DINADF, (byte) 0xBB, (byte) 0xAF, DINADF, DINADF }; mpu.mpu_write_mem(DMP612.CFG_6, 12, regs_end); fifo_rate = rate; }
Example 4
Source File: ServoTest.java From diozero with MIT License | 6 votes |
@Test public void servoTest() { Servo.Trim trim = Servo.Trim.MG996R; Logger.debug("Min Pulse Width: {}, Min Angle: {}", Float.valueOf(trim.getMinPulseWidthMs()), Float.valueOf(trim.getMinAngle())); Logger.debug("Mid Pulse Width: {}, Mid Angle: {}", Float.valueOf(trim.getMidPulseWidthMs()), Float.valueOf(trim.getMidAngle())); Logger.debug("Max Pulse Width: {}, Max Angle: {}", Float.valueOf(trim.getMaxPulseWidthMs()), Float.valueOf(trim.getMaxAngle())); try (Servo servo = new Servo(0, trim.getMidPulseWidthMs(), trim)) { servo.setAngle(0); Logger.debug("Value: {}, Pulse Width: {}, Angle: {}", Float.valueOf(servo.getValue()), Float.valueOf(servo.getPulseWidthMs()), Float.valueOf(servo.getAngle())); Assert.assertEquals(trim.getMidPulseWidthMs() - trim.getNinetyDegPulseWidthMs(), servo.getPulseWidthMs(), DELTA); servo.setAngle(90); Logger.debug("Value: {}, Pulse Width: {}, Angle: {}", Float.valueOf(servo.getValue()), Float.valueOf(servo.getPulseWidthMs()), Float.valueOf(servo.getAngle())); Assert.assertEquals(trim.getMidPulseWidthMs(), servo.getPulseWidthMs(), DELTA); servo.setAngle(180); Logger.debug("Value: {}, Pulse Width: {}, Angle: {}", Float.valueOf(servo.getValue()), Float.valueOf(servo.getPulseWidthMs()), Float.valueOf(servo.getAngle())); Assert.assertEquals(trim.getMidPulseWidthMs() + trim.getNinetyDegPulseWidthMs(), servo.getPulseWidthMs(), DELTA); } }
Example 5
Source File: CassandraUtils.java From cassandra-jdbc-driver with Apache License 2.0 | 5 votes |
public static SQLException tryClose(AutoCloseable resource) { SQLException exception = null; if (resource != null) { String resourceName = new StringBuilder(resource.getClass() .getName()).append('@').append(resource.hashCode()) .toString(); Logger.debug(new StringBuilder("Trying to close [") .append(resourceName).append(']').toString()); try { resource.close(); Logger.debug(new StringBuilder().append("[") .append(resourceName) .append("] closed successfully").toString()); } catch (Throwable t) { exception = CassandraErrors.failedToCloseResourceException( resourceName, t); Logger.warn(t, new StringBuilder("Error occurred when closing [") .append(resourceName).append("]") .toString()); } } return exception; }
Example 6
Source File: JdkDeviceIoI2CDevice.java From diozero with MIT License | 5 votes |
@Override protected void closeDevice() throws RuntimeIOException { Logger.debug("closeDevice()"); if (device.isOpen()) { try { device.close(); } catch (IOException e) { throw new RuntimeIOException(e); } } }
Example 7
Source File: SoftwarePwmOutputDevice.java From diozero with MIT License | 5 votes |
@Override protected void closeDevice() { Logger.debug("closeDevice() {}", getKey()); stop(); if (digitalOutputDevice != null) { digitalOutputDevice.close(); digitalOutputDevice = null; } }
Example 8
Source File: MmapDigitalOutputDevice.java From diozero with MIT License | 5 votes |
@Override protected void closeDevice() { Logger.debug("closeDevice()"); // FIXME No GPIO close method? // TODO Revert to default input mode? // What do wiringPi / pigpio do? }
Example 9
Source File: Pi4jDigitalOutputDevice.java From diozero with MIT License | 5 votes |
@Override protected void closeDevice() { Logger.debug("closeDevice()"); digitalOutputPin.setState(false); digitalOutputPin.unexport(); GpioFactory.getInstance().unprovisionPin(digitalOutputPin); }
Example 10
Source File: JdkDeviceIoSpiDevice.java From diozero with MIT License | 5 votes |
@Override protected void closeDevice() throws RuntimeIOException { Logger.debug("closeDevice()"); if (device.isOpen()) { try { device.close(); } catch (IOException e) { throw new RuntimeIOException(e); } } }
Example 11
Source File: EventListActivity.java From trackworktime with GNU General Public License v3.0 | 5 votes |
private void startEditing(Event event) { Logger.debug("starting to edit the existing event with ID {} ({} @ {})", event.getId(), TypeEnum.byValue( event.getType()).toString(), event.getTime()); Intent i = new Intent(this, EventEditActivity.class); i.putExtra(Constants.EVENT_ID_EXTRA_KEY, event.getId()); startActivity(i); }
Example 12
Source File: CHIPBoardInfoProvider.java From diozero with MIT License | 5 votes |
private synchronized void loadXioGpioOffset() { if (! xioGpioOffsetLoaded) { // Determine the XIO GPIO base Path gpio_sysfs_dir = Paths.get("/sys/class/gpio"); // FIXME Treat as a stream try (DirectoryStream<Path> dirs = Files.newDirectoryStream(gpio_sysfs_dir, "gpiochip*")) { for (Path p : dirs) { if (Files.lines(p.resolve("label")).filter(line -> line.equals("pcf8574a")).count() > 0) { String dir_name = p.getFileName().toString(); xioGpioOffset = Integer.parseInt(dir_name.replace("gpiochip", "")); break; } /* try (BufferedReader reader = new BufferedReader(new FileReader(p.resolve("label").toFile()))) { if (reader.readLine().equals("pcf8574a")) { String dir_name = p.getFileName().toString(); xioGpioOffset = Integer.parseInt(dir_name.replace("gpiochip", "")); break; } } */ } Logger.debug("xioGpioOffset: {}", Integer.valueOf(xioGpioOffset)); } catch (IOException e) { Logger.error(e, "Error determining XIO GPIO base: {}", e); } xioGpioOffsetLoaded = true; } }
Example 13
Source File: McpAdc.java From diozero with MIT License | 4 votes |
@Override protected void closeDevice() { Logger.debug("closeDevice()"); // TODO Nothing to do? }
Example 14
Source File: I2CDevice.java From diozero with MIT License | 4 votes |
@Override public void close() throws RuntimeIOException { Logger.debug("close()"); device.close(); }
Example 15
Source File: MqttTestClient.java From diozero with MIT License | 4 votes |
@Override public void deliveryComplete(IMqttDeliveryToken token) { Logger.debug("Delivered message {}", token); }
Example 16
Source File: TimerManager.java From trackworktime with GNU General Public License v3.0 | 4 votes |
/** * Get the remaining time for today (in minutes). Takes into account the target work time for the week and also if * this * is the last day in the working week. * * @param includeFlexiTime * use flexi overtime to reduce the working time - ONLY ON LAST WORKING DAY OF THE WEEK! * @return {@code null} either if today is not a work day (as defined in the options) or if the regular working time * for today is already over */ public Integer getMinutesRemaining(boolean includeFlexiTime) { DateTime dateTime = DateTimeUtil.getCurrentDateTime(); WeekDayEnum weekDay = WeekDayEnum.getByValue(dateTime.getWeekDay()); if (isWorkDay(weekDay)) { TimeSum alreadyWorked = null; TimeSum target = null; boolean onEveryWorkingDayOfTheWeek = preferences.getBoolean(Key.FLEXI_TIME_TO_ZERO_ON_EVERY_DAY.getName(), false); if (!isFollowedByWorkDay(weekDay) || onEveryWorkingDayOfTheWeek) { alreadyWorked = calculateTimeSum(dateTime, PeriodEnum.WEEK); if (includeFlexiTime) { // add flexi balance from week start TimeSum flexiBalance = getFlexiBalanceAtWeekStart(DateTimeUtil.getWeekStart(dateTime)); alreadyWorked.addOrSubstract(flexiBalance); } final String targetValueString = preferences.getString(Key.FLEXI_TIME_TARGET.getName(), "0:00"); final TimeSum targetTimePerWeek = parseHoursMinutesString(targetValueString); final TimeSum targetTimePerDay = new TimeSum(); targetTimePerDay.add(0, targetTimePerWeek.getAsMinutes() / countWorkDays()); DateTime weekStart = DateTimeUtil.getWeekStart(dateTime); target = new TimeSum(); target.addOrSubstract(targetTimePerDay); // add today as well while (weekStart.getWeekDay().intValue() != dateTime.getWeekDay().intValue()) { target.addOrSubstract(targetTimePerDay); weekStart = weekStart.plusDays(1); } } else { // not the last work day of the week, only calculate the rest of the daily working time alreadyWorked = calculateTimeSum(dateTime, PeriodEnum.DAY); int targetMinutes = getNormalWorkDurationFor(weekDay); target = new TimeSum(); target.add(0, targetMinutes); } Logger.debug("alreadyWorked={}", alreadyWorked.toString()); Logger.debug("target={}", target.toString()); Logger.debug("isAutoPauseEnabled={}", isAutoPauseEnabled()); Logger.debug("isAutoPauseTheoreticallyApplicable={}", isAutoPauseTheoreticallyApplicable(dateTime)); Logger.debug("isAutoPauseApplicable={}", isAutoPauseApplicable(dateTime)); if (isAutoPauseEnabled() && isAutoPauseTheoreticallyApplicable(dateTime) && !isAutoPauseApplicable(dateTime)) { // auto-pause is necessary, but was NOT already taken into account by calculateTimeSum(): Logger.debug("auto-pause is necessary, but was NOT already taken into account by calculateTimeSum()"); DateTime autoPauseBegin = getAutoPauseBegin(dateTime); DateTime autoPauseEnd = getAutoPauseEnd(dateTime); alreadyWorked.substract(autoPauseEnd.getHour(), autoPauseEnd.getMinute()); alreadyWorked.add(autoPauseBegin.getHour(), autoPauseBegin.getMinute()); } int minutesRemaining = target.getAsMinutes() - alreadyWorked.getAsMinutes(); Logger.debug("minutesRemaining={}", minutesRemaining); return minutesRemaining; } else { return null; } }
Example 17
Source File: LocationTrackerService.java From trackworktime with GNU General Public License v3.0 | 4 votes |
@Override public int onStartCommand(Intent intent, int flags, @SuppressWarnings("hiding") int startId) { if (intent == null || intent.getExtras() == null) { // something went wrong, quit here return Service.START_NOT_STICKY; } Double latitude = (Double) intent.getExtras().get(Constants.INTENT_EXTRA_LATITUDE); Double longitude = (Double) intent.getExtras().get(Constants.INTENT_EXTRA_LONGITUDE); Double toleranceInMeters = (Double) intent.getExtras().get(Constants.INTENT_EXTRA_TOLERANCE); Boolean vibrate = (Boolean) intent.getExtras().get(Constants.INTENT_EXTRA_VIBRATE); Result result = null; if (isRunning.compareAndSet(false, true)) { this.startId = startId; result = locationTracker.startTrackingByLocation(latitude, longitude, toleranceInMeters, vibrate); } else if (!latitude.equals(locationTracker.getLatitude()) || !longitude.equals(locationTracker.getLongitude()) || !toleranceInMeters.equals(locationTracker.getTolerance()) || !vibrate.equals(locationTracker.shouldVibrate())) { // already running, but the data has to be updated result = locationTracker.startTrackingByLocation(latitude, longitude, toleranceInMeters, vibrate); } else { Logger.debug("LocationTrackerService is already running and nothing has to be updated - no action"); } if (result != null && result == Result.FAILURE_INSUFFICIENT_RIGHTS) { // disable the tracking and notify user of it basics.disableLocationBasedTracking(); basics .showNotification( "Disabling the location-based tracking because of missing privileges!", "Disabled location-based tracking!", "(open to see details)", basics .createMessagePendingIntent( "Track Work Time disabled the location-based tracking because of missing privileges. You can re-enable it in the options when the permission ACCESS_COARSE_LOCATION is granted.", Constants.MISSING_PRIVILEGE_ACCESS_COARSE_LOCATION_ID), Constants.MISSING_PRIVILEGE_ACCESS_COARSE_LOCATION_ID, false, null, null, null, null, null, null); } return Service.START_NOT_STICKY; }
Example 18
Source File: DigitalInputDevice.java From diozero with MIT License | 4 votes |
@Override public void close() { Logger.debug("close()"); device.close(); }
Example 19
Source File: PiconZero.java From diozero with MIT License | 4 votes |
public void closeChannel(int channel) { Logger.debug("closeChannel({})", Integer.valueOf(channel)); setInputConfig(channel, InputConfig.DIGITAL); }
Example 20
Source File: TestDigitalOutputDevice.java From diozero with MIT License | 4 votes |
@Override protected void closeDevice() { Logger.debug("closeDevice()"); }