| 1 |
#--------------------------------------------------------------------------- |
| 2 |
# |
| 3 |
# Title : EMESARY flightgear standardised notifications |
| 4 |
# |
| 5 |
# File Type : Implementation File |
| 6 |
# |
| 7 |
# Description : Messages that are applicable across all models and do not specifically relate to a single system |
| 8 |
# : - mostly needed when using the mutiplayer bridge |
| 9 |
# |
| 10 |
# Author : Richard Harrison ([email protected]) |
| 11 |
# |
| 12 |
# Creation Date : 06 April 2016 |
| 13 |
# |
| 14 |
# Version : 4.8 |
| 15 |
# |
| 16 |
# Copyright � 2016 Richard Harrison Released under GPL V2 |
| 17 |
# |
| 18 |
#---------------------------------------------------------------------------*/ |
| 19 |
|
| 20 |
# |
| 21 |
# Ideally for notifications bridged over MP the message ID should be system unique. |
| 22 |
# with that in mind 0-16 are reserved for model use; and may well be marked as not bridgeable |
| 23 |
# however the most important thing is that as these notifications ID's are used the |
| 24 |
# wiki page http://wiki.flightgear.org/Emesary_Notifications |
| 25 |
var PropertySyncNotificationBase_Id = 16; |
| 26 |
var AircraftControlNotification_Id = 17; |
| 27 |
var GeoEventNotification_Id = 18; |
| 28 |
var ArmamentNotification_Id = 19; |
| 29 |
# event ID 19 reserved for armaments and stores (model defined). |
| 30 |
var PFDEventNotification_Id = 20; |
| 31 |
# |
| 32 |
# Combat notifications; e.g. OPRF Emesary MP communications |
| 33 |
var ArmamentInFlightNotification_Id = 21; |
| 34 |
var StaticNotification_Id = 25; # static object created. |
| 35 |
|
| 36 |
# |
| 37 |
# PropertySyncNotificationBase is a wrapper class for allow properties to be synchronized between |
| 38 |
# modules. This can replace (or augment) the properties that are normally transmitted by multiplayer |
| 39 |
# It is reasonably efficient with the MP2017.2 |
| 40 |
# |
| 41 |
# Usage example - this can all go into one Nasal module somewhere. |
| 42 |
#----------- |
| 43 |
# var PropertySyncNotification = |
| 44 |
# { |
| 45 |
# new: func(_ident="none", _name="", _kind=0, _secondary_kind=0) |
| 46 |
# { |
| 47 |
# var new_class = PropertySyncNotificationBase.new(_ident, _name, _kind, _secondary_kind); |
| 48 |
# |
| 49 |
# new_class.addIntProperty("consumables/fuel/total-fuel-lbs", 1); |
| 50 |
# new_class.addIntProperty("controls/fuel/dump-valve", 1); |
| 51 |
# new_class.addIntProperty("engines/engine[0]/augmentation-burner", 1); |
| 52 |
# new_class.addIntProperty("engines/engine[0]/n1", 1); |
| 53 |
# new_class.addIntProperty("engines/engine[0]/n2", 1); |
| 54 |
# new_class.addNormProperty("surface-positions/wing-pos-norm", 2); |
| 55 |
# return new_class; |
| 56 |
# } |
| 57 |
#}; |
| 58 |
# |
| 59 |
#var routedNotifications = [notifications.PropertySyncNotification.new(nil), notifications.GeoEventNotification.new(nil)]; |
| 60 |
# |
| 61 |
#var bridgedTransmitter = emesary.Transmitter.new("outgoingBridge"); |
| 62 |
#var outgoingBridge = emesary_mp_bridge.OutgoingMPBridge.new("F-14mp",routedNotifications, 19, "", bridgedTransmitter); |
| 63 |
#var incomingBridge = emesary_mp_bridge.IncomingMPBridge.startMPBridge(routedNotifications); |
| 64 |
#var f14_aircraft_notification = notifications.PropertySyncNotification.new("F-14"~getprop("/sim/multiplay/callsign")); |
| 65 |
#----------- |
| 66 |
# |
| 67 |
# That's all that is required to ship properties between multiplayer modules via emesary. |
| 68 |
# property /sim/multiplay/transmit-filter-property-base can be set to 1 to turn off all of the standard properties and only send generics. |
| 69 |
# this will give a packet size of 280 bytes; leaving lots of space for notifications. |
| 70 |
# The F-14 packet size is around 53 bytes on 2017.2 compared to over 1100 bytes with the traditional method. |
| 71 |
# property /sim/multiplay/transmit-filter-property-base can be set to a number greater than 1 (e.g. 12000) to only transmit properties |
| 72 |
# where the ID is greater than the value in the property. This can further reduce packet size by only transmitting the emesary bridge data |
| 73 |
# |
| 74 |
# The other advantage with this method of transferring data is that the model is in full control of what is |
| 75 |
# sent, and also when it is sent. This works on a per notification basis so less important properties could be |
| 76 |
# transmitted on a less frequent schedule; however this will require an instance of the notification for each one. |
| 77 |
# |
| 78 |
# PropertySyncNotificationBase is a shortcut notification; as it doesn't need to received and all |
| 79 |
# of the properties are simply set when the notification is unpacked over MP. |
| 80 |
# So although the notification will be transmitted |
| 81 |
var PropertySyncNotificationBase = |
| 82 |
{ |
| 83 |
new: func(_ident="none", _name="", _kind=0, _secondary_kind=0) |
| 84 |
{ |
| 85 |
var new_class = emesary.Notification.new("PropertySyncNotification", _ident, PropertySyncNotificationBase_Id); |
| 86 |
|
| 87 |
new_class.IsDistinct = 1; |
| 88 |
new_class.Kind = _kind; |
| 89 |
new_class.Name = _name; |
| 90 |
new_class.SecondaryKind = _secondary_kind; |
| 91 |
new_class.Callsign = nil; # populated automatically by the incoming bridge when routed |
| 92 |
new_class._bridgeProperties = []; |
| 93 |
|
| 94 |
new_class.addIntProperty = func(variable, property, length) |
| 95 |
{ |
| 96 |
me[variable] = nil; |
| 97 |
append(me._bridgeProperties, |
| 98 |
{ |
| 99 |
getValue:func{return emesary.TransferInt.encode(getprop(property) or 0,length);}, |
| 100 |
setValue:func(v,bridge,pos){var dv=emesary.TransferInt.decode(v,length,pos);me[variable]=dv.value;setprop(bridge.PropertyRoot~property, me[variable]);return dv;}, |
| 101 |
}); |
| 102 |
} |
| 103 |
new_class.addNormProperty = func(variable, property, length) |
| 104 |
{ |
| 105 |
me[variable] = nil; |
| 106 |
append(me._bridgeProperties, |
| 107 |
{ |
| 108 |
getValue:func{return emesary.TransferNorm.encode(getprop(property) or 0,length);}, |
| 109 |
setValue:func(v,bridge,pos){var dv=emesary.TransferNorm.decode(v,length,pos);me[variable] = dv.value;setprop(bridge.PropertyRoot~property, me[variable]);return dv;}, |
| 110 |
}); |
| 111 |
} |
| 112 |
|
| 113 |
new_class.addStringProperty = func(variable, property) |
| 114 |
{ |
| 115 |
me[variable] = nil; |
| 116 |
append(me._bridgeProperties, |
| 117 |
{ |
| 118 |
getValue:func{return emesary.TransferString.encode(getprop(property) or 0);}, |
| 119 |
setValue:func(v,bridge,pos){var dv=emesary.TransferString.decode(v,pos);me[variable] = dv.value;setprop(bridge.PropertyRoot~property, me[variable]);return dv;}, |
| 120 |
}); |
| 121 |
|
| 122 |
} |
| 123 |
new_class.bridgeProperties = func() |
| 124 |
{ |
| 125 |
return me._bridgeProperties; |
| 126 |
} |
| 127 |
return new_class; |
| 128 |
} |
| 129 |
}; |
| 130 |
# |
| 131 |
# Transmit a generic control event. |
| 132 |
# two parameters - the event Id and the event value which is a 4 byte length (+/- 1,891371.000) |
| 133 |
var AircraftControlNotification = |
| 134 |
{ |
| 135 |
new: func(_ident="none") |
| 136 |
{ |
| 137 |
var new_class = emesary.Notification.new("AircraftControlNotification", _ident, AircraftControlNotification_Id); |
| 138 |
|
| 139 |
new_class.IsDistinct = 0; |
| 140 |
new_class.EventType = 0; |
| 141 |
new_class.EventValue = 0; |
| 142 |
new_class.Callsign = nil; # populated automatically by the incoming bridge when routed |
| 143 |
|
| 144 |
new_class.bridgeProperties = func |
| 145 |
{ |
| 146 |
return |
| 147 |
[ |
| 148 |
{ |
| 149 |
getValue:func{return emesary.TransferInt.encode(new_class.EventType,2);}, |
| 150 |
setValue:func(v,bridge,pos){var dv=emesary.TransferInt.decode(v,2,pos);new_class.EventType=dv.value;return dv;}, |
| 151 |
}, |
| 152 |
{ |
| 153 |
getValue:func{return emesary.TransferFixedDouble.encode(new_class.EventValue,4,1000);}, |
| 154 |
setValue:func(v,bridge,pos){var dv=emesary.TransferFixedDouble.decode(v,4,1000,pos);new_class.EventValue=dv.value;print("dec ",dv.value);return dv;}, |
| 155 |
}, |
| 156 |
]; |
| 157 |
}; |
| 158 |
return new_class; |
| 159 |
} |
| 160 |
}; |
| 161 |
|
| 162 |
# |
| 163 |
# |
| 164 |
# Use to transmit events that happen at a specific place; can be used to make |
| 165 |
# models that are simulated locally (e.g. tankers) appear on other player's MP sessions. |
| 166 |
var GeoEventNotification = |
| 167 |
{ |
| 168 |
# new: |
| 169 |
# _ident - the identifier for the notification. not bridged. |
| 170 |
# _name - name of the notification, bridged. |
| 171 |
# _kind - created, moved, deleted (see below). This is the activity that the notification represents, called kind to avoid confusion with notification type. |
| 172 |
# _secondary_kind - This is the entity on which the activity is being performed. See below for predefined types. |
| 173 |
## |
| 174 |
new: func(_ident="none", _name="", _kind=0, _secondary_kind=0) |
| 175 |
{ |
| 176 |
var new_class = emesary.Notification.new("GeoEventNotification", _ident, GeoEventNotification_Id); |
| 177 |
|
| 178 |
new_class.Kind = _kind; |
| 179 |
new_class.Name = _name; |
| 180 |
new_class.SecondaryKind = _secondary_kind; |
| 181 |
new_class.Position = geo.aircraft_position(); |
| 182 |
new_class.UniqueIndex = 0; |
| 183 |
|
| 184 |
new_class.Heading = getprop("/orientation/heading"); |
| 185 |
new_class.u_fps = getprop("/velocities/uBody-fps"); |
| 186 |
new_class.v_fps = getprop("/velocities/vBody-fps"); |
| 187 |
new_class.w_fps = getprop("/velocities/wBody-fps"); |
| 188 |
new_class.IsDistinct = 0; |
| 189 |
new_class.Callsign = nil; # populated automatically by the incoming bridge when routed |
| 190 |
new_class.RemoteCallsign = ""; # associated remote callsign. |
| 191 |
new_class.Flags = 0; # 8 bits for whatever. |
| 192 |
|
| 193 |
new_class.GetBridgeMessageNotificationTypeKey = func { |
| 194 |
return new_class.NotificationType~"."~new_class.Ident~"."~new_class.UniqueIndex; |
| 195 |
}; |
| 196 |
new_class.bridgeProperties = func |
| 197 |
{ |
| 198 |
return |
| 199 |
[ |
| 200 |
{ |
| 201 |
getValue:func{return emesary.TransferCoord.encode(new_class.Position);}, |
| 202 |
setValue:func(v,root,pos){var dv=emesary.TransferCoord.decode(v, pos);new_class.Position=dv.value;return dv}, |
| 203 |
}, |
| 204 |
{ |
| 205 |
getValue:func{return emesary.TransferString.encode(new_class.Name);}, |
| 206 |
setValue:func(v,root,pos){var dv=emesary.TransferString.decode(v,pos);new_class.Name=dv.value;return dv}, |
| 207 |
}, |
| 208 |
{ |
| 209 |
getValue:func{return emesary.TransferByte.encode(new_class.Kind);}, |
| 210 |
setValue:func(v,root,pos){var dv=emesary.TransferByte.decode(v,pos);new_class.Kind=dv.value;return dv}, |
| 211 |
}, |
| 212 |
{ |
| 213 |
getValue:func{return emesary.TransferByte.encode(new_class.SecondaryKind);}, |
| 214 |
setValue:func(v,root,pos){var dv=emesary.TransferByte.decode(v,pos);new_class.SecondaryKind=dv.value;return dv}, |
| 215 |
}, |
| 216 |
{ |
| 217 |
getValue:func{return emesary.TransferFixedDouble.encode(new_class.u_fps,2,10);}, |
| 218 |
setValue:func(v,root,pos){var dv=emesary.TransferFixedDouble.decode(v,2,10,pos);new_class.u_fps=dv.value;return dv}, |
| 219 |
}, |
| 220 |
{ |
| 221 |
getValue:func{return emesary.TransferFixedDouble.encode(new_class.v_fps,2,10);}, |
| 222 |
setValue:func(v,root,pos){var dv=emesary.TransferFixedDouble.decode(v,2,10,pos);new_class.v_fps=dv.value;return dv}, |
| 223 |
}, |
| 224 |
{ |
| 225 |
getValue:func{return emesary.TransferFixedDouble.encode(new_class.w_fps,2,10);}, |
| 226 |
setValue:func(v,root,pos){var dv=emesary.TransferFixedDouble.decode(v,2,10,pos);new_class.w_fps=dv.value;return dv}, |
| 227 |
}, |
| 228 |
{ |
| 229 |
getValue:func{return emesary.TransferString.encode(new_class.RemoteCallsign);}, |
| 230 |
setValue:func(v,root,pos){var dv=emesary.TransferString.decode(v,pos);new_class.RemoteCallsign=dv.value;return dv}, |
| 231 |
}, |
| 232 |
{ |
| 233 |
getValue:func{return emesary.TransferByte.encode(new_class.Flags);}, |
| 234 |
setValue:func(v,root,pos){var dv=emesary.TransferByte.decode(v,pos);new_class.Flags=dv.value;return dv}, |
| 235 |
}, |
| 236 |
]; |
| 237 |
}; |
| 238 |
return new_class; |
| 239 |
}, |
| 240 |
}; |
| 241 |
# |
| 242 |
# Defined kinds: |
| 243 |
# 1 - Created |
| 244 |
# 2 - Moved |
| 245 |
# 3 - Deleted |
| 246 |
# 4 - Collision |
| 247 |
# ---- |
| 248 |
# Secondary kind (8 bits) |
| 249 |
# using the first 4 bits as the classification and the second 4 bits as the sub-classification |
| 250 |
#----------- |
| 251 |
# Type 0000 : Cargo |
| 252 |
# 0 0000 0000 - Vehicle |
| 253 |
# 1 0000 0001 - Person |
| 254 |
# 2 0000 0010 - 10 kg Item |
| 255 |
# 3 0000 0011 - 20 kg Item |
| 256 |
# 4 0000 0100 - 30 kg Item |
| 257 |
# 5 0000 0101 - 40 kg Item |
| 258 |
# 6 0000 0110 - 50 kg Item |
| 259 |
# 7 0000 0111 - 100 kg Item |
| 260 |
# 8 0000 1000 - 200 kg Item |
| 261 |
# 9 0000 1001 - 500 kg Item |
| 262 |
# 10 0000 1010 - 1000 kg Item |
| 263 |
# 11 0000 1011 - Chaff |
| 264 |
# 12 0000 1100 - Flares |
| 265 |
# 13 0000 1101 - Water (fire fighting) |
| 266 |
# 14 0000 1110 - |
| 267 |
# 15 0000 1111 - Morris Marina |
| 268 |
#-------- |
| 269 |
# Type 0001 : Self propelled |
| 270 |
# 16 0001 0000 - X-2 |
| 271 |
# 17 0001 0001 - X-15 |
| 272 |
# 18 0001 0010 - X-24 |
| 273 |
# 19 0001 0011 - |
| 274 |
# 20 0001 0100 - |
| 275 |
# 21 0001 0101 - |
| 276 |
# 22 0001 0110 - |
| 277 |
# 23 0001 0111 - |
| 278 |
# 24 0001 1000 - |
| 279 |
# 25 0001 1001 - |
| 280 |
# 26 0001 1010 - |
| 281 |
# 27 0001 1011 - |
| 282 |
# 28 0001 1100 - |
| 283 |
# 29 0001 1101 - |
| 284 |
# 30 0001 1110 - |
| 285 |
# 31 0001 1111 - |
| 286 |
#-------- |
| 287 |
# Type 0010 : Aircraft Damage (e.g space shuttle re-entry or during launch) |
| 288 |
# 32 0010 0000 - Engine 1 |
| 289 |
# 33 0010 0001 - Engine 2 |
| 290 |
# 34 0010 0010 - Engine 3 |
| 291 |
# 35 0010 0011 - Engine 4 |
| 292 |
# 36 0010 0100 - Engine 5 |
| 293 |
# 37 0010 0101 - Engine 6 |
| 294 |
# 38 0010 0110 - Engine 7 |
| 295 |
# 39 0010 0111 - Engine 8 |
| 296 |
# 40 0010 1000 - Vertical Tail Right |
| 297 |
# 41 0010 1001 - Left Wing |
| 298 |
# 42 0010 1010 - Right Wing |
| 299 |
# 43 0010 1011 - Horizontal Tail Left |
| 300 |
# 44 0010 1100 - Horizontal Tail Right |
| 301 |
# 45 0010 1101 - Fuselage Front |
| 302 |
# 46 0010 1110 - Fuselage Center |
| 303 |
# 47 0010 1111 - Fuselage Back |
| 304 |
#-------- |
| 305 |
# Type 0011 : External stores |
| 306 |
# 48 0011 0000 - Drop Tank 1 |
| 307 |
# 49 0011 0001 - Drop Tank 2 |
| 308 |
# 50 0011 0010 - Drop Tank 3 |
| 309 |
# 51 0011 0011 - Drop Tank 4 |
| 310 |
# 52 0011 0100 - |
| 311 |
# 53 0011 0101 - |
| 312 |
# 54 0011 0110 - |
| 313 |
# 55 0011 0111 - |
| 314 |
# 56 0011 1000 - |
| 315 |
# 57 0011 1001 - |
| 316 |
# 58 0011 1010 - |
| 317 |
# 59 0011 1011 - |
| 318 |
# 60 0011 1100 - |
| 319 |
# 61 0011 1101 - |
| 320 |
# 62 0011 1110 - |
| 321 |
# 63 0011 1111 - |
| 322 |
#-------- |
| 323 |
# Type 0100 : |
| 324 |
# 64 0100 0000 - |
| 325 |
# 65 0100 0001 - |
| 326 |
# 66 0100 0010 - |
| 327 |
# 67 0100 0011 - |
| 328 |
# 68 0100 0100 - |
| 329 |
# 69 0100 0101 - |
| 330 |
# 70 0100 0110 - |
| 331 |
# 71 0100 0111 - |
| 332 |
# 72 0100 1000 - |
| 333 |
# 73 0100 1001 - |
| 334 |
# 74 0100 1010 - |
| 335 |
# 75 0100 1011 - |
| 336 |
# 76 0100 1100 - |
| 337 |
# 77 0100 1101 - |
| 338 |
# 78 0100 1110 - |
| 339 |
# 79 0100 1111 - |
| 340 |
#-------- |
| 341 |
# Type 0101 : Models/Geometry items |
| 342 |
# 80 0101 0000 - Aim91x.ac |
| 343 |
# 81 0101 0001 - Bomb-500lbs-MC/bomb-500lbs-mc.ac |
| 344 |
# 82 0101 0010 - Clemenceau/tracteur.ac |
| 345 |
# 83 0101 0011 - Crater/crater.ac |
| 346 |
# 84 0101 0100 - Ensign.ac |
| 347 |
# 85 0101 0101 - Nimitz/Models/phalanx.ac |
| 348 |
# 86 0101 0110 - Nimitz/Models/phalanx.xml |
| 349 |
# 87 0101 0111 - Nimitz/Models/sea-sparrow.ac |
| 350 |
# 88 0101 1000 - Nimitz/Models/sea-sparrow.xml |
| 351 |
# 89 0101 1001 - RP-3/RP-3.ac |
| 352 |
# 90 0101 1010 - RP-3/crater.ac |
| 353 |
# 91 0101 1011 - container_carrier.ac |
| 354 |
# 92 0101 1100 - droptank_300_gal.ac |
| 355 |
# 93 0101 1101 - flare.ac |
| 356 |
# 94 0101 1110 - load.ac |
| 357 |
# 95 0101 1111 - mk82.ac |
| 358 |
#-------- |
| 359 |
# Type 0110 : Models/Geometry items |
| 360 |
# 96 0110 0000 - puff.ac |
| 361 |
# 97 0110 0001 - rocket.ac |
| 362 |
# 98 0110 0010 - tracer.ac |
| 363 |
# 99 0110 0011 - tracer2.ac |
| 364 |
# 100 0110 0100 - |
| 365 |
# 101 0110 0101 - |
| 366 |
# 102 0110 0110 - |
| 367 |
# 103 0110 0111 - |
| 368 |
# 104 0110 1000 - |
| 369 |
# 105 0110 1001 - |
| 370 |
# 106 0110 1010 - |
| 371 |
# 107 0110 1011 - |
| 372 |
# 108 0110 1100 - |
| 373 |
# 109 0110 1101 - |
| 374 |
# 110 0110 1110 - |
| 375 |
# 111 0110 1111 - |
| 376 |
#-------- |
| 377 |
# Type 0111 : Models/Geometry items |
| 378 |
# 112 0111 0000 - |
| 379 |
# 113 0111 0001 - |
| 380 |
# 114 0111 0010 - |
| 381 |
# 115 0111 0011 - |
| 382 |
# 116 0111 0100 - |
| 383 |
# 117 0111 0101 - |
| 384 |
# 118 0111 0110 - |
| 385 |
# 119 0111 0111 - |
| 386 |
# 120 0111 1000 - |
| 387 |
# 121 0111 1001 - |
| 388 |
# 122 0111 1010 - |
| 389 |
# 123 0111 1011 - |
| 390 |
# 124 0111 1100 - |
| 391 |
# 125 0111 1101 - |
| 392 |
# 126 0111 1110 - |
| 393 |
# 127 0111 1111 - |
| 394 |
#-------- |
| 395 |
# Type 1000 : Models/Geometry items |
| 396 |
# 128 1000 0000 - |
| 397 |
# 129 1000 0001 - |
| 398 |
# 130 1000 0010 - |
| 399 |
# 131 1000 0011 - |
| 400 |
# 132 1000 0100 - |
| 401 |
# 133 1000 0101 - |
| 402 |
# 134 1000 0110 - |
| 403 |
# 135 1000 0111 - |
| 404 |
# 136 1000 1000 - |
| 405 |
# 137 1000 1001 - |
| 406 |
# 138 1000 1010 - |
| 407 |
# 139 1000 1011 - |
| 408 |
# 140 1000 1100 - |
| 409 |
# 141 1000 1101 - |
| 410 |
# 142 1000 1110 - |
| 411 |
# 143 1000 1111 - |
| 412 |
#-------- |
| 413 |
# Type 1001 : |
| 414 |
# 144 1001 0000 - |
| 415 |
# 145 1001 0001 - |
| 416 |
# 146 1001 0010 - |
| 417 |
# 147 1001 0011 - |
| 418 |
# 148 1001 0100 - |
| 419 |
# 149 1001 0101 - |
| 420 |
# 150 1001 0110 - |
| 421 |
# 151 1001 0111 - |
| 422 |
# 152 1001 1000 - |
| 423 |
# 153 1001 1001 - |
| 424 |
# 154 1001 1010 - |
| 425 |
# 155 1001 1011 - |
| 426 |
# 156 1001 1100 - |
| 427 |
# 157 1001 1101 - |
| 428 |
# 158 1001 1110 - |
| 429 |
# 159 1001 1111 - |
| 430 |
#-------- |
| 431 |
# Type 1010 : |
| 432 |
# 160 1010 0000 - |
| 433 |
# 161 1010 0001 - |
| 434 |
# 162 1010 0010 - |
| 435 |
# 163 1010 0011 - |
| 436 |
# 164 1010 0100 - |
| 437 |
# 165 1010 0101 - |
| 438 |
# 166 1010 0110 - |
| 439 |
# 167 1010 0111 - |
| 440 |
# 168 1010 1000 - |
| 441 |
# 169 1010 1001 - |
| 442 |
# 170 1010 1010 - |
| 443 |
# 171 1010 1011 - |
| 444 |
# 172 1010 1100 - |
| 445 |
# 173 1010 1101 - |
| 446 |
# 174 1010 1110 - |
| 447 |
# 175 1010 1111 - |
| 448 |
#-------- |
| 449 |
# Type 1011 : |
| 450 |
# 176 1011 0000 - |
| 451 |
# 177 1011 0001 - |
| 452 |
# 178 1011 0010 - |
| 453 |
# 179 1011 0011 - |
| 454 |
# 180 1011 0100 - |
| 455 |
# 181 1011 0101 - |
| 456 |
# 182 1011 0110 - |
| 457 |
# 183 1011 0111 - |
| 458 |
# 184 1011 1000 - |
| 459 |
# 185 1011 1001 - |
| 460 |
# 186 1011 1010 - |
| 461 |
# 187 1011 1011 - |
| 462 |
# 188 1011 1100 - |
| 463 |
# 189 1011 1101 - |
| 464 |
# 190 1011 1110 - |
| 465 |
# 191 1011 1111 - |
| 466 |
#-------- |
| 467 |
# Type 1100 : |
| 468 |
# 192 1100 0000 - |
| 469 |
# 193 1100 0001 - |
| 470 |
# 194 1100 0010 - |
| 471 |
# 195 1100 0011 - |
| 472 |
# 196 1100 0100 - |
| 473 |
# 197 1100 0101 - |
| 474 |
# 198 1100 0110 - |
| 475 |
# 199 1100 0111 - |
| 476 |
# 200 1100 1000 - |
| 477 |
# 201 1100 1001 - |
| 478 |
# 202 1100 1010 - |
| 479 |
# 203 1100 1011 - |
| 480 |
# 204 1100 1100 - |
| 481 |
# 205 1100 1101 - |
| 482 |
# 206 1100 1110 - |
| 483 |
# 207 1100 1111 - |
| 484 |
#-------- |
| 485 |
# Type 1101 : |
| 486 |
# 208 1101 0000 - |
| 487 |
# 209 1101 0001 - |
| 488 |
# 210 1101 0010 - |
| 489 |
# 211 1101 0011 - |
| 490 |
# 212 1101 0100 - |
| 491 |
# 213 1101 0101 - |
| 492 |
# 214 1101 0110 - |
| 493 |
# 215 1101 0111 - |
| 494 |
# 216 1101 1000 - |
| 495 |
# 217 1101 1001 - |
| 496 |
# 218 1101 1010 - |
| 497 |
# 219 1101 1011 - |
| 498 |
# 220 1101 1100 - |
| 499 |
# 221 1101 1101 - |
| 500 |
# 222 1101 1110 - |
| 501 |
# 223 1101 1111 - |
| 502 |
#-------- |
| 503 |
# Type 1110 : |
| 504 |
# 224 1110 0000 - |
| 505 |
# 225 1110 0001 - |
| 506 |
# 226 1110 0010 - |
| 507 |
# 227 1110 0011 - |
| 508 |
# 228 1110 0100 - |
| 509 |
# 229 1110 0101 - |
| 510 |
# 230 1110 0110 - |
| 511 |
# 231 1110 0111 - |
| 512 |
# 232 1110 1000 - |
| 513 |
# 233 1110 1001 - |
| 514 |
# 234 1110 1010 - |
| 515 |
# 235 1110 1011 - |
| 516 |
# 236 1110 1100 - |
| 517 |
# 237 1110 1101 - |
| 518 |
# 238 1110 1110 - |
| 519 |
# 239 1110 1111 - |
| 520 |
#-------- |
| 521 |
# Type 1111 : |
| 522 |
# 240 1111 0000 - |
| 523 |
# 241 1111 0001 - |
| 524 |
# 242 1111 0010 - |
| 525 |
# 243 1111 0011 - |
| 526 |
# 244 1111 0100 - |
| 527 |
# 245 1111 0101 - |
| 528 |
# 246 1111 0110 - |
| 529 |
# 247 1111 0111 - |
| 530 |
# 248 1111 1000 - |
| 531 |
# 249 1111 1001 - |
| 532 |
# 250 1111 1010 - |
| 533 |
# 251 1111 1011 - |
| 534 |
# 252 1111 1100 - |
| 535 |
# 253 1111 1101 - |
| 536 |
# 254 1111 1110 - |
| 537 |
# 255 1111 1111 - |
| 538 |
|
| 539 |
|
| 540 |
# |
| 541 |
# |
| 542 |
# Use to transmit events that happen at a specific place; can be used to make |
| 543 |
# models that are simulated locally (e.g. tankers) appear on other player's MP sessions. |
| 544 |
var PFDEventNotification = |
| 545 |
{ |
| 546 |
# new: |
| 547 |
# _ident - the identifier for the notification. not bridged. |
| 548 |
# _pfd_id - numeric identification of the PFD within the model |
| 549 |
# _event_id - event ID. |
| 550 |
# 1 softkey pushed. |
| 551 |
# 2 select page by ID |
| 552 |
# 3 Change softkey button text |
| 553 |
# 4 hardkey pushed - i.e. non-soft keys that don't change function based on context. |
| 554 |
# 5 Engine data - e.g. RPM, EGTs, CHTs for display purposes |
| 555 |
# 6 NavCom data - e.g. frequencies, volume, TX, RX for each of the COM and NAV radios. |
| 556 |
# _event_param - param related to the event ID. implementation specific. |
| 557 |
## |
| 558 |
SoftKeyPushed : 1, |
| 559 |
SelectPageById : 2, |
| 560 |
ChangeMenuText : 3, #event parameter contains array of { Id: , Text: } tuples |
| 561 |
HardKeyPushed : 4, #event parameter contains single { Id: , Value: } tuple |
| 562 |
EngineData : 5, #event parameter contains an array of hashes, each containing information about a given engine. |
| 563 |
NavComData : 6, #event parameter contains a hash of updated Nav/Com settings |
| 564 |
NavData : 7, #event parameter contrains a single { Id: , Value: } tuple requesting a particular type of NavData |
| 565 |
FMSData : 8, #event parameter containing a hash of updated GPS/FMS information (track, ground-speed, waypoint legs etc.) |
| 566 |
ADCData : 9, #event parameter containing a hash of updated Air Data Computer information (track, ground-speed etc.) |
| 567 |
FuelData: 10, #event parameter contains a single { Id: , Value: } tuple either updating or requesting a particular type of fuel data |
| 568 |
|
| 569 |
DefaultType : "PFDEventNotification", |
| 570 |
|
| 571 |
new: func(_ident, _device_id,_event_id,_event_parameter_id) |
| 572 |
{ |
| 573 |
var new_class = emesary.Notification.new(PFDEventNotification.DefaultType, _ident, PFDEventNotification_Id); |
| 574 |
new_class.Device_Id = _device_id; |
| 575 |
new_class.Event_Id = _event_id; |
| 576 |
new_class.EventParameter = _event_parameter_id; |
| 577 |
|
| 578 |
new_class.IsDistinct = 1; # each of these events is unique and needs to be bridged |
| 579 |
|
| 580 |
new_class.bridgeProperties = func |
| 581 |
{ |
| 582 |
return |
| 583 |
[ |
| 584 |
{ |
| 585 |
getValue:func{return emesary.TransferByte.encode(new_class.Event_Id);}, |
| 586 |
setValue:func(v,root,pos){var dv=emesary.TransferByte.decode(v,pos);new_class.Event_Id=dv.value;return dv}, |
| 587 |
}, |
| 588 |
{ |
| 589 |
getValue:func{return emesary.TransferByte.encode(new_class.EventParameter);}, |
| 590 |
setValue:func(v,root,pos){var dv=emesary.TransferByte.decode(v,pos);new_class.EventParameter=dv.value;return dv}, |
| 591 |
}, |
| 592 |
]; |
| 593 |
}; |
| 594 |
return new_class; |
| 595 |
}, |
| 596 |
}; |