@psdk/device-bluetooth-traits
Advanced tools
Comparing version 0.5.17 to 0.5.18
@@ -1,6 +0,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.TBluetoothHelpers = void 0; | ||
const types_1 = require("./types"); | ||
class TBluetoothHelpers { | ||
import { AllowRule } from "./types"; | ||
export class TBluetoothHelpers { | ||
static isAllowService(serviceUUID, allowService) { | ||
@@ -10,9 +7,8 @@ return this.isAllowServices(serviceUUID, allowService && [allowService]); | ||
static isAllowServices(serviceUUID, allowServices) { | ||
var _a; | ||
if (allowServices == undefined) | ||
return true; | ||
for (const allowService of allowServices) { | ||
const rule = (_a = allowService.rule) !== null && _a !== void 0 ? _a : types_1.AllowRule.EQUALS; | ||
const rule = allowService.rule ?? AllowRule.EQUALS; | ||
switch (rule) { | ||
case types_1.AllowRule.EQUALS: { | ||
case AllowRule.EQUALS: { | ||
if (serviceUUID == allowService.uuid) | ||
@@ -22,3 +18,3 @@ return true; | ||
} | ||
case types_1.AllowRule.START_WITH: { | ||
case AllowRule.START_WITH: { | ||
if (serviceUUID.startsWith(allowService.uuid)) | ||
@@ -28,3 +24,3 @@ return true; | ||
} | ||
case types_1.AllowRule.END_WITH: { | ||
case AllowRule.END_WITH: { | ||
if (serviceUUID.endsWith(allowService.uuid)) | ||
@@ -34,3 +30,3 @@ return true; | ||
} | ||
case types_1.AllowRule.REGEX: { | ||
case AllowRule.REGEX: { | ||
if (new RegExp(allowService.uuid).test(serviceUUID)) | ||
@@ -44,2 +40,1 @@ return true; | ||
} | ||
exports.TBluetoothHelpers = TBluetoothHelpers; |
@@ -1,19 +0,3 @@ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./traits"), exports); | ||
__exportStar(require("./types"), exports); | ||
__exportStar(require("./helpers"), exports); | ||
export * from './traits'; | ||
export * from './types'; | ||
export * from './helpers'; |
@@ -1,8 +0,5 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Jluetooth = void 0; | ||
/** | ||
* absctract bluetooth class | ||
*/ | ||
class Jluetooth { | ||
export class Jluetooth { | ||
async isDiscovery() { | ||
@@ -13,2 +10,1 @@ const state = await this.bluetoothAdapterState(); | ||
} | ||
exports.Jluetooth = Jluetooth; |
export declare class JluetoothDevice<T> { | ||
origin: T; | ||
name: String; | ||
deviceId: String; | ||
name: string; | ||
deviceId: string; | ||
constructor(options: { | ||
origin: T; | ||
name: String; | ||
deviceId: String; | ||
name: string; | ||
deviceId: string; | ||
}); | ||
@@ -10,0 +10,0 @@ } |
@@ -1,5 +0,5 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AllowRule = exports.JluetoothDevice = void 0; | ||
class JluetoothDevice { | ||
export class JluetoothDevice { | ||
origin; | ||
name; | ||
deviceId; | ||
constructor(options) { | ||
@@ -11,4 +11,3 @@ this.origin = options.origin; | ||
} | ||
exports.JluetoothDevice = JluetoothDevice; | ||
var AllowRule; | ||
export var AllowRule; | ||
(function (AllowRule) { | ||
@@ -19,2 +18,2 @@ AllowRule["EQUALS"] = "EQUALS"; | ||
AllowRule["REGEX"] = "REGEX"; | ||
})(AllowRule || (exports.AllowRule = AllowRule = {})); | ||
})(AllowRule || (AllowRule = {})); |
@@ -1,2 +0,2 @@ | ||
var a=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var v=(r,e)=>{for(var i in e)a(r,i,{get:e[i],enumerable:!0})},f=(r,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of u(e))!b.call(r,t)&&t!==i&&a(r,t,{get:()=>e[t],enumerable:!(o=l(e,t))||o.enumerable});return r};var p=r=>f(a({},"__esModule",{value:!0}),r);var S={};v(S,{AllowRule:()=>c,Jluetooth:()=>n,JluetoothDevice:()=>s,TBluetoothHelpers:()=>d});module.exports=p(S);var n=class{async isDiscovery(){return(await this.bluetoothAdapterState()).discovering||!1}};var s=class{constructor(e){this.origin=e.origin,this.name=e.name,this.deviceId=e.deviceId}},c=(t=>(t.EQUALS="EQUALS",t.START_WITH="START_WITH",t.END_WITH="END_WITH",t.REGEX="REGEX",t))(c||{});var d=class{static isAllowService(e,i){return this.isAllowServices(e,i&&[i])}static isAllowServices(e,i){var o;if(i==null)return!0;for(let t of i)switch((o=t.rule)!=null?o:"EQUALS"){case"EQUALS":{if(e==t.uuid)return!0;break}case"START_WITH":{if(e.startsWith(t.uuid))return!0;break}case"END_WITH":{if(e.endsWith(t.uuid))return!0;break}case"REGEX":{if(new RegExp(t.uuid).test(e))return!0;break}}}}; | ||
var a=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var v=(r,e)=>{for(var i in e)a(r,i,{get:e[i],enumerable:!0})},f=(r,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of u(e))!b.call(r,t)&&t!==i&&a(r,t,{get:()=>e[t],enumerable:!(o=l(e,t))||o.enumerable});return r};var p=r=>f(a({},"__esModule",{value:!0}),r);var g={};v(g,{AllowRule:()=>c,Jluetooth:()=>s,JluetoothDevice:()=>n,TBluetoothHelpers:()=>d});module.exports=p(g);var s=class{async isDiscovery(){return(await this.bluetoothAdapterState()).discovering||!1}};var n=class{origin;name;deviceId;constructor(e){this.origin=e.origin,this.name=e.name,this.deviceId=e.deviceId}},c=(t=>(t.EQUALS="EQUALS",t.START_WITH="START_WITH",t.END_WITH="END_WITH",t.REGEX="REGEX",t))(c||{});var d=class{static isAllowService(e,i){return this.isAllowServices(e,i&&[i])}static isAllowServices(e,i){var o;if(i==null)return!0;for(let t of i)switch((o=t.rule)!=null?o:"EQUALS"){case"EQUALS":{if(e==t.uuid)return!0;break}case"START_WITH":{if(e.startsWith(t.uuid))return!0;break}case"END_WITH":{if(e.endsWith(t.uuid))return!0;break}case"REGEX":{if(new RegExp(t.uuid).test(e))return!0;break}}}}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@psdk/device-bluetooth-traits", | ||
"version": "0.5.17", | ||
"version": "0.5.18", | ||
"description": "psdk - device bluetooth traits", | ||
@@ -27,3 +27,3 @@ "main": "build/index.js", | ||
"dependencies": { | ||
"@psdk/frame-father": "0.5.17", | ||
"@psdk/frame-father": "0.5.18", | ||
"await-timeout": "^1.1.1" | ||
@@ -36,3 +36,3 @@ }, | ||
], | ||
"gitHead": "46943a9d832ca94079de06670bc167c18feddf60" | ||
"gitHead": "c1d3ad454ff82f138a744d59b38bb6b933edc389" | ||
} |
Sorry, the diff of this file is not supported yet
15019
161
+ Added@psdk/frame-father@0.5.18(transitive)
- Removed@psdk/frame-father@0.5.17(transitive)
Updated@psdk/frame-father@0.5.18