Read the battery level.

@param callback the callback for the {@link com.punchthrough.bean.sdk.message.BatteryLevel}
result
774727
public void readBatteryLevel(final Callback<BatteryLevel> callback) {
        gattClient.getBatteryProfile().getBatteryLevel(new BatteryLevelCallback() {
            @Override
            public void onBatteryLevel(int percentage) {
                callback.onResult(new BatteryLevel(percentage));
            }
        });
    }
1168910
public void callback(final Callback callback)
    {
        Runnable runnable = new Runnable()
        {
            @Override
            public void run()
            {
                try
                {
                    callback.result(queryId, awaitResult());
                }
                catch (Exception e)
                {
                    callback.error(queryId, e);
                }
            }
        };
        EXECUTOR_SERVICE.submit(runnable);
    }
1196372
@Override
	public void removeCallback(Callback callback) {
		callbacks.remove(callback);
		if (manager != null) {
			callback.cleanup();
		}
	}
226561
public void readHardwareVersion(final Callback<String> callback) {
        gattClient.getDeviceProfile().getHardwareVersion(new DeviceProfile.VersionCallback() {
            @Override
            public void onComplete(String version) {
                callback.onResult(version);
            }
        });
    }
85743
public void readRadioConfig(Callback<RadioConfig> callback) {
        addCallback(BeanMessageID.BT_GET_CONFIG, callback);
        sendMessageWithoutPayload(BeanMessageID.BT_GET_CONFIG);
    }
967713
static org.apache.log4j.Level toLog4jLevel(java.util.logging.Level level) {
    if (level.intValue() >= java.util.logging.Level.SEVERE.intValue()) {
      return org.apache.log4j.Level.ERROR;
    } else if (level.intValue() >= java.util.logging.Level.WARNING.intValue()) {
      return org.apache.log4j.Level.WARN;
    } else if (level.intValue() >= java.util.logging.Level.INFO.intValue()) {
      return org.apache.log4j.Level.INFO;
    } else if (level.intValue() >= java.util.logging.Level.FINE.intValue()) {
      return org.apache.log4j.Level.DEBUG;
    }
    return org.apache.log4j.Level.TRACE;
  }
629340
public void enqueue(@Nullable final Callback<T> callback) {
    checkIfExecuted();
    this.callback.set(callback);
    dispatcher.execute(new Runnable() {
      @Override public void run() {
        T result;
        try {
          result = perform();
        } catch (Exception e) {
          notifyFailure(new ApolloException("Failed to perform store operation", e));
          return;
        }

        notifySuccess(result);
      }
    });
  }
966054
public static void printStackTrace(final Logger logger, final LogLevel logLevel) {
        printStackTrace((String) null, logger, logLevel);
    }
196400
@Override
  public void onSuccess(T result) {
    checkState();
    for (Callback<T> cb : callbacks) {
      cb.onSuccess(result);
    }
    callbacks = null; // note that we've fired
  }
6057
public void log (int level, String message, Throwable t)
    {
        if (isLevelEnabled(level)) {
            _sctx.log(message, t);
        }
    }
254247
def get_battery_level(self):
        

        battery_level = self.get_characteristic_handle_from_uuid(UUID_BATTERY_LEVEL)
        if battery_level is None:
            logger.warn('Failed to find handle for battery level')
            return None

        level = self.dongle._read_attribute(self.conn_handle, battery_level)
        if level is None:
            return -1
        return ord(level)
176801
public void loadRecent(final I_CmsSimpleCallback<List<CmsContainerElementData>> callback) {

        CmsRpcAction<List<CmsContainerElementData>> action = new CmsRpcAction<List<CmsContainerElementData>>() {

            /**
             * @see org.opencms.gwt.client.rpc.CmsRpcAction#execute()
             */
            @Override
            public void execute() {

                start(200, true);
                getContainerpageService().getRecentList(
                    CmsCoreProvider.get().getStructureId(),
                    getData().getDetailId(),
                    getPageState(),
                    getLocale(),
                    this);
            }

            /**
             * @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object)
             */
            @Override
            protected void onResponse(List<CmsContainerElementData> result) {

                stop(false);
                addElements(result);
                callback.execute(result);
            }
        };
        action.execute();
    }
132577
@Override
    public void registerEarlyRead(InterChannelCallback cb) {
        // LI4335.2
        if (null == cb) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "registerEarlyRead: Invalid null callback as input.");
            }
            throw new IllegalArgumentException("Callback is null");
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "App channel requesting early response read on " + getVC());
        }
        this.bEarlyReads = true;
        startEarlyRead(cb, true);
    }
1117931
public void readAccelerometerRange(Callback<AccelerometerRange> callback) {
        addCallback(BeanMessageID.CC_ACCEL_GET_RANGE, callback);
        sendMessageWithoutPayload(BeanMessageID.CC_ACCEL_GET_RANGE);
    }
462368
@JsIgnore
  public static void onReady(Runnable callback) {
    if (isReady) {
      callback.run();
      return;
    }

    onReadyCallbacks.push(callback);
  }
59634
public void readScratchData(ScratchBank bank, Callback<ScratchData> callback) {
        addCallback(BeanMessageID.BT_GET_SCRATCH, callback);
        Buffer buffer = new Buffer();
        buffer.writeByte(intToByte(bank.getRawValue()));
        sendMessage(BeanMessageID.BT_GET_SCRATCH, buffer);
    }
175501
private void addCallback(BeanMessageID type, Callback<?> callback) {
        List<Callback<?>> callbacks = beanCallbacks.get(type);
        if (callbacks == null) {
            callbacks = new ArrayList<>(16);
            beanCallbacks.put(type, callbacks);
        }
        callbacks.add(callback);
    }