Git Product home page Git Product logo

dokit's Introduction

Dokit

Build Status Static Analysis Documentation Codacy Grade Coverage Status

Quality Gate Status Maintainability Rating Reliability Rating Security Rating Bugs Vulnerabilities

Dokit is a set of cross-platform, open source tools for accessing Pokit measuring devices. It consists if primarily three components:

  1. QtPokit cross-platform Qt library - used extensively by the applications below, but also easily re-usable under the LGPL; and
  2. dokit CLI console application demonstrating most of the features of [QtPokit]; and
  3. Dokit GUI application - currently in very early stages of development.

Most Pokit Meter and Pokit Pro functions are supported, including the multimeter, oscilloscope and data logger functions. The one real feature missing currently is Pokit Pro's capacitance mode, which is not currently documented by Pokit (support will be added as soon as Pokit updates their documentation to include it... or I get around to reverse engineering it).

Also worth noting, is that while this project has extensive automated tests that run regularly on Linux, macOS and Windows, using a range of Qt versions from 5.9 to 6.4, most of the hands-on testing so far has been performed on Linux only. Testers with Pokit devices on macOS and Windows would be most welcome to help!

Usage

QtPokit Library

For shared library usage (for developers to create their own Pokit device applications), see the latest API docs.

dokit Command

The dokit CLI command is executed like:

dokit <command> [options]

Where <command> is one of: info, status, meter, dso, logger-start, logger-stop, logger-fetch, scan, set-name, flash-led, or calibrate

For example, to get a device's status:

dokit status

Outputs like:

Device name:           PokitMeter
Firmware version:      1.4
Maximum voltage:       60
Maximum current:       2
Maximum resistance:    1000
Maximum sampling rate: 1000
Sampling buffer size:  8192
Capability mask:       0
MAC address:           84:2E:14:2C:03:A8
Device status:         Idle (0)
Battery voltage:       2.76221
Battery status:        N/A (255)

Or, you can output in CSV, or JSON too, like:

dokit status --output json
{
    "battery": {
        "level": 2.760070562362671
    },
    "capabilityMask": 0,
    "deviceName": "PokitMeter",
    "deviceStatus": {
        "code": 0,
        "label": "Idle"
    },
    "firmwareVersion": {
        "major": 1,
        "minor": 4
    },
    "macAddress": "84:2E:14:2C:03:A8",
    "maximumCurrent": 2,
    "maximumResistance": 1000,
    "maximumSamplingRate": 1000,
    "maximumVoltage": 60,
    "samplingBufferSize": 8192
}

By default, the dokit command will use the first Pokit device it finds. However, if you have more than one device, you can specify the device's name, or MAC address, or (on macOS) device UUID, such as:

dokit status --device RedPokitPro

Tip: You can rename Pokit devices via the official Pokit app, or the set-name command, like:

dokit set-name --device Pokit --new-name PokitMeter

Here's a more complex usage example:

dokit meter --mode Vac --range 10V --samples 10 --output csv

This will fetch 10 AC meter readings, on the nearest range that can support 10Vac, and output those readings in CSV format:

For full usage information (albeit brief), use the --help option, which currently outputs something like:

Usage: dokit <command> [options]

Options:
  --color <yes|no|auto>    Colors the console output. Valid options are: yes,
                           no and auto. The default is auto.
  --debug                  Enable debug output.
  -d, --device <device>    Set the name, hardware address or macOS UUID of
                           Pokit device to use. If not specified, the first
                           discovered Pokit device will be used.
  -h, --help               Displays help on commandline options.
  --help-all               Displays help including Qt specific options.
  --interval <interval>    Set the update interval for DOS, meter and logger
                           modes. Suffixes such as 's' and 'ms' (for seconds and
                           milliseconds) may be used. If no suffix is present,
                           the units will be inferred from the magnitide of the
                           given interval. If the option itself is not
                           specified, a sensible default will be chosen
                           according to the selected command.
  --mode <mode>            Set the desired operation mode. For meter, dso, and
                           logger commands, the supported modes are: AC Voltage,
                           DC Voltage, AC Current, DC Current, Resistance,
                           Diode, Continuity, and Temperature. All are case
                           insensitive. Only the first four options are
                           available for dso and logger commands; the rest are
                           available in meter mode only. Temperature is also
                           available for logger commands, but requires firmware
                           v1.5 or later for Pokit devices to support it. For
                           the set-torch command supported modes are On and Off.
  --new-name <name>        Give the desired new name for the set-name command.
  --output <format>        Set the format for output. Supported formats are:
                           CSV, JSON and Text. All are case insenstitve. The
                           default is Text.
  --range <range>          Set the desired measurement range. Pokit devices
                           support specific ranges, such as 0 to 300mV. Specify
                           the desired upper limit, and the best range will be
                           selected, or use 'auto' to enable the Pokit device's
                           auto-range feature. The default is 'auto'.
  --samples <count>        Set the number of samples to acquire.
  --temperature <degrees>  Set the current ambient temperature for the
                           calibration command.
  --timeout <period>       Set the device discovery scan timeout.Suffixes such
                           as 's' and 'ms' (for seconds and milliseconds) may be
                           used. If no suffix is present, the units will be
                           inferred from the magnitide of the given interval.
                           The default behaviour is no timeout.
  --timestamp <period>     Set the optional starting timestamp for data
                           logging. Default to 'now'.
  --trigger-level <level>  Set the DSO trigger level.
  --trigger-mode <mode>    Set the DSO trigger mode. Supported modes are: free,
                           rising and falling. The default is free.
  -v, --version            Displays version information.

