@@ -61,6 +61,8 @@ import {
6161 ObjectId ,
6262} from './Types' ;
6363import Timeout = NodeJS . Timeout ;
64+ import { RecvEnumerateSimobjectAndLiveryList } from './recv/RecvEnumerateSimobjectAndLiveryList' ;
65+ import { RecvFlowEvent } from './recv/RecvFlowEvent' ;
6466
6567type OpenPacketData = {
6668 major : number ;
@@ -99,6 +101,13 @@ const openPacketData: { [key in Protocol]: OpenPacketData } = {
99101 buildMinor : 3 ,
100102 alias : 'HK' , // "Hawk" + "Kitty"?
101103 } ,
104+ [ Protocol . SunRise ] : {
105+ major : 12 ,
106+ minor : 2 ,
107+ buildMajor : 282174 ,
108+ buildMinor : 999 ,
109+ alias : 'SR' , // Unverified
110+ } ,
102111} ;
103112
104113interface SimConnectRecvEvents {
@@ -143,6 +152,10 @@ interface SimConnectRecvEvents {
143152 enumerateInputEventParams : (
144153 recvEnumerateInputEventParams : RecvEnumerateInputEventParams
145154 ) => void ;
155+ enumerateSimobjectAndLiveryList : (
156+ recvEnumerateSimobjectAndLiveryList : RecvEnumerateSimobjectAndLiveryList
157+ ) => void ;
158+ flowEvent : ( recvFlowEvent : RecvFlowEvent ) => void ;
146159}
147160
148161type ConnectionOptions =
@@ -1687,6 +1700,149 @@ class SimConnectConnection extends EventEmitter {
16871700 return this . _buildAndSend ( this . _beginPacket ( 0x56 ) . putInt32 ( dataDefinitionId ) ) ;
16881701 }
16891702
1703+ /**
1704+ *
1705+ * @returns sendId of packet (can be used to identify packet when exception event occurs)
1706+ */
1707+ aICreateParkedATCAircraftEx1 (
1708+ containerTitle : string ,
1709+ livery : string ,
1710+ tailNumber : string ,
1711+ airportID : string ,
1712+ dataRequestId : DataRequestId
1713+ ) : number {
1714+ if ( this . _ourProtocol < Protocol . SunRise ) throw Error ( SimConnectError . BadVersion ) ;
1715+
1716+ return this . _buildAndSend (
1717+ this . _beginPacket ( 0x57 )
1718+ . putString256 ( containerTitle )
1719+ . putString256 ( livery )
1720+ . putString ( tailNumber , 12 )
1721+ . putString ( airportID , 5 )
1722+ . putInt32 ( dataRequestId )
1723+ ) ;
1724+ }
1725+
1726+ /**
1727+ *
1728+ * @returns sendId of packet (can be used to identify packet when exception event occurs)
1729+ */
1730+ aICreateEnrouteATCAircraftEx1 (
1731+ containerTitle : string ,
1732+ livery : string ,
1733+ tailNumber : string ,
1734+ flightNumber : number ,
1735+ flightPlanPath : string ,
1736+ flightPlanPosition : number ,
1737+ touchAndGo : boolean ,
1738+ dataRequestId : DataRequestId
1739+ ) : number {
1740+ if ( this . _ourProtocol < Protocol . SunRise ) throw Error ( SimConnectError . BadVersion ) ;
1741+
1742+ return this . _buildAndSend (
1743+ this . _beginPacket ( 0x58 )
1744+ . putString256 ( containerTitle )
1745+ . putString256 ( livery )
1746+ . putString ( tailNumber , 12 )
1747+ . putInt32 ( flightNumber )
1748+ . putString ( flightPlanPath , 260 )
1749+ . putFloat64 ( flightPlanPosition )
1750+ . putInt32 ( touchAndGo ? 1 : 0 )
1751+ . putInt32 ( dataRequestId )
1752+ ) ;
1753+ }
1754+
1755+ /**
1756+ *
1757+ * @returns sendId of packet (can be used to identify packet when exception event occurs)
1758+ */
1759+ aICreateNonATCAircraftEx1 (
1760+ containerTitle : string ,
1761+ livery : string ,
1762+ tailNumber : string ,
1763+ initPos : InitPosition ,
1764+ dataRequestId : DataRequestId
1765+ ) : number {
1766+ if ( this . _ourProtocol < Protocol . SunRise ) throw Error ( SimConnectError . BadVersion ) ;
1767+
1768+ const packet = this . _beginPacket ( 0x59 )
1769+ . putString256 ( containerTitle )
1770+ . putString256 ( livery )
1771+ . putString ( tailNumber , 12 ) ;
1772+
1773+ initPos . writeTo ( packet ) ;
1774+ packet . putInt32 ( dataRequestId ) ;
1775+
1776+ return this . _buildAndSend ( packet ) ;
1777+ }
1778+
1779+ /**
1780+ *
1781+ * @returns sendId of packet (can be used to identify packet when exception event occurs)
1782+ */
1783+ aICreateSimulatedObjectEx1 (
1784+ containerTitle : string ,
1785+ livery : string ,
1786+ initPos : InitPosition ,
1787+ dataRequestId : DataRequestId
1788+ ) : number {
1789+ if ( this . _ourProtocol < Protocol . SunRise ) throw Error ( SimConnectError . BadVersion ) ;
1790+
1791+ const packet = this . _beginPacket ( 0x5a ) ;
1792+
1793+ packet . putString256 ( containerTitle ) ;
1794+ packet . putString256 ( livery ) ;
1795+ initPos . writeTo ( packet ) ;
1796+ packet . putInt32 ( dataRequestId ) ;
1797+
1798+ return this . _buildAndSend ( packet ) ;
1799+ }
1800+
1801+ /**
1802+ *
1803+ * @returns sendId of packet (can be used to identify packet when exception event occurs)
1804+ */
1805+ enumerateSimObjectsAndLiveries ( dataRequestId : DataRequestId , type : SimObjectType ) : number {
1806+ if ( this . _ourProtocol < Protocol . SunRise ) throw Error ( SimConnectError . BadVersion ) ;
1807+
1808+ const packet = this . _beginPacket ( 0x5b ) . putInt32 ( dataRequestId ) . putInt32 ( type ) ;
1809+
1810+ return this . _buildAndSend ( packet ) ;
1811+ }
1812+
1813+ /**
1814+ *
1815+ * @returns sendId of packet (can be used to identify packet when exception event occurs)
1816+ */
1817+ subscribeToFlowEvent ( ) : number {
1818+ if ( this . _ourProtocol < Protocol . SunRise ) throw Error ( SimConnectError . BadVersion ) ;
1819+
1820+ const packet = this . _beginPacket ( 0x5c ) ;
1821+ return this . _buildAndSend ( packet ) ;
1822+ }
1823+
1824+ /**
1825+ *
1826+ * @returns sendId of packet (can be used to identify packet when exception event occurs)
1827+ */
1828+ unsubscribeToFlowEvent ( ) : number {
1829+ if ( this . _ourProtocol < Protocol . SunRise ) throw Error ( SimConnectError . BadVersion ) ;
1830+
1831+ const packet = this . _beginPacket ( 0x5d ) ;
1832+ return this . _buildAndSend ( packet ) ;
1833+ }
1834+
1835+ /**
1836+ *
1837+ * @returns sendId of packet (can be used to identify packet when exception event occurs)
1838+ */
1839+ requestAllFacilities ( dataRequestId : DataRequestId , type : FacilityListType ) : number {
1840+ if ( this . _ourProtocol < Protocol . SunRise ) throw Error ( SimConnectError . BadVersion ) ;
1841+
1842+ const packet = this . _beginPacket ( 0x5e ) . putInt32 ( dataRequestId ) . putInt32 ( type ) ;
1843+ return this . _buildAndSend ( packet ) ;
1844+ }
1845+
16901846 close ( ) {
16911847 if ( this . _openTimeout !== null ) {
16921848 clearTimeout ( this . _openTimeout ) ;
@@ -1833,6 +1989,15 @@ class SimConnectConnection extends EventEmitter {
18331989 case RecvID . ID_ENUMERATE_INPUT_EVENT_PARAMS :
18341990 this . emit ( 'enumerateInputEventParams' , new RecvEnumerateInputEventParams ( data ) ) ;
18351991 break ;
1992+ case RecvID . ID_ENUMERATE_SIMOBJECT_AND_LIVERY_LIST :
1993+ this . emit (
1994+ 'enumerateSimobjectAndLiveryList' ,
1995+ new RecvEnumerateSimobjectAndLiveryList ( data )
1996+ ) ;
1997+ break ;
1998+ case RecvID . ID_FLOW_EVENT :
1999+ this . emit ( 'flowEvent' , new RecvFlowEvent ( data ) ) ;
2000+ break ;
18362001 }
18372002 }
18382003
0 commit comments