|
@@ -7,7 +7,7 @@
|
|
|
|
|
|
void MainWindow::LoadAPI()
|
|
|
{
|
|
|
- std::cout<<"Load Excel API"<<std::endl;
|
|
|
+ std::cout<<"Load Logi g29 API"<<std::endl;
|
|
|
QLibrary xlib("./LogitechSteeringWheelEnginesWrapper.dll");
|
|
|
if(!xlib.load())
|
|
|
{
|
|
@@ -25,6 +25,33 @@ void MainWindow::LoadAPI()
|
|
|
{
|
|
|
std::cout<<" Load API Successfully. "<<std::endl;
|
|
|
}
|
|
|
+
|
|
|
+ LogiSteeringInitialize =(LogiSteeringInitializeFunction)xlib.resolve("LogiSteeringInitialize");
|
|
|
+ LogiIsConnected =(LogiIsConnectedFunction)xlib.resolve("LogiIsConnected");
|
|
|
+ LogiGetState =(LogiGetStateFunction)xlib.resolve("LogiGetState");
|
|
|
+ LogiSteeringShutdown =(LogiSteeringShutdownFunction)xlib.resolve("LogiSteeringShutdown");
|
|
|
+
|
|
|
+ if((LogiSteeringInitialize == NULL)||(LogiIsConnected == NULL)||(LogiGetState == NULL)||(LogiSteeringShutdown == NULL))
|
|
|
+ {
|
|
|
+ std::cout<<" no this apiS."<<std::endl;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ std::cout<<" Load All API Successfully. "<<std::endl;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+int MainWindow::GetWheelAccBrake(double & angle,double & acc, double & brake)
|
|
|
+{
|
|
|
+ if((LogiUpdate())&&(LogiIsConnected(1)))
|
|
|
+ {
|
|
|
+ DIJOYSTATE2* wheel = LogiGetState(1);
|
|
|
+ angle = wheel->lX;
|
|
|
+ acc = wheel->lY;
|
|
|
+ brake = wheel->lRz;
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ return -1;
|
|
|
}
|
|
|
|
|
|
MainWindow::MainWindow(QWidget *parent)
|
|
@@ -34,6 +61,8 @@ MainWindow::MainWindow(QWidget *parent)
|
|
|
ui->setupUi(this);
|
|
|
|
|
|
LoadAPI();
|
|
|
+
|
|
|
+ LogiSteeringInitialize(true);
|
|
|
}
|
|
|
|
|
|
MainWindow::~MainWindow()
|