Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update napi-rs, regenerate, format, bump #2

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
## Usage

```typescript
import { DisplayManager, VCPFeatureCode } from "@ddc-node/ddc-node";
import { DisplayManager, VCPFeatureCode } from '@ddc-node/ddc-node'

const displays = await (new DisplayManager()).collect();
const displays = await new DisplayManager().collect()

for (const display of displays) {
const vcp_feature = await display.getVcpFeature(VCPFeatureCode.ImageAdjustment.Luminance);
console.info(`Display at index ${display.index} have a brightness value of`);
console.info(vcp_feature);
await display.setVcpFeature(VCPFeatures.ImageAdjustment.Luminance, vcp_feature.currentValue + 5);
const vcp_feature = await display.getVcpFeature(VCPFeatureCode.ImageAdjustment.Luminance)
console.info(`Display at index ${display.index} have a brightness value of`)
console.info(vcp_feature)
await display.setVcpFeature(VCPFeatures.ImageAdjustment.Luminance, vcp_feature.currentValue + 5)
}
```
30 changes: 13 additions & 17 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

/* auto-generated by NAPI-RS */

export const enum VcpValueType {
export enum VcpValueType {
Continuous = 0,
NonContinuous = 1,
Table = 2,
Expand All @@ -23,7 +23,7 @@ export interface Table {
currentData: Array<number>
type: VcpValueType.Table
}
export const enum JsQueryType {
export enum JsQueryType {
Backend = 0,
Id = 1,
ManufacturerId = 2,
Expand All @@ -35,7 +35,7 @@ export interface Query {
queryValue: string
}
export type JsDisplay = Display
export class Display {
export declare class Display {
index: number
backend: string
edidData?: Uint8Array
Expand All @@ -52,15 +52,11 @@ export class Display {
capabilities?: string
constructor(index: number)
getVcpFeature(featureCode: number): Promise<Continuous | NonContinuous | Table>
setVcpFeature(
featureCode: number,
valueOrOffset: number,
bytes?: Array<number> | undefined | null,
): Promise<undefined>
setVcpFeature(featureCode: number, valueOrOffset: number, bytes?: Array<number> | undefined | null): Promise<void>
updateCapabilities(): string | null
}
export type JsDisplayManager = DisplayManager
export class DisplayManager {
export declare class DisplayManager {
constructor(queries?: Query | Array<Query> | undefined | null)
static getByIndex(index: number): Display
get queries(): Array<Query>
Expand All @@ -69,8 +65,8 @@ export class DisplayManager {
collect(): Promise<Array<Display>>
list(): Promise<Array<Display>>
}
export namespace VCPFeatureCode {
export const enum PresetFunctions {
export declare namespace VCPFeatureCode {
export enum PresetFunctions {
CodePage = 0,
RestoreFactoryColorDefaults = 8,
RestoreFactoryDefaults = 4,
Expand All @@ -79,7 +75,7 @@ export namespace VCPFeatureCode {
RestoreFactoryTvDefaults = 10,
SaveRestoreSettings = 176,
}
export const enum ImageAdjustment {
export enum ImageAdjustment {
SixAxisHueControlBlue = 159,
SixAxisHueControlCyan = 158,
SixAxisHueControlGreen = 157,
Expand Down Expand Up @@ -140,7 +136,7 @@ export namespace VCPFeatureCode {
WindowSize = 166,
WindowTransparency = 167,
}
export const enum DisplayControl {
export enum DisplayControl {
DisplayControllerId = 200,
DisplayFirmwareLevel = 201,
DisplayUsageTime = 198,
Expand All @@ -154,7 +150,7 @@ export namespace VCPFeatureCode {
Version = 223,
VerticalFrequency = 174,
}
export const enum Geometry {
export enum Geometry {
BottomCornerFlare = 74,
BottomCornerHook = 76,
DisplayScaling = 134,
Expand Down Expand Up @@ -189,7 +185,7 @@ export namespace VCPFeatureCode {
WindowPositionTlX = 149,
WindowPositionTlY = 150,
}
export const enum Miscellaneous {
export enum Miscellaneous {
ActiveControl = 82,
AmbientLightSensor = 102,
ApplicationEnableKey = 198,
Expand All @@ -214,7 +210,7 @@ export namespace VCPFeatureCode {
TransmitDisplayDescriptor = 195,
TvChannelUpDown = 139,
}
export const enum Audio {
export enum Audio {
BalanceLR = 147,
Bass = 145,
JackConnectionStatus = 101,
Expand All @@ -225,7 +221,7 @@ export namespace VCPFeatureCode {
SpeakerVolume = 98,
Treble = 143,
}
export const enum Dpvl {
export enum Dpvl {
BodyCrcErrorCount = 188,
ClientId = 189,
HeaderErrorCount = 187,
Expand Down
56 changes: 53 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,62 @@ switch (platform) {
}
break
case 'arm':
localFileExisted = existsSync(join(__dirname, 'ddc-node.linux-arm-gnueabihf.node'))
if (isMusl()) {
localFileExisted = existsSync(join(__dirname, 'ddc-node.linux-arm-musleabihf.node'))
try {
if (localFileExisted) {
nativeBinding = require('./ddc-node.linux-arm-musleabihf.node')
} else {
nativeBinding = require('@ddc-node/ddc-node-linux-arm-musleabihf')
}
} catch (e) {
loadError = e
}
} else {
localFileExisted = existsSync(join(__dirname, 'ddc-node.linux-arm-gnueabihf.node'))
try {
if (localFileExisted) {
nativeBinding = require('./ddc-node.linux-arm-gnueabihf.node')
} else {
nativeBinding = require('@ddc-node/ddc-node-linux-arm-gnueabihf')
}
} catch (e) {
loadError = e
}
}
break
case 'riscv64':
if (isMusl()) {
localFileExisted = existsSync(join(__dirname, 'ddc-node.linux-riscv64-musl.node'))
try {
if (localFileExisted) {
nativeBinding = require('./ddc-node.linux-riscv64-musl.node')
} else {
nativeBinding = require('@ddc-node/ddc-node-linux-riscv64-musl')
}
} catch (e) {
loadError = e
}
} else {
localFileExisted = existsSync(join(__dirname, 'ddc-node.linux-riscv64-gnu.node'))
try {
if (localFileExisted) {
nativeBinding = require('./ddc-node.linux-riscv64-gnu.node')
} else {
nativeBinding = require('@ddc-node/ddc-node-linux-riscv64-gnu')
}
} catch (e) {
loadError = e
}
}
break
case 's390x':
localFileExisted = existsSync(join(__dirname, 'ddc-node.linux-s390x-gnu.node'))
try {
if (localFileExisted) {
nativeBinding = require('./ddc-node.linux-arm-gnueabihf.node')
nativeBinding = require('./ddc-node.linux-s390x-gnu.node')
} else {
nativeBinding = require('@ddc-node/ddc-node-linux-arm-gnueabihf')
nativeBinding = require('@ddc-node/ddc-node-linux-s390x-gnu')
}
} catch (e) {
loadError = e
Expand Down
2 changes: 1 addition & 1 deletion npm/darwin-arm64/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@
"access": "public"
},
"repository": "[email protected]:ThalusA/ddc-node.git"
}
}
2 changes: 1 addition & 1 deletion npm/darwin-x64/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@
"access": "public"
},
"repository": "[email protected]:ThalusA/ddc-node.git"
}
}
2 changes: 1 addition & 1 deletion npm/linux-arm64-gnu/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@
"access": "public"
},
"repository": "[email protected]:ThalusA/ddc-node.git"
}
}
2 changes: 1 addition & 1 deletion npm/linux-x64-gnu/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@
"access": "public"
},
"repository": "[email protected]:ThalusA/ddc-node.git"
}
}
2 changes: 1 addition & 1 deletion npm/win32-arm64-msvc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@
"access": "public"
},
"repository": "[email protected]:ThalusA/ddc-node.git"
}
}
2 changes: 1 addition & 1 deletion npm/win32-x64-msvc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@
"access": "public"
},
"repository": "[email protected]:ThalusA/ddc-node.git"
}
}
Loading