Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

LO-MAC .lua data export to Epic USB

Featured Replies

Hello there,I'm using an Epic USB Card for my Simpit,and want to communicate with Lock On.Unfortunately I'm not a Programmer, but trying to learn it.Can anyone of you give me some Tips to send the Data (Warnings, Lights aso) of Lomac's .Lua script to Epic's Qprocs and/or Pigeon Holes?I'll be grateful for every kind of Help.Thank you in advance,My best regardsDaniel

Daniel,This is a little dated, but may provide a bit of Epic help: http://www.avsim.com/bluesideup/ Mikewww.mikesflightdeck.comwww.mikesflightdeckbooks.com

Thank you Mike,but Bluesideup is not exactly I'm searching for.I got this .Lua Script, I think everyone who uses Lomac nows it:

[p align=left][font color=#CC2C2C" size="1" face="Verdana]function LuaExportStart()		dofile "lua.lua"	socket = require("socket")	con = socket.try(socket.udp())	--con:settimeout(10)	socket.try(con:setpeername("192.168.0.14",6060))        --con:settimeout(10)	socket.try(con:setpeername("192.168.0.14",6061))  	endfunction LuaExportAfterNextFrame()	_asl = LoGetAltitudeAboveSeaLevel()	_agl = LoGetAltitudeAboveGroundLevel()	_mbr = LoGetBasicAtmospherePressure()	_vvi = LoGetVerticalVelocity()	_aoa = LoGetAngleOfAttack()	_bal = LoGetSlipBallPosition()	_pit,_bnk,_yaw = LoGetADIPitchBankYaw()	_rpi = LoGetNavigationInfo().Requirements.pitch	_rbk = LoGetNavigationInfo().Requirements.roll	_mch = LoGetMachNumber()	_ias = LoGetIndicatedAirSpeed()	_tas = LoGetTrueAirSpeed()	_ras = LoGetNavigationInfo().Requirements.speed	_glo = LoGetAccelerationUnits()	_noz = 0	_tki = LoGetEngineInfo().fuel_internal	_tke = LoGetEngineInfo().fuel_external	_flw = 0	_rpl = LoGetEngineInfo().RPM.left	_rpr = LoGetEngineInfo().RPM.right	_egl = LoGetEngineInfo().Temperature.left	_egr = LoGetEngineInfo().Temperature.right	_lnd = 0	_brk = 0	_epu = 0	_oil = 0	_chf = 01	_flr = 0	_loc = LoGetSideDeviation()	_gds = LoGetGlideDeviation()	_crs = 0	_rmi = LoGetControlPanel_HSI().RMI	_dis = 0	_bea = LoGetControlPanel_HSI().ADF	--_hdg = LoGetControlPanel_HSI().Compass	_ded = 0	_mod = LoGetNavigationInfo().SystemMode.master	_sub = LoGetNavigationInfo().SystemMode.submode	_acs = LoGetNavigationInfo().ACS.mode	--Su25 export, remember set in config.lua, EnableExportScript = true	for k,v in pairs(LoGetWorldObjects()) do	if string.find(v.Name, "(Me)", 1, true) then	_lat = v.LatLongAlt.Lat	_lon = v.LatLongAlt.Long	_hdg = v.Heading	end	end	socket.try(con:send(string.format("src=export.lua;asl=%f;agl=%f;mbr=%f;vvi=%f;aoa=%f;bal=%f;pit=%f;bnk=%f;yaw=%f;rpi=%f;rbk=%f;mch=%f;ias=%f;tas=%f;ras=%f;glo=%f;noz=%f;tki=%f;tke=%f;flw=%f;rpl=%f;rpr=%f;egl=%f;egr=%f;lnd=%f;brk=%f;epu=%f;oil=%f;chf=%f;flr=%f;loc=%f;gds=%f;crs=%f;rmi=%f;dis=%f;bea=%f;hdg=%f;ded=%f;mod=%s;sub=%s;acs=%srn",_asl,_agl,_mbr,_vvi,_aoa,_bal,_pit,_bnk,_yaw,_rpi,_rbk,_mch,_ias,_tas,_ras,_glo,_noz,_tki,_tke,_flw,_rpl,_rpr,_egl,_egr,_lnd,_brk,_epu,_oil,_chf,_flr,_loc,_gds,_crs,_rmi,_dis,_bea,_hdg,_ded,_mod,_sub,_acs)))endfunction LuaExportStop()	socket.try(con:close())end[/font][/p][html] This Script sends the Data to Winsock I think... I want this Data is send to Following C++ Program (Epic SDK excerpt):[html][p align=left][font color=#CC2C2C" size="1" face="Verdana]// example.cpp : Defines the class behaviors for the application.//#include "stdafx.h"#include "example.h"#include "exampleDlg.h"#include "EPICIO.HPP"#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE[] = __FILE__;#endifchar scrapBuffer[128];extern int handle,epicDevice;/////////////////////////////////////////////////////////////////////////////// CExampleAppBEGIN_MESSAGE_MAP(CExampleApp, CWinApp)	//{{AFX_MSG_MAP(CExampleApp)		// NOTE - the ClassWizard will add and remove mapping macros here.		//    DO NOT EDIT what you see in these blocks of generated code!	//}}AFX_MSG	ON_COMMAND(ID_HELP, CWinApp::OnHelp)END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////// CExampleApp constructionCExampleApp::CExampleApp(){	// TODO: add construction code here,	// Place all significant initialization in InitInstance}/////////////////////////////////////////////////////////////////////////////// The one and only CExampleApp objectCExampleApp theApp;/////////////////////////////////////////////////////////////////////////////// CExampleApp initializationBOOL CExampleApp::InitInstance(){	AfxEnableControlContainer(); 		if(epicDevice != -1) _CloseDevice(handle);		epicDevice = 1;		 //0=EPICISA 1=EPICUSB0 2=EPICUSB1,etc		if((handle = _OpenDevice(1)) < 0)		{			AfxMessageBox("Error opening EPICUSB0");			epicDevice = -1;		}	// Standard initialization	// If you are not using these features and wish to reduce the size	//  of your final executable, you should remove from the following	//  the specific initialization routines you do not need.#ifdef _AFXDLL	Enable3dControls();			// Call this when using MFC in a shared DLL#else	Enable3dControlsStatic();	// Call this when linking to MFC statically#endif	CExampleDlg dlg;	m_pMainWnd = &dlg;	int nResponse = dlg.DoModal();	if (nResponse == IDOK)	{		// TODO: Place code here to handle when the dialog is		//  dismissed with OK	}	else if (nResponse == IDCANCEL)	{		// TODO: Place code here to handle when the dialog is		//  dismissed with Cancel	}	// Since the dialog has been closed, return FALSE so that we exit the	//  application, rather than start the application's message pump.	return FALSE; // exampleDlg.cpp : implementation file//#include "stdafx.h"#include "example.h"#include "exampleDlg.h"#include "EPICIO.HPP"#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE[] = __FILE__;#endif	int		handle,epicDevice;	UCHAR analogs[64];	void CALLBACK CheckEPIC(HWND hwnd,   //handle of window for timer messages                           UINT uMsg,   //WM_TIMER message                           UINT idEvent, //timer identifier                           DWORD dwTime     //current system time                           );	void CALLBACK PollEPIC(HWND hwnd,   //handle of window for timer messages                           UINT uMsg,   //WM_TIMER message                           UINT idEvent, //timer identifier                           DWORD dwTime     //current system time                           );	CExampleDlg *exDlg;				/////////////////////////////////////////////////////////////////////////////// CAboutDlg dialog used for App Aboutclass CAboutDlg : public CDialog{public:	CAboutDlg();// Dialog Data	//{{AFX_DATA(CAboutDlg)	enum { IDD = IDD_ABOUTBOX };	//}}AFX_DATA	// ClassWizard generated virtual function overrides	//{{AFX_VIRTUAL(CAboutDlg)	protected:	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support	//}}AFX_VIRTUAL// Implementationprotected:	//{{AFX_MSG(CAboutDlg)	//}}AFX_MSG	DECLARE_MESSAGE_MAP()};CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD){	//{{AFX_DATA_INIT(CAboutDlg)	//}}AFX_DATA_INIT}void CAboutDlg::DoDataExchange(CDataExchange* pDX){	CDialog::DoDataExchange(pDX);	//{{AFX_DATA_MAP(CAboutDlg)	//}}AFX_DATA_MAP}BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)	//{{AFX_MSG_MAP(CAboutDlg)		// No message handlers	//}}AFX_MSG_MAPEND_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////// CExampleDlg dialogCExampleDlg::CExampleDlg(CWnd* pParent /*=NULL*/)	: CDialog(CExampleDlg::IDD, pParent){	//{{AFX_DATA_INIT(CExampleDlg)	m_Edit = _T("");	//}}AFX_DATA_INIT	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);}void CExampleDlg::DoDataExchange(CDataExchange* pDX){	CDialog::DoDataExchange(pDX);	//{{AFX_DATA_MAP(CExampleDlg)	DDX_Control(pDX, IDC_SLIDER2, m_AnalogSlider);	DDX_Text(pDX, IDC_EDIT1, m_Edit);	//}}AFX_DATA_MAP}BEGIN_MESSAGE_MAP(CExampleDlg, CDialog)	//{{AFX_MSG_MAP(CExampleDlg)	ON_WM_SYSCOMMAND()	ON_WM_PAINT()	ON_WM_QUERYDRAGICON()	ON_BN_CLICKED(IDC_SEND_PH, OnSendPh)	ON_BN_CLICKED(IDC_SEND_QP, OnSendQp)	ON_WM_CLOSE()	//}}AFX_MSG_MAPEND_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////// CExampleDlg message handlersBOOL CExampleDlg::OnInitDialog(){	CDialog::OnInitDialog();   exDlg = this;   StartTimers();	// Add "About..." menu item to system menu.	// IDM_ABOUTBOX must be in the system command range.	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);	ASSERT(IDM_ABOUTBOX < 0xF000);	CMenu* pSysMenu = GetSystemMenu(FALSE);	if (pSysMenu != NULL)	{		CString strAboutMenu;		strAboutMenu.LoadString(IDS_ABOUTBOX);		if (!strAboutMenu.IsEmpty())		{			pSysMenu->AppendMenu(MF_SEPARATOR);			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);		}	}	// Set the icon for this dialog.  The framework does this automatically	//  when the application's main window is not a dialog	SetIcon(m_hIcon, TRUE);			// Set big icon	SetIcon(m_hIcon, FALSE);		// Set small icon		// TODO: Add extra initialization here		return TRUE;  // return TRUE  unless you set the focus to a control}void CExampleDlg::OnSysCommand(UINT nID, LPARAM lParam){	if ((nID & 0xFFF0) == IDM_ABOUTBOX)	{		CAboutDlg dlgAbout;		dlgAbout.DoModal();	}	else	{		CDialog::OnSysCommand(nID, lParam);	}}// If you add a minimize button to your dialog, you will need the code below//  to draw the icon.  For MFC applications using the document/view model,//  this is automatically done for you by the framework.void CExampleDlg::OnPaint() {	if (IsIconic())	{		CPaintDC dc(this); // device context for painting		SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);		// Center icon in client rectangle		int cxIcon = GetSystemMetrics(SM_CXICON);		int cyIcon = GetSystemMetrics(SM_CYICON);		CRect rect;		GetClientRect(&rect);		int x = (rect.Width() - cxIcon + 1) / 2;		int y = (rect.Height() - cyIcon + 1) / 2;		// Draw the icon		dc.DrawIcon(x, y, m_hIcon);	}	else	{		CDialog::OnPaint();	}}// The system calls this to obtain the cursor to display while the user drags//  the minimized window.HCURSOR CExampleDlg::OnQueryDragIcon(){	return (HCURSOR) m_hIcon;}//******************** EPICUSB functionsCExampleDlg::StartTimers(){	timer1ID = SetTimer(75,55,CheckEPIC);			//to get analogs and check events	//uncomment the following line if the DLL data exchange timer is being stopped 	//this seems to happen only with FS2000 as far as I know.//	timer2ID = SetTimer(65,50,PollEPIC);			//to exchange data with EPICUSB }//Give DLL a heartbeat//Get analogs to DLL and exchange queue buffersvoid CALLBACK PollEPIC(						   HWND hwnd,   //handle of window for timer messages                           UINT uMsg,   //WM_TIMER message                           UINT idEvent, //timer identifier                           DWORD dwTime     //current system time                           ){	_GetData(handle);}// SendPH and SendQP will be sent when the timer executes PollEPICUSB//	Which will get the analogs from EPICUSB and move to the DLL buffer.//   and exchange input and output queue events.//   See TEST.EPL for handling of the PH's and QP.void CExampleDlg::OnSendPh() {  _SendPH(handle,10,1,2,3,4);  _SendPHint(handle,11,0x5678,0);    }void CExampleDlg::OnSendQp() {   _SendQP(handle,25);	}void CALLBACK CheckEPIC(							HWND hwnd,   //handle of window for timer messages                           UINT uMsg,   //WM_TIMER message                           UINT idEvent, //timer identifier                           DWORD dwTime     //current system time                           ){	EPIC_EVENT_STRUCT event;	 char scrapBuffer[32];	_GetAnalogs(handle,analogs);	exDlg->m_AnalogSlider.SetValue(analogs[0]);	while(_GetEvent(handle,&event) != -1)	{ 	 sprintf(scrapBuffer,"cmd = %2.2Xh,subCmd = %2.2Xh,data= %4.4Xh",event.cmd,		 event.data[0],event.data[1] + (256 * event.data[2]));	 exDlg->m_Edit = scrapBuffer;	 exDlg->UpdateData(FALSE);	  switch (event.cmd)	  {	  case	EVENT16_0 :				//NQW(0-255,data16)						break;	  case	EVENT16_1 :				//NQW(256-511,data16)						break;	  case	EVENT16_2 :				//NQW(512-767,data16)						break;	  case	EVENT16_3 :				//NQW(768-1023,data16)						break;	  case	EVENT_ON  :				//ENQUE(0-255,on)						break;	  case  EVENT_OFF :				//ENQUE(0-255,off)						break;	  default :			//Unhandled event					    break;		  }	};}void CExampleDlg::OnClose() {	// TODO: Add your message handler code here and/or call default	if(timer1ID != -1) KillTimer(timer1ID);	if(timer2ID != -1) KillTimer(timer2ID);	timer1ID = timer2ID = -1;	CDialog::OnClose();}[/font][/p][html]Sorry for Spamming....This C code is an example of the Epic SDK.I read on some Websides about reading out Falcons shared Memory, and everyone(who made it) just said how easy it is... is it such more complex to get this data from Winsock instead a Shared mem File like F4?For me this Example is not really plausible.PS: Mike your work is really amazing, I've read your Page a few Month ago. Great Job!Thank you and best regardsDaniel

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.