Skip to content

Commit

Permalink
WIP for Tello Connect button
Browse files Browse the repository at this point in the history
  • Loading branch information
erinharrington-12 committed Apr 2, 2024
1 parent df4f9c9 commit 8693907
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 6 deletions.
2 changes: 1 addition & 1 deletion include/botui/TelloWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Q_OBJECT
~TelloWidget();

private slots:

int telloConnect();

private:
Ui::TelloWidget *ui;
Expand Down
47 changes: 42 additions & 5 deletions src/TelloWidget.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#include "TelloWidget.h"
#include "ui_TelloWidget.h"
#include "Create3SensorListWidget.h"
#include "Create3ExampleWidget.h"
#include "Create3SensorModel.h"
#include <kipr/create3/client/client.h>
#include <unistd.h>
#include "NumpadDialog.h"
#include <QDebug>
Expand All @@ -17,7 +13,7 @@
#include <QPainter>
#include <QItemDelegate>
#include "RootController.h"

#include <kipr/tello/tello.h>

TelloWidget::TelloWidget(Device *device, QWidget *parent)
: StandardWidget(device, parent),
Expand All @@ -26,11 +22,52 @@ TelloWidget::TelloWidget(Device *device, QWidget *parent)
ui->setupUi(this);
performStandardSetup(tr("Tello"), false);
setStyleSheet("QScrollBar:vertical {border: 2px solid grey;background:grey ;width: 100px; margin: 22px 0 22px 0; } QScrollBar::handle:vertical { border: 2px solid grey;background: white; min-height: 20px; } QScrollBar::add-line:vertical { border: 2px solid grey;background: #32CC99; height: 20px; subcontrol-position: bottom; subcontrol-origin: margin; } QScrollBar::sub-line:vertical {border: 2px solid grey; background: #32CC99; height: 20px; subcontrol-position: top; subcontrol-origin: margin; } QScrollBar::up-arrow:vertical, QScrollBar::down-arrow:vertical { border: 2px solid grey;width: 3px; height: 3px; background: white; }QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {border: 2px solid grey; background: none;}");
connect(ui->TelloConnect, SIGNAL(clicked()), SLOT(telloConnect()));


}

TelloWidget::~TelloWidget()
{
delete ui;
}

int TelloWidget::telloConnect()
{

int result;
char buf[TELLO_BUFSIZE];
int len;
int n;
struct tello_ssid *tellos;
struct tello_info tello;
int send_result;


if (wpa_sup_connect() == -1)
{
qDebug() << "failed to open wpa_supplicant\n";

return -1;
}
else
qDebug() << "wpa_supplicant opened\n";

tellos = tellos_find();

n = 0;
qDebug() << "List of Tellos\n";

while (tellos[n].ssid[0] != '\0')
{
qDebug() << "Tellos: %s\n"
<< tellos[n].ssid;
// printf("Tellos: %s\n", tellos[n].ssid);
n++;
}
fflush(NULL);

// for this example select only the first Tello in the list

tello_connect(&tello, tellos[0].ssid);
}

0 comments on commit 8693907

Please sign in to comment.