Jump to content
The simFlight Network Forums

Alp

Members
  • Posts

    11
  • Joined

  • Last visited

Posts posted by Alp

  1. Hello,

    I need a information about how can i detect current airport?

    I am coding a acars system and i want to detect pilot's landed airport icao. If i detect pilot's current airport, thats perfect. If it is not possible i can search nearest airports and i think closest airport is the pilot's location. 2 approaches is ok for me but i dont know how can i do these. Any body can help me?

    Regards

  2. Hello,

    I'm using FSUIPC web socket for my web project but i could not got a latitude longitude information via 0568 and 0560 offsets. I'm getting nonsensical numbers. Can you help me please. My javascript code is under the below.

     

    var cmdoffsetsread = new function () {
    
        var ws = null; // WebSocket
    
        this.start = function() {
        };
    
        this.stop = function () {
            if (ws) {
                ws.close();
            }
        };
    
        var clearMessages = function () {
            document.getElementById("connectionStatus").innerText = ws ? "Connection Open" : "Connection Closed";
        };
    
        this.openConnection = function () {
            if (!ws) {
                clearMessages();
                var serverURL = document.getElementById("serverURL").value;
                ws = new WebSocket(serverURL, "fsuipc");
    
                ws.onopen = function () {
                    document.getElementById("connectionStatus").innerText = "Connection Open";
    				cmdoffsetsread.send_main_offsets();
    				cmdoffsetsread.send_main_read_request();
    				
    				
                };
    
                ws.onclose = function () {
    				cmdoffsetsread.send_stop_request();
                    document.getElementById("connectionStatus").innerText = "Connection Closed";
                    
                    ws = null;
                };
    
                ws.onerror = function () {
                    document.getElementById("connectionStatus").innerText = "WebSocket Error";
                };
    
                ws.onmessage = function (msg) {
                    
                    var response = JSON.parse(msg.data);
    
                    
                    if (response.success) {
                        
                        switch (response.command) {
                            case 'offsets.declare':
                                document.getElementById('connectionStatus').innerText = 'All settings loaded and instructor panel started';
                                break;
                            case "offsets.stop":
                                document.getElementById('connectionStatus').innerText = 'Updates for "' + response.name + '" have been stopped';
                                break;
                            case 'offsets.read':
                                switch (response.name) {
                                    case 'allSettingsOffsets':
                                        showOffsetValues(response);
                                        break;
                                }
                                break;
                            default:
                                
                                document.getElementById('connectionStatus').innerText = 'Unknown command: ' + response.command;
                                break;
                        }
                    }
                    else {
                        
                        var error = 'Error for ' + response.name + ' (' + response.command + '): ';
                        error += response.errorCode + " - " + response.connectionStatus;
                        document.getElementById("connectionStatus").innerText = error;
                    }
                };
            }
        }
    
        var showOffsetValues = function (response) {
    		
    		//VARIABLES
    		var playerLon = (((response.data.playerLon / 10001750) / 65536.0) / 65536.0) * 90.0;
    		
            // longitude
            document.getElementById("latitude_longitude").value = playerLon;
        }
    	
        this.send_main_offsets = function () {
    
            clearMessages();
           
            var request = {
                command: 'offsets.declare',
                name: 'allSettingsOffsets',
                offsets: [
                    { name: 'playerLon', address: 0x0568, type: 'uint', size: 8 }
                ]
            }
    
            
            if (ws) {
                ws.send(JSON.stringify(request));
            }
    
        }
    
        this.send_main_read_request = function () {
    
            clearMessages();
            
            
            var request = {
                command: 'offsets.read',
                name: 'allSettingsOffsets',
                interval: 100 
            }
    
            
            if (ws) {
                ws.send(JSON.stringify(request));
            }
    
        }
    
        this.send_stop_request = function () {
    
            clearMessages();
            
            var request = {
                command: 'offsets.stop',
                name: 'allSettingsOffsets'
            }
    
           
            if (ws) {
                ws.send(JSON.stringify(request));
            }
    
        }
    
        this.closeConnection = function () {
            if (ws) {
    
                clearMessages();
    
                ws.close();
                
            }
        }
    
    };

     

     

  3. Hello,

    When i tried to use 0020 offset with this code;

    Private agl As New Offset(Of UInteger)(&H20)
    aglStatus.Text = agl.Value()

    i am getting a constant number like a 12719. And this number did not changing (when airplane is flying)

     

    When i tried to use 0B4C offset with this code;

    Private agl As New Offset(Of UInteger)(&HB4C)
    aglStatus.Text = agl.Value()

    i am getting a constant number like a 49. And this number did not changing (when airplane is flying)

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.