### GET /api/v1/utility/pdf/listdir Source: https://context7.com/flybywiresim/simbridge/llms.txt Lists all subdirectories within the 'pdfs' resource folder. Allows exploration of the directory structure for PDF assets. ```APIDOC ## GET /api/v1/utility/pdf/listdir ### Description Lists all subdirectories within the 'pdfs' resource folder. ### Method GET ### Endpoint /api/v1/utility/pdf/listdir ### Parameters #### Query Parameters - **dirname** (string) - Optional - The parent directory within the 'pdfs' resource folder to list subdirectories from. If omitted, lists subdirectories from the root 'pdfs' directory. ### Request Example ```bash # List all directories in pdfs folder curl http://localhost:8380/api/v1/utility/pdf/listdir # List subdirectories within a specific directory curl "http://localhost:8380/api/v1/utility/pdf/listdir?dirname=charts" ``` ### Response #### Success Response (200) - **array** (array of strings) - An array containing the names of the subdirectories found. #### Response Example ```json ["charts", "manuals", "procedures"] ``` ``` -------------------------------- ### Get PDF Page Count (Bash) Source: https://context7.com/flybywiresim/simbridge/llms.txt Returns the total number of pages for a given PDF file. Can specify filename and subdirectory. ```bash # Get number of pages in PDF curl "http://localhost:8380/api/v1/utility/pdf/numpages?filename=manual.pdf" # Response 42 # Get page count from subdirectory curl "http://localhost:8380/api/v1/utility/pdf/numpages?filename=approach.pdf&dirname=charts/KJFK" # Response 3 ``` -------------------------------- ### GET /api/v1/utility/image Source: https://context7.com/flybywiresim/simbridge/llms.txt Retrieves an image file from the 'images' resource directory. The response will be the image data with the appropriate content type. ```APIDOC ## GET /api/v1/utility/image ### Description Retrieves an image file from the 'images' resource directory. ### Method GET ### Endpoint /api/v1/utility/image ### Parameters #### Query Parameters - **filename** (string) - Required - The name of the image file to retrieve. ### Request Example ```bash # Get an image file curl "http://localhost:8380/api/v1/utility/image?filename=logo.png" --output logo.png # Get a JPEG image curl "http://localhost:8380/api/v1/utility/image?filename=livery.jpg" --output livery.jpg ``` ### Response #### Success Response (200) The response is the image file content (e.g., PNG, JPG) with the appropriate `Content-Type` header. ``` -------------------------------- ### Get Image File (Bash) Source: https://context7.com/flybywiresim/simbridge/llms.txt Retrieves an image file from the 'images' resource directory. The response is the image file itself with the appropriate Content-Type header. ```bash # Get an image file curl "http://localhost:8380/api/v1/utility/image?filename=logo.png" \ --output logo.png # Get a JPEG image curl "http://localhost:8380/api/v1/utility/image?filename=livery.jpg" \ --output livery.jpg # The response is the image file with appropriate Content-Type header ``` -------------------------------- ### GET /api/v1/utility/image/list Source: https://context7.com/flybywiresim/simbridge/llms.txt Returns an array of all image filenames present in the 'images' resource directory. Useful for discovering available image assets. ```APIDOC ## GET /api/v1/utility/image/list ### Description Returns an array of all image filenames in the 'images' directory. ### Method GET ### Endpoint /api/v1/utility/image/list ### Parameters None ### Request Example ```bash # List all images curl http://localhost:8380/api/v1/utility/image/list ``` ### Response #### Success Response (200) - **array** (array of strings) - An array containing the filenames of the image files found. #### Response Example ```json ["logo.png", "livery.jpg", "texture.bmp", "icon.svg"] ``` ``` -------------------------------- ### GET /api/v1/utility/pdf/numpages Source: https://context7.com/flybywiresim/simbridge/llms.txt Returns the total number of pages in a specified PDF document. Useful for validation or determining the range of pages to process. ```APIDOC ## GET /api/v1/utility/pdf/numpages ### Description Returns the total number of pages in a specified PDF document. ### Method GET ### Endpoint /api/v1/utility/pdf/numpages ### Parameters #### Query Parameters - **filename** (string) - Required - The name of the PDF file. - **dirname** (string) - Optional - The subdirectory within the 'pdfs' resource folder where the PDF is located. ### Request Example ```bash # Get number of pages in PDF curl "http://localhost:8380/api/v1/utility/pdf/numpages?filename=manual.pdf" # Get page count from subdirectory curl "http://localhost:8380/api/v1/utility/pdf/numpages?filename=approach.pdf&dirname=charts/KJFK" ``` ### Response #### Success Response (200) - **integer** - The total number of pages in the specified PDF document. #### Response Example ``` 42 ``` ``` -------------------------------- ### GET /api/v1/utility/pdf/list Source: https://context7.com/flybywiresim/simbridge/llms.txt Returns an array of all PDF filenames in the 'pdfs' directory or a specified subdirectory. Useful for managing and referencing available PDF documents. ```APIDOC ## GET /api/v1/utility/pdf/list ### Description Returns an array of all PDF filenames in the 'pdfs' directory or specified subdirectory. ### Method GET ### Endpoint /api/v1/utility/pdf/list ### Parameters #### Query Parameters - **dirname** (string) - Optional - The subdirectory within the 'pdfs' resource folder to list files from. If omitted, lists files from the root 'pdfs' directory. ### Request Example ```bash # List all PDFs in root directory curl http://localhost:8380/api/v1/utility/pdf/list # List PDFs in specific subdirectory curl "http://localhost:8380/api/v1/utility/pdf/list?dirname=charts/KJFK" ``` ### Response #### Success Response (200) - **array** (array of strings) - An array containing the filenames of the PDF files found. #### Response Example ```json ["chart1.pdf", "chart2.pdf", "manual.pdf"] ``` ``` -------------------------------- ### GET /api/v1/utility/pdf Source: https://context7.com/flybywiresim/simbridge/llms.txt Converts a specific page of a PDF file to PNG format for display in aircraft instruments. Supports specifying a filename and page number, with an optional directory. ```APIDOC ## GET /api/v1/utility/pdf ### Description Converts a specific page of a PDF file to PNG format for display in aircraft instruments. ### Method GET ### Endpoint /api/v1/utility/pdf ### Parameters #### Query Parameters - **filename** (string) - Required - The name of the PDF file to convert. - **pagenumber** (integer) - Required - The page number to convert to an image. - **dirname** (string) - Optional - The subdirectory within the 'pdfs' resource folder where the PDF is located. ### Request Example ```bash # Convert PDF page 1 to PNG curl "http://localhost:8380/api/v1/utility/pdf?filename=chart.pdf&pagenumber=1" --output chart-page1.png # Convert PDF from subdirectory curl "http://localhost:8380/api/v1/utility/pdf?filename=approach.pdf&pagenumber=2&dirname=charts/KJFK" --output approach-page2.png ``` ### Response #### Success Response (200) The response is a PNG image file of the specified PDF page. The Content-Type header will be set to `image/png`. ``` -------------------------------- ### Terrain Display - Get Rendering Frames Source: https://context7.com/flybywiresim/simbridge/llms.txt Returns base64-encoded terrain display frames for rendering navigation display terrain overlays. ```APIDOC ## GET /api/v1/terrain/renderingFrames ### Description Returns base64-encoded terrain display frames for rendering navigation display terrain overlays. ### Method GET ### Endpoint /api/v1/terrain/renderingFrames ### Parameters #### Query Parameters - **display** (string) - Required - The display side for which to retrieve the frames. Accepted values: "CAPT" (Captain) or "FO" (First Officer). ### Request Example ```bash curl "http://localhost:8380/api/v1/terrain/renderingFrames?display=CAPT" ``` ### Response #### Success Response (200) - **(array of strings)** - An array where each string is a base64-encoded terrain frame. #### Response Example ```json [ "iVBORw0KGgoAAAANSUhEUgAA...", "AKDFJALKSJDFLKAJSDLFKja..." ] ``` ``` -------------------------------- ### Company Route Management - Get Route Count Source: https://context7.com/flybywiresim/simbridge/llms.txt Retrieves the total number of company route files available in the 'coroutes' directory. ```APIDOC ## GET /api/v1/coroute/length ### Description Returns the total number of company route files available in the coroutes directory. ### Method GET ### Endpoint /api/v1/coroute/length ### Parameters None ### Request Example ```bash curl http://localhost:8380/api/v1/coroute/length ``` ### Response #### Success Response (200) - **(integer)** - The total count of company route files. #### Response Example ``` 15 ``` ``` -------------------------------- ### Terrain Display - Get Rendering Thresholds Source: https://context7.com/flybywiresim/simbridge/llms.txt Retrieves terrain display thresholds used for color coding terrain elevation warnings. ```APIDOC ## GET /api/v1/terrain/renderingThresholds ### Description Retrieves terrain display thresholds used for color coding terrain elevation warnings. ### Method GET ### Endpoint /api/v1/terrain/renderingThresholds ### Parameters #### Query Parameters - **display** (string) - Required - The display side for which to retrieve the thresholds. Accepted values: "CAPT" (Captain) or "FO" (First Officer). ### Request Example ```bash curl "http://localhost:8380/api/v1/terrain/renderingThresholds?display=CAPT" ``` ### Response #### Success Response (200) - **cautionThreshold** (number) - The elevation threshold for caution warnings. - **warningThreshold** (number) - The elevation threshold for warning warnings. - **minimumTerrainElevation** (number) - The minimum terrain elevation considered. - **maximumTerrainElevation** (number) - The maximum terrain elevation considered. #### Response Example ```json { "cautionThreshold": 2000, "warningThreshold": 1000, "minimumTerrainElevation": -500, "maximumTerrainElevation": 15000 } ``` ``` -------------------------------- ### Terrain Display - Get Rendering Timestamp Source: https://context7.com/flybywiresim/simbridge/llms.txt Returns the timestamp of the current terrain rendering data for a specified display side (captain or first officer). ```APIDOC ## GET /api/v1/terrain/renderingTimestamp ### Description Returns the timestamp of the current terrain rendering data for a specified display side. ### Method GET ### Endpoint /api/v1/terrain/renderingTimestamp ### Parameters #### Query Parameters - **display** (string) - Required - The display side for which to retrieve the timestamp. Accepted values: "CAPT" (Captain) or "FO" (First Officer). ### Request Example ```bash # Get rendering timestamp for captain's display curl "http://localhost:8380/api/v1/terrain/renderingTimestamp?display=CAPT" # Get timestamp for first officer's display curl "http://localhost:8380/api/v1/terrain/renderingTimestamp?display=FO" ``` ### Response #### Success Response (200) - **(integer)** - The timestamp of the terrain rendering data. Returns -1 if no data is available. #### Response Example ``` 1702845678123 ``` #### Response Example (No Data) ``` -1 ``` ``` -------------------------------- ### Company Route Management - Get Specific Route Source: https://context7.com/flybywiresim/simbridge/llms.txt Retrieves a specific company route by its route number. The route is parsed from XML format and returned as structured JSON. ```APIDOC ## GET /api/v1/coroute ### Description Retrieves a specific company route by route number, parsing XML format and returning structured JSON. ### Method GET ### Endpoint /api/v1/coroute ### Parameters #### Query Parameters - **rteNum** (string) - Required - The identifier for the company route (e.g., "KJFK-EGLL-001"). ### Request Example ```bash curl "http://localhost:8380/api/v1/coroute?rteNum=KJFK-EGLL-001" ``` ### Response #### Success Response (200) - **name** (string) - The name of the route. - **origin** (object) - Details of the origin airport. - **icao_code** (string) - ICAO code of the origin airport. - **iata_code** (string) - IATA code of the origin airport. - **name** (string) - Name of the origin airport. - **pos_lat** (number) - Latitude of the origin airport. - **pos_long** (number) - Longitude of the origin airport. - **elevation** (number) - Elevation of the origin airport. - **destination** (object) - Details of the destination airport (same structure as origin). - **alternate** (object) - Details of the alternate airport (same structure as origin). - **general** (object) - General information about the route. - **route** (string) - The flight path description. - **cruise_altitude** (number) - The cruise altitude for the route. - **distance** (number) - The total distance of the route. - **navlog** (object) - Navigation log details. - **fix** (array) - An array of navigation fixes. - **ident** (string) - Identifier of the fix. - **type** (string) - Type of the fix (e.g., "waypoint"). - **pos_lat** (number) - Latitude of the fix. - **pos_long** (number) - Longitude of the fix. - **frequency** (number or null) - Frequency associated with the fix. #### Response Example ```json { "name": "KJFK-EGLL-001", "origin": { "icao_code": "KJFK", "iata_code": "JFK", "name": "John F Kennedy International Airport", "pos_lat": 40.63975111, "pos_long": -73.77892556, "elevation": 13 }, "destination": { "icao_code": "EGLL", "iata_code": "LHR", "name": "London Heathrow Airport", "pos_lat": 51.4775, "pos_long": -0.461389, "elevation": 83 }, "alternate": { "icao_code": "EGSS", "iata_code": "STN", "name": "London Stansted Airport", "pos_lat": 51.885, "pos_long": 0.235, "elevation": 348 }, "general": { "route": "HAPIE6 HAPIE DCT OMOKO N139A ETIKI DCT MALOT UN546 POL UN57 KONAN KONAN1A", "cruise_altitude": 36000, "distance": 3459 }, "navlog": { "fix": [ { "ident": "HAPIE", "type": "waypoint", "pos_lat": 40.3972, "pos_long": -73.1542, "frequency": null } ] } } ``` ``` -------------------------------- ### SimBridge Terrain Display: Get Rendering Frames Source: https://context7.com/flybywiresim/simbridge/llms.txt This endpoint returns base64-encoded terrain display frames. These frames are intended for rendering terrain overlays on the navigation display, providing visual context for terrain elevation. ```bash # Get terrain rendering frames curl "http://localhost:8380/api/v1/terrain/renderingFrames?display=CAPT" # Response [ "iVBORw0KGgoAAAANSUhEUgAA...", "AKDFJALKSJDFLKAJSDLFKja..." ] ``` -------------------------------- ### SimBridge Terrain Display: Get Rendering Thresholds Source: https://context7.com/flybywiresim/simbridge/llms.txt Retrieves the terrain display thresholds used for color-coding terrain elevation warnings on the navigation display. It includes caution and warning thresholds, as well as minimum and maximum terrain elevations. ```bash # Get terrain rendering thresholds curl "http://localhost:8380/api/v1/terrain/renderingThresholds?display=CAPT" # Response { "cautionThreshold": 2000, "warningThreshold": 1000, "minimumTerrainElevation": -500, "maximumTerrainElevation": 15000 } ``` -------------------------------- ### SimBridge Terrain Display: Get Rendering Timestamp Source: https://context7.com/flybywiresim/simbridge/llms.txt This API retrieves the timestamp of the latest terrain rendering data for a specified display side (Captain or First Officer). This can be used to check for updates in terrain data. ```bash # Get rendering timestamp for captain's display curl "http://localhost:8380/api/v1/terrain/renderingTimestamp?display=CAPT" # Response 1702845678123 # Get timestamp for first officer's display curl "http://localhost:8380/api/v1/terrain/renderingTimestamp?display=FO" # Response (returns -1 if no data available) -1 ``` -------------------------------- ### SimBridge Company Route Management: Get Specific Route Source: https://context7.com/flybywiresim/simbridge/llms.txt This endpoint retrieves detailed information for a specific company route identified by its route number. The route data is expected to be in XML format and is parsed into a structured JSON object. ```bash # Get company route by route number curl "http://localhost:8380/api/v1/coroute?rteNum=KJFK-EGLL-001" # Response { "name": "KJFK-EGLL-001", "origin": { "icao_code": "KJFK", "iata_code": "JFK", "name": "John F Kennedy International Airport", "pos_lat": 40.63975111, "pos_long": -73.77892556, "elevation": 13 }, "destination": { "icao_code": "EGLL", "iata_code": "LHR", "name": "London Heathrow Airport", "pos_lat": 51.4775, "pos_long": -0.461389, "elevation": 83 }, "alternate": { "icao_code": "EGSS", "iata_code": "STN", "name": "London Stansted Airport", "pos_lat": 51.885, "pos_long": 0.235, "elevation": 348 }, "general": { "route": "HAPIE6 HAPIE DCT OMOKO N139A ETIKI DCT MALOT UN546 POL UN57 KONAN KONAN1A", "cruise_altitude": 36000, "distance": 3459 }, "navlog": { "fix": [ { "ident": "HAPIE", "type": "waypoint", "pos_lat": 40.3972, "pos_long": -73.1542, "frequency": null } ] } } ``` -------------------------------- ### SimBridge Company Route Management: Get Route Count Source: https://context7.com/flybywiresim/simbridge/llms.txt This API endpoint retrieves the total count of company route files available in the SimBridge application's 'coroutes' directory. It's useful for understanding the scope of available routes. ```bash # Get number of available company routes curl http://localhost:8380/api/v1/coroute/length # Response 15 ``` -------------------------------- ### List Image Files (Bash) Source: https://context7.com/flybywiresim/simbridge/llms.txt Returns an array of all image filenames available in the 'images' resource directory. ```bash # List all images curl http://localhost:8380/api/v1/utility/image/list # Response ["logo.png", "livery.jpg", "texture.bmp", "icon.svg"] ``` -------------------------------- ### List PDF Directories (Bash) Source: https://context7.com/flybywiresim/simbridge/llms.txt Lists subdirectories within the 'pdfs' resource folder. Allows for navigation and organization of PDF files. ```bash # List all directories in pdfs folder curl http://localhost:8380/api/v1/utility/pdf/listdir # Response ["charts", "manuals", "procedures"] # List subdirectories within a specific directory curl "http://localhost:8380/api/v1/utility/pdf/listdir?dirname=charts" # Response ["KJFK", "EGLL", "LFPG"] ``` -------------------------------- ### List PDF Files (Bash) Source: https://context7.com/flybywiresim/simbridge/llms.txt Retrieves a list of PDF filenames from the 'pdfs' directory or a specified subdirectory. Useful for managing available charts or documents. ```bash # List all PDFs in root directory curl http://localhost:8380/api/v1/utility/pdf/list # Response ["chart1.pdf", "chart2.pdf", "manual.pdf"] # List PDFs in specific subdirectory curl "http://localhost:8380/api/v1/utility/pdf/list?dirname=charts/KJFK" # Response ["approach-22L.pdf", "approach-31R.pdf", "departure-SID.pdf"] ``` -------------------------------- ### Convert PDF Page to Image (Bash) Source: https://context7.com/flybywiresim/simbridge/llms.txt Converts a specified page of a PDF file into a PNG image. Supports specifying the filename and page number, with an option to include a subdirectory. ```bash # Convert PDF page 1 to PNG curl "http://localhost:8380/api/v1/utility/pdf?filename=chart.pdf&pagenumber=1" \ --output chart-page1.png # Convert PDF from subdirectory curl "http://localhost:8380/api/v1/utility/pdf?filename=approach.pdf&pagenumber=2&dirname=charts/KJFK" \ --output approach-page2.png # The response is a PNG image file suitable for display ``` -------------------------------- ### Configure Printer Service for SimBridge (TypeScript) Source: https://context7.com/flybywiresim/simbridge/llms.txt Illustrates how to enable and configure the printer service within SimBridge's properties.json for physical printing of MCDU documents. The service automatically handles printing when print commands are received. ```typescript // Example: Configure printer in properties.json { "printer": { "enabled": true, "printerName": "HP LaserJet Pro", "fontSize": 19, "paperSize": "A4", "margin": 30 } } // Printing is triggered automatically when the MCDU sends print commands // The printer service receives formatted text lines and generates a PDF // which is then sent to the configured physical printer ``` -------------------------------- ### SimBridge Server and Printer Configuration (JSON) Source: https://context7.com/flybywiresim/simbridge/llms.txt Defines the server port, visibility, and automatic closing behavior, as well as printer settings like enablement, name, font size, paper size, and margins. ```json { "server": { "port": 8380, "hidden": true, "closeWithMSFS": false }, "printer": { "enabled": false, "printerName": null, "fontSize": 19, "paperSize": "A4", "margin": 30 } } ``` -------------------------------- ### Update Vertical Display Path for Terrain (Bash) Source: https://context7.com/flybywiresim/simbridge/llms.txt Submits active flight plan waypoints to the terrain system for vertical profile calculation. Includes path width and track change sensitivity. ```bash # Update flight path for terrain elevation sampling curl -X POST http://localhost:8380/api/v1/terrain/verticalDisplayPath \ -H "Content-Type: application/json" \ -d '{ "pathWidth": 1.0, "trackChangesSignificantlyAtDistance": 5.0, "waypoints": [ { "ident": "KJFK", "latitude": 40.6397, "longitude": -73.7789, "altitude": 13 }, { "ident": "HAPIE", "latitude": 40.3972, "longitude": -73.1542, "altitude": 5000 }, { "ident": "OMOKO", "latitude": 39.8756, "longitude": -72.3421, "altitude": 10000 } ] }' # Response (200 OK) ``` -------------------------------- ### Generate and Visualize Pattern Mask in Python Source: https://github.com/flybywiresim/simbridge/blob/main/tools/a380_scanpattern_texture.ipynb This Python code initializes a mask with the specified image dimensions and then iterates through each pixel to apply low density, high density, and water density patterns using the previously defined functions. Finally, it prints the resulting mask and displays it as an image using Matplotlib. ```python mask = np.zeros([height,width]) for y in range(mask.shape[0]): for x in range(mask.shape[1]): # fill low density pattern lowDensityPixel(x, y) # fill high density pattern highDensityPattern(x, y) # fill water pattern waterDensityPattern(x, y) print(mask) plt.imshow(mask * 150) ``` -------------------------------- ### Define Pattern and Image Metrics in Python Source: https://github.com/flybywiresim/simbridge/blob/main/tools/a380_scanpattern_texture.ipynb This Python snippet defines global variables for pattern metrics (density values, patch size) and image metrics (width, height), along with the root coordinate system. These variables are crucial for the subsequent pattern generation logic. ```python import numpy as np import matplotlib.pyplot as plt # pattern metrices lowDensityValue = 3 highDensityValue = 5 waterValue = 7 patchSize = 12 # image metrices width = 768 height = 592 # root coordinate system rootX = width / 2 rootY = height ``` -------------------------------- ### Company Route Management - Search Routes by Airport Source: https://context7.com/flybywiresim/simbridge/llms.txt Searches and returns all company routes matching specified origin and destination ICAO codes. ```APIDOC ## GET /api/v1/coroute/list ### Description Searches and returns all company routes matching specified origin and destination ICAO codes. ### Method GET ### Endpoint /api/v1/coroute/list ### Parameters #### Query Parameters - **origin** (string) - Required - The ICAO code of the origin airport. - **destination** (string) - Required - The ICAO code of the destination airport. ### Request Example ```bash curl "http://localhost:8380/api/v1/coroute/list?origin=KJFK&destination=EGLL" ``` ### Response #### Success Response (200) - An array of route objects, where each object contains: - **name** (string) - The name of the route. - **origin** (object) - Basic origin airport details. - **icao_code** (string) - ICAO code. - **name** (string) - Name of the origin airport. - **destination** (object) - Basic destination airport details (same structure as origin). - **general** (object) - General route information. - **route** (string) - The flight path description. - **cruise_altitude** (number) - The cruise altitude. #### Response Example ```json [ { "name": "KJFK-EGLL-001", "origin": { "icao_code": "KJFK", "name": "John F Kennedy International Airport" }, "destination": { "icao_code": "EGLL", "name": "London Heathrow Airport" }, "general": { "route": "HAPIE6 HAPIE DCT OMOKO...", "cruise_altitude": 36000 } }, { "name": "KJFK-EGLL-002", "origin": { "icao_code": "KJFK", "name": "John F Kennedy International Airport" }, "destination": { "icao_code": "EGLL", "name": "London Heathrow Airport" }, "general": { "route": "MERIT3 MERIT N139A...", "cruise_altitude": 38000 } } ] ``` ``` -------------------------------- ### Configure MSFS Integration for Automatic Shutdown (TypeScript) Source: https://context7.com/flybywiresim/simbridge/llms.txt Shows how to configure SimBridge to automatically shut down when Microsoft Flight Simulator (MSFS) exits. This ensures a clean shutdown process by setting the 'closeWithMSFS' property. ```typescript // Enable automatic shutdown when MSFS closes // Set in properties.json: { "server": { "closeWithMSFS": true } } // The service polls MSFS every 5 seconds on port 500 // When MSFS is detected as closed after being running, SimBridge shuts down // This ensures clean shutdown when the simulator exits ``` -------------------------------- ### Connect and Communicate with MCDU Remote Interface Gateway (JavaScript) Source: https://context7.com/flybywiresim/simbridge/llms.txt Establishes a WebSocket connection to the SimBridge MCDU interface to send key presses and receive screen updates. Handles connection, message parsing, and error events. ```javascript // Connect to MCDU WebSocket gateway const ws = new WebSocket('ws://localhost:8380/interfaces/v1/mcdu'); ws.onopen = () => { console.log('Connected to SimBridge MCDU interface'); }; ws.onmessage = (event) => { const message = event.data; // Handle simulator connection notification if (message === 'mcduConnected') { console.log('Simulator MCDU connected'); } // Handle MCDU screen updates (JSON format) try { const mcduData = JSON.parse(message); // Update remote MCDU display with screen data updateMCDUDisplay(mcduData); } catch (e) { console.log('Received:', message); } }; // Send key press to MCDU function sendKeyPress(key) { ws.send(JSON.stringify({ event: 'keypress', key: key })); } // Send print command with lines array function printDocument(lines) { const printCommand = { lines: [ "FLIGHT PLAN SUMMARY", "KJFK - EGLL", "ROUTE: HAPIE6 HAPIE DCT...", "DISTANCE: 3459 NM", "FLIGHT TIME: 07:15" ] }; ws.send('print:' + JSON.stringify(printCommand)); } // Example usage sendKeyPress('LSK1L'); // Left softkey 1 sendKeyPress('DIR'); // Direct-to key printDocument([ "FLIGHT PLAN SUMMARY", "KJFK - EGLL" ]); ws.onerror = (error) => { console.error('WebSocket error:', error); }; ws.onclose = () => { console.log('Disconnected from MCDU interface'); }; ``` -------------------------------- ### Pixel Filling and Pattern Application Functions in Python Source: https://github.com/flybywiresim/simbridge/blob/main/tools/a380_scanpattern_texture.ipynb This Python code defines functions to fill pixels in a mask, specifically for low density, high density, and water density patterns. The `fillPixel` function updates a pixel value, while `lowDensityPixel`, `highDensityPattern`, and `waterDensityPattern` apply specific pattern logic based on modulo arithmetic of coordinates. ```python def fillPixel(x, y, value): if mask[y][x] == 0: mask[y][x] = value else: mask[y][x] *= value def lowDensityPixel(x, y): patchX = x % 13 patchY = y % 13 if (patchY >= 5 and patchY <= 7) and (patchX <= 1 or patchX == 12): fillPixel(x, y, lowDensityValue) elif (patchX >= 5 and patchX <= 7) and (patchY <= 1 or patchY == 12): fillPixel(x, y, lowDensityValue) def highDensityPattern(x, y): patchX = x % 6 patchY = y % 6 if (patchY <= 1 or patchY == 5) and (patchX >= 2 and patchX <= 4): fillPixel(x, y, highDensityValue) elif (patchX <= 1 or patchX == 5) and (patchY >= 2 and patchY <= 4): fillPixel(x, y, highDensityValue) def waterDensityPattern(x, y): patchX = x % 9 patchY = y % 9 if (patchY <= 1 or patchY == 8) and (patchX >= 4 and patchX <= 6): fillPixel(x, y, waterValue) elif (patchX <= 1 or patchX == 8) and (patchY >= 4 and patchY <= 6): fillPixel(x, y, waterValue) ``` -------------------------------- ### Update Aircraft Status for Terrain (Bash) Source: https://context7.com/flybywiresim/simbridge/llms.txt Sends current aircraft positional and flight data to the terrain system for calculation. Requires latitude, longitude, altitude, radio altitude, ground speed, track, vertical speed, and onGround status. ```bash # Update aircraft status for terrain calculation curl -X POST http://localhost:8380/api/v1/terrain/aircraftStatusData \ -H "Content-Type: application/json" \ -d '{ "latitude": 40.6413, "longitude": -73.7781, "altitude": 1500, "radioAltitude": 250, "groundSpeed": 145, "track": 270, "verticalSpeed": 500, "onGround": false }' # Response (200 OK) ``` -------------------------------- ### SimBridge Company Route Management: Search Routes Source: https://context7.com/flybywiresim/simbridge/llms.txt This endpoint allows searching for company routes based on origin and destination airport ICAO codes. It returns a list of matching routes, providing a summary of each, including name, origin, destination, and general flight details. ```bash # Search routes between two airports curl "http://localhost:8380/api/v1/coroute/list?origin=KJFK&destination=EGLL" # Response [ { "name": "KJFK-EGLL-001", "origin": { "icao_code": "KJFK", "name": "John F Kennedy International Airport" }, "destination": { "icao_code": "EGLL", "name": "London Heathrow Airport" }, "general": { "route": "HAPIE6 HAPIE DCT OMOKO...", "cruise_altitude": 36000 } }, { "name": "KJFK-EGLL-002", "origin": { "icao_code": "KJFK", "name": "John F Kennedy International Airport" }, "destination": { "icao_code": "EGLL", "name": "London Heathrow Airport" }, "general": { "route": "MERIT3 MERIT N139A...", "cruise_altitude": 38000 } } ] ``` -------------------------------- ### POST /api/v1/terrain/verticalDisplayPath Source: https://context7.com/flybywiresim/simbridge/llms.txt Submits the active flight plan waypoints for vertical terrain profile calculation. This allows the system to render terrain elevation along the planned route. ```APIDOC ## POST /api/v1/terrain/verticalDisplayPath ### Description Submits the active flight plan waypoints for vertical terrain profile calculation. ### Method POST ### Endpoint /api/v1/terrain/verticalDisplayPath ### Parameters #### Request Body - **pathWidth** (number) - Required - The width of the path to consider for terrain sampling. - **trackChangesSignificantlyAtDistance** (number) - Required - Distance at which track changes are considered significant. - **waypoints** (array) - Required - An array of waypoint objects defining the flight path. - **ident** (string) - Required - Identifier for the waypoint (e.g., airport code). - **latitude** (number) - Required - Latitude of the waypoint. - **longitude** (number) - Required - Longitude of the waypoint. - **altitude** (number) - Required - Altitude at the waypoint. ### Request Example ```json { "pathWidth": 1.0, "trackChangesSignificantlyAtDistance": 5.0, "waypoints": [ { "ident": "KJFK", "latitude": 40.6397, "longitude": -73.7789, "altitude": 13 }, { "ident": "HAPIE", "latitude": 40.3972, "longitude": -73.1542, "altitude": 5000 }, { "ident": "OMOKO", "latitude": 39.8756, "longitude": -72.3421, "altitude": 10000 } ] } ``` ### Response #### Success Response (200) This endpoint typically returns a 200 OK status upon successful processing of the flight plan waypoints. No specific response body is detailed. ``` -------------------------------- ### POST /api/v1/terrain/aircraftStatusData Source: https://context7.com/flybywiresim/simbridge/llms.txt Updates the terrain system with current aircraft position, altitude, and flight parameters. This endpoint is crucial for accurate terrain rendering based on the aircraft's state. ```APIDOC ## POST /api/v1/terrain/aircraftStatusData ### Description Updates the terrain system with current aircraft position, altitude, and flight parameters. ### Method POST ### Endpoint /api/v1/terrain/aircraftStatusData ### Parameters #### Request Body - **latitude** (number) - Required - The current latitude of the aircraft. - **longitude** (number) - Required - The current longitude of the aircraft. - **altitude** (number) - Required - The current altitude of the aircraft in feet. - **radioAltitude** (number) - Required - The current radio altitude of the aircraft in feet. - **groundSpeed** (number) - Required - The current ground speed of the aircraft in knots. - **track** (number) - Required - The current track of the aircraft in degrees. - **verticalSpeed** (number) - Required - The current vertical speed of the aircraft in feet per minute. - **onGround** (boolean) - Required - Indicates if the aircraft is currently on the ground. ### Request Example ```json { "latitude": 40.6413, "longitude": -73.7781, "altitude": 1500, "radioAltitude": 250, "groundSpeed": 145, "track": 270, "verticalSpeed": 500, "onGround": false } ``` ### Response #### Success Response (200) This endpoint typically returns a 200 OK status upon successful processing of the aircraft data. No specific response body is detailed, implying it may be empty or a simple confirmation. ``` -------------------------------- ### Export Pattern Map to TypeScript in Python Source: https://github.com/flybywiresim/simbridge/blob/main/tools/a380_scanpattern_texture.ipynb This Python snippet writes the generated pattern mask to a TypeScript file named 'patternmap.ts'. It formats the mask data as a Uint8ClampedArray, suitable for use in a web environment, and exports it as a function `createScanlineModePatternMap`. ```python def printValueRow(values): string = ' ' for x in range(len(values)): string += str(int(values[x])) + ', ' if len(string) >= 180: file.write(string + '\n') string = ' ' if len(string) != 4: file.write(string + '\n') with open('output/patternmap.ts', 'w') as file: file.write('export const createScanlineModePatternMap = () => new Uint8ClampedArray([ ') for y in range(mask.shape[0]): file.write(' // row in ' + str(y + 1) + '\n') printValueRow(mask[y]) file.write(']);\n') ``` -------------------------------- ### SimBridge Health Check and Remote Shutdown Source: https://context7.com/flybywiresim/simbridge/llms.txt This endpoint allows monitoring the operational status of SimBridge services, including the MCDU interface and API. It also provides a method to remotely shut down the server. The health check returns a JSON object indicating the status of each service, while the shutdown endpoint triggers a server termination. ```bash # Check service health curl http://localhost:8380/health # Response { "status": "ok", "info": { "mcdu": { "status": "up" }, "api": { "status": "up" } } } # Shutdown the server remotely curl http://localhost:8380/health/kill ``` -------------------------------- ### C++ Terrain Map Tile Header Structure Source: https://github.com/flybywiresim/simbridge/blob/main/apps/server/src/terrain/README.md Defines the structure for the header of each individual tile within the terrain map. This includes tile dimensions, location, and the size of its elevation data. ```c++ struct TileHeader { std::uint16_t pixels_per_row; std::uint16_t pixels_per_column; std::int8_t southwest_latitude; std::int16_t southwest_longitude; std::uint32_t elevationmap_byte_count; } ``` -------------------------------- ### C++ Terrain Map File Header Structure Source: https://github.com/flybywiresim/simbridge/blob/main/apps/server/src/terrain/README.md Defines the structure for the file header of the internal terrain map format. This header contains global information about the map, such as latitude and longitude ranges, angular steps, and horizontal resolution. ```c++ struct FileHeader { std::int16_t latitude_min; std::int16_t latitude_max; std::int16_t longitude_min; std::int16_t longitude_max; std::uint8_t angular_step_latitude; std::uint8_t angular_step_longitude; float horizontal_resolution; } ``` -------------------------------- ### Health Check Endpoint Source: https://context7.com/flybywiresim/simbridge/llms.txt Monitors the health status of SimBridge services, including the MCDU interface and API availability. Can also be used to remotely shut down the server. ```APIDOC ## GET /health ### Description Monitors the health status of SimBridge services. ### Method GET ### Endpoint /health ### Parameters None ### Request Example ```bash curl http://localhost:8380/health ``` ### Response #### Success Response (200) - **status** (string) - Overall service status. - **info** (object) - Detailed status of individual services. - **mcdu** (object) - **status** (string) - Status of the MCDU interface. - **api** (object) - **status** (string) - Status of the API. #### Response Example ```json { "status": "ok", "info": { "mcdu": { "status": "up" }, "api": { "status": "up" } } } ``` ## POST /health/kill ### Description Shuts down the SimBridge server remotely. ### Method POST ### Endpoint /health/kill ### Parameters None ### Request Example ```bash curl http://localhost:8380/health/kill ``` ### Response #### Success Response (200) No specific response body is detailed, typically indicates successful shutdown. #### Response Example (No response body example provided) ``` -------------------------------- ### C++ MSFS SimConnect Aircraft Status Structure Source: https://github.com/flybywiresim/simbridge/blob/main/apps/server/src/terrain/README.md Defines the structure used for communication between MSFS and FBW SimBridge via SimConnect. This structure carries essential aircraft and navigation data for terrain map rendering and simulation. ```c++ struct EgpwcAircraftStatus { std::uint8_t adiru_data_valid; float adiru_latitude; float adiru_longitude; std::int32_t adiru_altitude; std::int16_t adiru_heading; std::int16_t adiru_vertical_speed; std::uint8_t gear_is_down; std::uint8_t destination_data_valid; float destination_latitude; float destination_longitude; std::uint16_t navigation_display_capt_range; std::uint8_t navigation_display_capt_arc_mode; std::uint8_t navigation_display_capt_terr_on_nd_active; std::uint16_t navigation_display_fo_range; std::uint8_t navigation_display_fo_arc_mode; std::uint8_t navigation_display_fo_terr_on_nd_active; std::uint8_t navigation_display_rendering_mode; float ground_truth_latitude; float ground_truth_longitude; } ``` -------------------------------- ### Color Representation in Hexadecimal (Little-Endian) Source: https://github.com/flybywiresim/simbridge/blob/main/tools/a380_scanpattern_texture.ipynb This code snippet represents a color value in hexadecimal format, likely for an RGBA color. It follows a little-endian byte order, where the least significant byte represents blue, followed by green, red, and then alpha. ```text 4 << 24 | 4 << 16 | 5 << 8 | 255 ``` -------------------------------- ### Color Representation in Hexadecimal (Big-Endian) Source: https://github.com/flybywiresim/simbridge/blob/main/tools/a380_scanpattern_texture.ipynb This code snippet represents a color value in hexadecimal format, likely for an RGBA color. It follows a big-endian byte order, where the most significant byte represents alpha, followed by red, green, and then blue. ```text 255 << 24 | 5 << 16 | 4 << 8 | 4 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.