forked from phpvms/acars-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_default_xplane.ts
101 lines (93 loc) · 2.54 KB
/
_default_xplane.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import { AircraftConfigSimType, AircraftFeature, FeatureType } from '../defs'
import {
AircraftConfig,
FeatureAddresses,
FeatureState,
Meta,
} from '../interface/aircraft'
import GetDefaultFlaps from './_default_flaps'
/**
* The default configmap
*/
export default class DefaultXPlane extends AircraftConfig {
meta: Meta = {
id: 'xplane_default',
name: 'xplane default',
sim: AircraftConfigSimType.XPlane,
enabled: true,
priority: 1,
}
features: FeatureAddresses = {
[AircraftFeature.BeaconLights]: {
'sim/cockpit2/switches/beacon_on': FeatureType.Int,
},
[AircraftFeature.LandingLights]: {
'sim/cockpit2/switches/landing_lights_on': FeatureType.Int,
},
[AircraftFeature.NavigationLights]: {
'sim/cockpit2/switches/navigation_lights_on': FeatureType.Int,
},
[AircraftFeature.StrobeLights]: {
'sim/cockpit2/switches/strobe_lights_on': FeatureType.Int,
},
[AircraftFeature.TaxiLights]: {
'sim/cockpit2/switches/taxi_light_on': FeatureType.Int,
},
}
/**
* See if the title, icao or config_path match with what the simulator
* is saying. All of the values are passed in already lower-cased.
* Return true or false
*
* The ICAO and config_path may not be available in some sims.
*
* @param {string} title The title of the aircraft
* @param {string=} icao The ICAO of the aircraft. Might not be available
* @param {string=} config_path Path to the aircraft config. Might not be there
* @return {boolean}
*/
match(title: string, icao: string, config_path: string): boolean {
this.flapNames = GetDefaultFlaps(title, icao, config_path)
return true
}
/**
* Parse the value that's returned by the sim
* @param value
* @return {boolean|null}
*/
beaconLights(value: number): FeatureState {
return value === 1
}
/**
* Parse the value that's returned by the sim
* @param value
* @return {boolean|null}
*/
landingLights(value: number): FeatureState {
return value === 1
}
/**
* Parse the value that's returned by the sim
* @param value
* @return {boolean|null}
*/
navigationLights(value: number): FeatureState {
return value === 1
}
/**
* Parse the value that's returned by the sim
* @param value
* @return {boolean|null}
*/
strobeLights(value: number): FeatureState {
return value === 1
}
/**
* Parse the value that's returned by the sim
* @param value
* @return {boolean|null}
*/
taxiLights(value: number): FeatureState {
return value === 1
}
}