Skip to content

Commit

Permalink
bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
Stevie-Ray committed Oct 25, 2024
1 parent c131f37 commit e314d34
Show file tree
Hide file tree
Showing 10 changed files with 218 additions and 39 deletions.
2 changes: 1 addition & 1 deletion examples/chart/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@fortawesome/free-brands-svg-icons": "^6.6.0",
"@fortawesome/free-regular-svg-icons": "^6.6.0",
"@fortawesome/free-solid-svg-icons": "^6.6.0",
"@hangtime/grip-connect": "^0.5.8",
"@hangtime/grip-connect": "^0.5.9",
"chart.js": "^4.4.5"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/flappy-bird/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"preview": "vite preview"
},
"dependencies": {
"@hangtime/grip-connect": "^0.5.8"
"@hangtime/grip-connect": "^0.5.9"
},
"devDependencies": {
"typescript": "^5.6.3",
Expand Down
2 changes: 1 addition & 1 deletion examples/kilter-board/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"preview": "vite preview"
},
"dependencies": {
"@hangtime/grip-connect": "^0.5.8"
"@hangtime/grip-connect": "^0.5.9"
},
"devDependencies": {
"typescript": "^5.6.3",
Expand Down
2 changes: 1 addition & 1 deletion examples/pong/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"preview": "vite preview"
},
"dependencies": {
"@hangtime/grip-connect": "^0.5.8"
"@hangtime/grip-connect": "^0.5.9"
},
"devDependencies": {
"typescript": "^5.6.3",
Expand Down
40 changes: 17 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@
],
"dependencies": {
"@grip-connect/docs": "*",
"@hangtime/grip-connect": "^0.5.8"
"@hangtime/grip-connect": "^0.5.9"
},
"devDependencies": {
"@eslint/js": "^9.9.0",
"@types/eslint__js": "^8.42.3",
"@types/node": "^20.17.0",
"@types/node": "^20.17.1",
"@types/web-bluetooth": "^0.0.20",
"eslint": "^9.13.0",
"husky": "^9.1.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hangtime/grip-connect",
"version": "0.5.8",
"version": "0.5.9",
"description": "Griptonite Motherboard, Tindeq Progressor, PitchSix Force Board, WHC-06, Entralpi, Climbro, mySmartBoard: Web Bluetooth API Force-Sensing strength analysis for climbers",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
71 changes: 67 additions & 4 deletions packages/core/src/interfaces/device.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,54 @@ export interface IDevice extends IBase {
*/
commands: Commands

/**
* Sets the callback function to be called when the activity status changes,
* and optionally sets the configuration for threshold and duration.
*
* This function allows you to specify a callback that will be invoked whenever
* the activity status changes, indicating whether the device is currently active.
* It also allows optionally configuring the threshold and duration used to determine activity.
*
* @param {ActiveCallback} callback - The callback function to be set. This function
* receives a boolean value indicating the new activity status.
* @param {object} [options] - Optional configuration object containing the threshold and duration.
* @param {number} [options.threshold=2.5] - The threshold value for determining activity.
* @param {number} [options.duration=1000] - The duration (in milliseconds) to monitor the input for activity.
* @returns {void}
* @public
*
* @example
* device.active((isActive) => {
* console.log(`Device is ${isActive ? 'active' : 'inactive'}`);
* }, { threshold: 3.0, duration: 1500 });
*/
active(callback?: (data: boolean) => void, options?: { threshold?: number; duration?: number }): void

/**
* Connects to a Bluetooth device.
* @param {Function} [onSuccess] - Optional callback function to execute on successful connection. Default logs success.
* @param {Function} [onError] - Optional callback function to execute on error. Default logs the error.
* @public
*
* @example
* device.connect(
* () => console.log("Connected successfully"),
* (error) => console.error("Connection failed:", error)
* );
*/
connect(onSuccess?: () => void, onError?: (error: Error) => void): Promise<void>

/**
* Disconnects the device if it is currently connected.
* - Checks if the device is connected via it's GATT server.
* - If the device is connected, it attempts to gracefully disconnect.
* - Removes all notification listeners from the device's characteristics.
* - Removes the 'gattserverdisconnected' event listener.
* - Attempts to gracefully disconnect the device's GATT server.
* - Resets relevant properties to their initial states.
* @returns {void}
* @public
*
* @example
* device.disconnect();
*/
disconnect(): void

Expand All @@ -94,13 +129,23 @@ export interface IDevice extends IBase {
*
* @returns {void} Initiates a download of the data in the specified format.
* @private
*
* @example
* device.download('json');
*/
download(format?: "csv" | "json" | "xml"): void

/**
* Checks if a Bluetooth device is connected.
* @returns {boolean} A boolean indicating whether the device is connected.
* @public
*
* @example
* if (device.isConnected()) {
* console.log('Device is connected');
* } else {
* console.log('Device is not connected');
* }
*/
isConnected(): boolean

Expand All @@ -109,6 +154,11 @@ export interface IDevice extends IBase {
* @param {NotifyCallback} callback - The callback function to be set.
* @returns {void}
* @public
*
* @example
* device.notify((data) => {
* console.log('Received notification:', data);
* });
*/
notify(callback: (data: massObject) => void): void

Expand All @@ -119,15 +169,28 @@ export interface IDevice extends IBase {
* @param {number} [duration=0] - The duration to wait before resolving the promise, in milliseconds.
* @returns {Promise<string | undefined>} A promise that resolves when the read operation is completed.
* @public
*
* @example
* const value = await device.read('battery', 'level', 1000);
* console.log('Battery level:', value);
*/
read(serviceId: string, characteristicId: string, duration?: number): Promise<string | undefined>

/**
* Initiates the tare calibration process.
* @param {number} duration - The duration time for tare calibration.
* @returns {void}
* @returns {boolean} A boolean indicating whether the tare calibration was successful.
* @public
*
* @example
* const success = device.tare(5000);
* if (success) {
* console.log('Tare calibration started');
* } else {
* console.log('Tare calibration failed to start');
* }
*/
tare(duration?: number): void
tare(duration?: number): boolean

/**
* Writes a message to the specified characteristic of a Bluetooth device and optionally provides a callback to handle responses.
Expand Down
Loading

0 comments on commit e314d34

Please sign in to comment.