Skip to content

Commit

Permalink
Merge pull request #1 from Sunoo/master
Browse files Browse the repository at this point in the history
Corrections
  • Loading branch information
pascalopitz committed Aug 30, 2020
2 parents 71f5972 + 40a34e2 commit cfcaf20
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 38 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -3,3 +3,4 @@ node_modules
.env
coverage
*.log
package-lock.json
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -166,7 +166,7 @@ const {bluetooth, destroy} = createBluetooth()
| `Promise<String[]> getFlags()` | Defines how the characteristic value can be used. |
| `Promise<bool> isNotifying()` | True, if notifications or indications on this characteristic are currently enabled. |
| `Promise<Buffer> readValue(Number offset = 0)` | Issues a request to read the value of the characteristic and returns the value if the operation was successful. |
| `Promise<Buffer> writeValue(Buffer buffer, Number offset = 0)` | Issues a request to write the value of the characteristic. |
| `Promise<void> writeValue(Buffer buffer, Number offset = 0)` | Issues a request to write the value of the characteristic. |
| `Promise<void> startNotifications()` | Starts a notification session from this characteristic if it supports value notifications or indications. |
| `Promise<void> stopNotifications()` | This method will cancel any previous StartNotify transaction. |
| `Promise<String> toString()` | User friendly characteristic name. |
Expand Down
73 changes: 36 additions & 37 deletions src/index.d.ts
Expand Up @@ -6,7 +6,7 @@ declare namespace NodeBle {
getFlags(): Promise<string[]>;
isNotifying(): Promise<boolean>;
readValue(offset?: number): Promise<Buffer>;
writeValue( buffer: Buffer, offset?: number): Promise<Buffer>;
writeValue(buffer: Buffer, offset?: number): Promise<void>;
startNotifications(): Promise<void>;
stopNotifications(): Promise<void>;
toString(): Promise<string>;
Expand All @@ -31,51 +31,50 @@ declare namespace NodeBle {
connected: boolean;
}

interface Device extends events.EventEmitter {
getName(): Promise<string>
getAddress(): Promise<string>
getAddressType(): Promise<string>
getAlias(): Promise<string>
getRSSI(): Promise<string>
isPaired(): Promise<string>
isConnected(): Promise<string>
pair(): Promise<void>
cancelPair(): Promise<void>
connect(): Promise<void>
disconnect(): Promise<void>
gatt(): Promise<GattServer>
toString(): Promise<string>
interface Device extends events.EventEmitter {
getName(): Promise<string>;
getAddress(): Promise<string>;
getAddressType(): Promise<string>;
getAlias(): Promise<string>;
getRSSI(): Promise<string>;
isPaired(): Promise<string>;
isConnected(): Promise<string>;
pair(): Promise<void>;
cancelPair(): Promise<void>;
connect(): Promise<void>;
disconnect(): Promise<void>;
gatt(): Promise<GattServer>;
toString(): Promise<string>;

on(event: 'connect', listener: (state: ConnectionState) => void): this;
on(event: 'disconnect', listener: (state: ConnectionState) => void): this;
}

interface Adapter {
getAddress(): Promise<string> ;
getAddressType(): Promise<string> ;
getName(): Promise<string> ;
getAlias(): Promise<string> ;
isPowered(): Promise<boolean> ;
isDiscovering(): Promise<boolean> ;
startDiscovery(): Promise<void> ;
stopDiscovery(): Promise<void> ;
devices(): Promise<string[]> ;
getDevice(uuid: string): Promise<Device> ;
waitDevice(uuid: string): Promise<Device> ;
toString(): Promise<string> ;
getAddress(): Promise<string>;
getAddressType(): Promise<string>;
getName(): Promise<string>;
getAlias(): Promise<string>;
isPowered(): Promise<boolean>;
isDiscovering(): Promise<boolean>;
startDiscovery(): Promise<void>;
stopDiscovery(): Promise<void>;
devices(): Promise<string[]>;
getDevice(uuid: string): Promise<Device>;
waitDevice(uuid: string): Promise<Device>;
toString(): Promise<string>;
}

interface BluetoothLibrary {
destroy(): void;
bluetooth: {
adapters(): Promise<string[]>;
delfaultAdapter(): Promise<string>;
getAdapter(adapter: string): Promise<Adapter>;
}
}
interface Bluetooth {
adapters(): Promise<string[]>;
defaultAdapter(): Promise<Adapter>;
getAdapter(adapter: string): Promise<Adapter>;
}

function createBluetooth(): BluetoothLibrary;
function destroy(): void;
function createBluetooth(): {
destroy(): void;
bluetooth: Bluetooth;
};
}

export = NodeBle;
Expand Down

0 comments on commit cfcaf20

Please sign in to comment.