
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
tirecheck-device-sdk
Advanced tools
SDK for working with various devices produced by Tirecheck via Bluetooth (CAN Bridge, Routers, Sensors, FlexiGauge, PressureStick, etc)
First, install this library as a dependency to your application:
pnpm add tirecheck-device-sdk
Then, create an instance of this SDK. You will need to provide implementation for basic bluetooth methods on your
environment - this library is optimized for usage with cordova-plugin-ble-central on mobile devices, but you can
provide any other implementation:
// tirecheckDeviceSdk.ts
import { createTirecheckDeviceSdk } from 'tirecheck-device-sdk'
export default createTirecheckDeviceSdk('android', {
// See typescript definitions for more info
startScanWithOptions: ...
connect: ...
write: ...
read: ...
})
// OR, if you're using `cordova-plugin-ble-central`:
export default createTirecheckDeviceSdk('android', window.ble.withPromises)
Example library usage:
const foundBridges = {}
tirecheckDeviceSdk.bluetooth.scanDevices(device => {
if(device.type === 'bridge') foundBridges[device.id] = device
})
await tirecheckDeviceSdk.bridge.connect(deviceId)
await tirecheckDeviceSdk.bridge.readVehicleSchema(deviceId)
corepack enable (sometimes sudo corepack enable is needed)pnpm devThat should open Vitest's UI. Feel free to add new functionality and tests.
CI is set up in a way that new version of package is published to NPM if change in package.json's version field is
detected. So, if you want to publish your changes, increment version in package.json as part of your merge request.
For this project, we advice to follow TDD for every feature. That means that you first write failing test, and then add implementation so that test passes.
Focus on one small improvement at a time - one failing test, then make it pass, then another failing test, etc. Mentally this approach is much easier because you don't need to think about system as a whole
To test the library in your application, without publishing them to npm, please, run following commands:
// From /Work/tirecheck-device-sdk
pnpm build
// From /Work/my-app
pnpm link ../tirecheck-device-sdk
This will temporarily ensure that package is taken from your local directory and not from package.json.
deviceMeta for storing generic device info and methods for processing advertisement for all supported devices
devices/* for exposed logic related to devices after they're connected. That includes methods connect and
disconnect.bridge, it is useful to create bridgeCommands file, that contain commands.
Command = method that accepts human-readable arguments and converts them to single low-level call of ble (i.e. it
just converts human-readable data to binary data and sends them to ble).// bridge.ts - methods from this file are exposed to library users
import bridgeCommands from './bridgeCommands'
export default {
// You can expose command directly...
getMeasurement: bridgeCommands.getMeasurement,
// Or expose method that calls sequence of commands
async getVehicleSchema() {
const axles = await bridgeCommands.getVehicleAxles()
for(let i = 0; i < axles.length; i++) {
const tyres = await bridgeCommands.getVehicleTyres(i)
}
return { axles, tyres }
}
}
services/* for logic shared between devices. Those files won't be exposed in the build.bridge.writeConfiguration or bridge.writeAxleSetup instead of generic
bridge.writeMessageread* and write* for methods that primarily read/write to/from deviceon* for "subscription" methods - e.g. tirecheckDeviceSdk.bridge.onMeasurementReceived(callback)this keyword.// Bad
export default {
foo() {},
bar() {
this.foo()
}
}
// Good
export default {
foo,
bar() {
foo()
}
}
function foo() {}
For each supported device, you must provide a simulator. It is important for testing final apps. Simulator replaces high-level calls - i.e. it works with human-readable data and doesn't need to convert data to binary
commands layer, such as bridge example above, we advice to simulate only commands layer,
and leave top-level as isIf you wish to include a new change, process is as follows:
main that includes your name and ticket number from Jira, e.g.
leonid-buneev/INF-1234tirecheck-device-sdk in the package.json of your app to download latest SDK version.You can contact tirecheck if you need support - admin@tirecheck.com
[x] Initial structure
[x] Simulators
[x] Ability to test against real devices
[x] Full CAN bridge support
[x] CAN Bridge Firmware Update support
[x] FlexiGauge
[] TPMS Router
Each device has its own methods for communication. Generic bluetooth methods are not exposed.
FAQs
SDK for working with various devices produced by Tirecheck via Bluetooth (CAN Bridge, Routers, Sensors, FlexiGauge, PressureStick, etc)
We found that tirecheck-device-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.