Skip to content

Commit

Permalink
ESling and prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
pierr3 committed May 1, 2024
1 parent 4a9f328 commit 01ea49a
Show file tree
Hide file tree
Showing 41 changed files with 2,705 additions and 2,081 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
backend/*
17 changes: 17 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* eslint-env node */

module.exports = {
env: { browser: true, es6: true, node: true },
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/strict-type-checked",
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
project: true,
tsconfigRootDir: __dirname,
},
ignorePatterns: ["webpack.*.ts", "forge.config.ts", ".eslintrc.cjs", "out/**", "backend/**"],
};
16 changes: 0 additions & 16 deletions .eslintrc.json

This file was deleted.

25 changes: 13 additions & 12 deletions backend/js/bindings.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
exports.TrackAudioAfv = require("bindings")("trackaudio-afv");
exports.AFVEventTypes = {
Error: "error",
VoiceConnected: "VoiceConnected",
VoiceDisconnected: "VoiceDisconnected",
StationTransceiversUpdated: "StationTransceiversUpdated",
StationDataReceived: "StationDataReceived",
FrequencyRxBegin: "FrequencyRxBegin",
FrequencyRxEnd: "FrequencyRxEnd",
PttState: "PttState",
NetworkConnected: "network-connected",
NetworkDisconnected: "network-disconnected",
};
exports.AfvEventTypes = {
Error: "error",
VoiceConnected: "VoiceConnected",
VoiceDisconnected: "VoiceDisconnected",
StationTransceiversUpdated: "StationTransceiversUpdated",
StationDataReceived: "StationDataReceived",
FrequencyRxBegin: "FrequencyRxBegin",
FrequencyRxEnd: "FrequencyRxEnd",
StationRxBegin: "StationRxBegin",
PttState: "PttState",
NetworkConnected: "network-connected",
NetworkDisconnected: "network-disconnected",
};
2 changes: 1 addition & 1 deletion backend/package-lock.json

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

2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@
"author": "Pierre Ferran",
"license": "GPL-3.0-only",
"engines": {
"node": ">=18.0.0 <19.0.0"
"node": ">=20.0.0 <=21.0.0"
}
}
144 changes: 75 additions & 69 deletions backend/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

export declare interface AudioApi {
id: number;
name: string;
Expand All @@ -10,74 +9,81 @@ export declare interface AudioDevice {
isDefault: boolean;
}

export enum AFVEventTypes {
Error = "error",
VoiceConnected = "VoiceConnected",
VoiceDisconnected = "VoiceDisconnected",
StationTransceiversUpdated = "StationTransceiversUpdated",
StationDataReceived = "StationDataReceived",
FrequencyRxBegin = "FrequencyRxBegin",
FrequencyRxEnd = "FrequencyRxEnd",
StationRxBegin = "StationRxBegin",
PttState = "PttState",
NetworkConnected = "network-connected",
NetworkDisconnected = "network-disconnected",
}
export declare const AfvEventTypes: {
Error: string;
VoiceConnected: string;
VoiceDisconnected: string;
StationTransceiversUpdated: string;
StationDataReceived: string;
FrequencyRxBegin: string;
FrequencyRxEnd: string;
StationRxBegin: string;
PttState: string;
NetworkConnected: string;
NetworkDisconnected: string;
};

declare namespace TrackAudioAfv {
export function GetVersion(): string;
export function GetAudioApis(): Array<AudioApi>;

export function GetAudioOutputDevices(apiId: string): Promise<Array<AudioDevice>>;
export function GetAudioInputDevices(apiId: string): Promise<Array<AudioDevice>>;

export function Connect(password: string): Promise<boolean>;
export function Disconnect(): void;
export function SetAudioSettings(
apiId: number,
inputDevice: string,
headsetDevice: string,
speakerDevice: string
): void;

export function AddFrequency(frequency: number, callign: string): Promise<boolean>;
export function RemoveFrequency(frequency: number): void;
export function IsFrequencyActive(frequency: number): boolean;

export function GetStation(callsign: string): Promise<void>;
export function RefreshStation(callsign: string): Promise<void>;

export function SetFrequencyState(
frequency: number,
rx: boolean,
tx: boolean,
xc: boolean,
onSpeaker: boolean,
crossCoupleAcross: boolean
): Promise<boolean>;

export function GetFrequencyState(frequency: number): Promise<{
rx: boolean;
tx: boolean;
xc: boolean;
onSpeaker: boolean;
}>;

export function SetCid(cid: string): void;

export function SetRadioGain(gain: number): void;
export function SetPtt(activate: boolean): void;

export function SetHardwareType(type: number): void;

export function StartMicTest(): void;
export function StopMicTest(): void;

export function RegisterCallback(
func: (arg: string, arg2: string, arg3: string) => void
): void;

export function IsConnected(): boolean;
export function Bootstrap(resourcePath: string): Promise<boolean>;
export function Exit(): void;
export function GetVersion(): string;
export function GetAudioApis(): Array<AudioApi>;

export function GetAudioOutputDevices(
apiId: string
): Promise<Array<AudioDevice>>;
export function GetAudioInputDevices(
apiId: string
): Promise<Array<AudioDevice>>;

export function Connect(password: string): Promise<boolean>;
export function Disconnect(): void;
export function SetAudioSettings(
apiId: number,
inputDevice: string,
headsetDevice: string,
speakerDevice: string
): void;

export function AddFrequency(
frequency: number,
callign: string
): Promise<boolean>;
export function RemoveFrequency(frequency: number): void;
export function IsFrequencyActive(frequency: number): boolean;

export function GetStation(callsign: string): Promise<void>;
export function RefreshStation(callsign: string): Promise<void>;

export function SetFrequencyState(
frequency: number,
rx: boolean,
tx: boolean,
xc: boolean,
onSpeaker: boolean,
crossCoupleAcross: boolean
): Promise<boolean>;

export function GetFrequencyState(frequency: number): Promise<{
rx: boolean;
tx: boolean;
xc: boolean;
onSpeaker: boolean;
}>;

export function SetCid(cid: string): void;

export function SetRadioGain(gain: number): void;
export function SetPtt(activate: boolean): void;

export function SetHardwareType(type: number): void;

export function StartMicTest(): void;
export function StopMicTest(): void;

export function RegisterCallback(
func: (arg: string, arg2: string, arg3: string) => void
): void;

export function IsConnected(): boolean;
export function Bootstrap(resourcePath: string): Promise<boolean>;
export function Exit(): void;
}
Loading

0 comments on commit 01ea49a

Please sign in to comment.