Command:
  info                     Get Pokit device information
  status                   Get Pokit device status
  meter                    Access Pokit device's multimeter mode
  dso                      Access Pokit device's DSO mode
  logger-start             Start Pokit device's data logger mode
  logger-stop              Stop Pokit device's data logger mode
  logger-fetch             Fetch Pokit device's data logger samples
  scan                     Scan Bluetooth for Pokit devices
  set-name                 Set Pokit device's name
  set-torch                Set Pokit device's torch on or off
  flash-led                Flash Pokit device's LED (Pokit Meter only)
  calibrate                Calibrate Pokit device temperature

Requirements

  • Qt5 v5.4+1 or Qt6 v6.2+2
  • a Qt-supported platform, such as Linux, macOS or Windows
  • a Pokit device, such as a Pokit Meter or Pokit Pro
  • CMake (for building Dokit itself) 3.8+
    • some unit tests won't be built unless using CMake 3.12 or later.

Building from Source

Prototypical CMake-based out-of-source build and test process, for CMake 3.13 or later:

cmake -D CMAKE_BUILD_TYPE=Release -S <path-to-cloned-repo> -B <tmp-build-dir>
cmake --build <tmp-build-dir>
ctest --test-dir <tmp-build-dir> --verbose

For CMake versions earlier than 3.13 (ie before CMake added the -B <build-dir> command line option):

cmake -E make_directory <tmp-build-dir>
cd <tmp-build-dir>
cmake -D CMAKE_BUILD_TYPE=Release -S <path-to-cloned-repo>
cmake --build <tmp-build-dir>
ctest --test-dir <tmp-build-dir> --verbose

Documentation

Configure the same as above, but build the doc and (optionally) doc-internal targets, for example:

cmake -S <path-to-cloned-repo> -B <tmp-build-dir>
cmake --build <tmp-build-dir> --target doc doc-internal
# ls <tmp-build-dir>/doc/public    # Library end-user documentation
# ls <tmp-build-dir>/doc/internal  # Internal developer documentation

These are regularly published to Github Pages via Github Actions:

License

QtPokit is freely available under the LGPL.

Footnotes

  1. The Qt BLE API was first added in v5.4 โ†ฉ

  2. The Qt Bluetooth module was ported to Qt6 in v6.2 โ†ฉ

dokit's People

Contributors

dependabot[bot] avatar korvinszanto avatar lnxsr avatar pcolby avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dokit's Issues

Pokit API Errata - Class GenericAccessService

Not an issue, but thought I could provide some clarity regarding the Pokit API Errata Class GenericAccessService comments/notes.

The Generic Access Service (GAS) '0x1800' is a service that all Bluetooth devices MUST have to conform to the Bluetooth Core Specifications. It is a mandatory part of the Generic Access Profile (GAP). This service is standardized for device discovery and initial connection to maintain consistency for device identification across different manufactures and device types. This service MUST contain, Device Name and Appearance, and optionally Peripheral Preferred Connection Parameters (PPCP). The PPCP provides suggested connection parameters like minimum/maximum connection interval, slave latency, and connection supervision timeout multiplier. This service typically won't be seen in the Services Discovered as this is the service used for the initial connection. Then, during the discoverServices you might see something like, 'Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms)', these parameters would be set by the PPCP of the GAS.

Hope this helps!
@pcolby

Raspberry Pi support

Builds for ARM64 boards are much appreciated. I've put together a portable computer using Raspberry Pi and happen to own a Pokit Pro. Having this running on my Raspberry Pi would help reduce my dependence on phones.

`QBluetoothDeviceDiscoveryAgent::MissingPermissionsError` when running on arm macos

I get the following after building with cmake 3.26.3:

./build/src/cli/dokit status
dokit.cli.command: Looking for first available Pokit device...
qt.bluetooth.darwin: A proper Info.plist with NSBluetoothAlwaysUsageDescription entry is required, cannot start device discovery
pokit.ble.discovery: Pokit device scan error: QBluetoothDeviceDiscoveryAgent::MissingPermissionsError
dokit.cli.command: Bluetooth controller error: QBluetoothDeviceDiscoveryAgent::MissingPermissionsError

Translations

QtPokit is fully internationalised, meaning that localisations can be added very easily.

If you would like to contribute a localisation for a language of your choice, let us know ๐Ÿ˜„

You don't need any coding knowledge at all. The translations can be edited via the Qt Linguist tool on any platform.

Accoustic continuity signal

What about adding an optional accoustic signal in continuity mode to pokit CLI?

On PC the pc speaker could be used, e.g. via QApplication::beep().
On devices without physical speaker and/or execution within terminal, the ASCII BEL character could be used.

Activation could be done like this: pokit meter --mode continuity --output bell

Compile on Windows

Does someone has a good pointer on instructions on getting the proper tools on a windows machine to compile this?
I guess my queries were not good in Google and I did not find any relevant documents. On linux this is so much easier but I need a windows executable for presentation purposes of signals we measure with on a digital train layout.

Build instructions ?

Following the build instructions in the README, I get

niall@preston:~/sandbox/qtpokit$ cmake -E make_directory tmp-build
niall@preston:~/sandbox/qtpokit$ cmake -D CMAKE_BUILD_TYPE=Release -S . -B tmp-build
CMake Error: The source directory "/home/niall/sandbox/qtpokit/tmp-build" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.

Trying build on Ubuntu 18.04, Qt v 5.9.5 ...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.