aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorMichal Labedzki <michal.labedzki@tieto.com>2015-05-13 17:33:28 +0200
committerMichal Labedzki <michal.labedzki@tieto.com>2015-06-15 05:40:25 +0000
commit7102a06811ab63e0433ac91ad242e02c5668d259 (patch)
tree128482bd4b38cb6d4f56344261d94ea76db1c7e1 /ui
parent9fb6ec6c89631f2fbb5228d8f81a727f6d1fee27 (diff)
Qt/Bluetooth: Add Devices dialogue
Please found it under Bluetooth menu. It shows all devices found in logs, not only connected, all that its address can be found in logs. Show if device is local (in most cases: capturing on it side) and manufacturer and LMP version what should answer the question what version of Bluetooth is used by Bluetooth device chip. Also firmware version. Change-Id: I32e3b7100cdebcaa850b6541de0ab89dff41c0e1 Reviewed-on: https://code.wireshark.org/review/8901 Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Tested-by: Michal Labedzki <michal.labedzki@tieto.com> Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/CMakeLists.txt3
-rw-r--r--ui/qt/Makefile.am2
-rw-r--r--ui/qt/Makefile.common4
-rw-r--r--ui/qt/Wireshark.pro3
-rw-r--r--ui/qt/bluetooth_devices_dialog.cpp412
-rw-r--r--ui/qt/bluetooth_devices_dialog.h105
-rw-r--r--ui/qt/bluetooth_devices_dialog.ui210
-rw-r--r--ui/qt/main_window.h1
-rw-r--r--ui/qt/main_window.ui6
-rw-r--r--ui/qt/main_window_slots.cpp11
10 files changed, 757 insertions, 0 deletions
diff --git a/ui/qt/CMakeLists.txt b/ui/qt/CMakeLists.txt
index 8a534b9bca..712c02e250 100644
--- a/ui/qt/CMakeLists.txt
+++ b/ui/qt/CMakeLists.txt
@@ -24,6 +24,7 @@
set(WIRESHARK_QT_HEADERS
about_dialog.h
bluetooth_att_server_attributes_dialog.h
+ bluetooth_devices_dialog.h
accordion_frame.h
byte_view_tab.h
byte_view_text.h
@@ -142,6 +143,7 @@ set(WIRESHARK_QT_SRC
about_dialog.cpp
accordion_frame.cpp
bluetooth_att_server_attributes_dialog.cpp
+ bluetooth_devices_dialog.cpp
byte_view_tab.cpp
byte_view_text.cpp
capture_file.cpp
@@ -263,6 +265,7 @@ set(WIRESHARK_QT_FILES
set(WIRESHARK_QT_UI
about_dialog.ui
bluetooth_att_server_attributes_dialog.ui
+ bluetooth_devices_dialog.ui
capture_file_properties_dialog.ui
capture_interfaces_dialog.ui
capture_preferences_frame.ui
diff --git a/ui/qt/Makefile.am b/ui/qt/Makefile.am
index a0e2bc7055..1205b77f79 100644
--- a/ui/qt/Makefile.am
+++ b/ui/qt/Makefile.am
@@ -124,6 +124,8 @@ about_dialog.cpp about_dialog.h: ui_about_dialog.h
bluetooth_att_server_attributes_dialog.cpp bluetooth_att_server_attributes_dialog.h: ui_bluetooth_att_server_attributes_dialog.h
+bluetooth_devices_dialog.cpp bluetooth_devices_dialog.h: ui_bluetooth_devices_dialog.h
+
capture_file_properties_dialog.cpp capture_file_properties_dialog.h: ui_capture_file_properties_dialog.h
capture_interfaces_dialog.cpp capture_interfaces_dialog.h: ui_capture_interfaces_dialog.h
diff --git a/ui/qt/Makefile.common b/ui/qt/Makefile.common
index a0396784a9..ac1335bf53 100644
--- a/ui/qt/Makefile.common
+++ b/ui/qt/Makefile.common
@@ -31,6 +31,7 @@ GENERATED_HEADER_FILES =
NODIST_GENERATED_HEADER_FILES = \
ui_about_dialog.h \
ui_bluetooth_att_server_attributes_dialog.h \
+ ui_bluetooth_devices_dialog.h \
ui_capture_file_properties_dialog.h \
ui_capture_interfaces_dialog.h \
ui_capture_preferences_frame.h \
@@ -125,6 +126,7 @@ MOC_HDRS = \
about_dialog.h \
accordion_frame.h \
bluetooth_att_server_attributes_dialog.h \
+ bluetooth_devices_dialog.h \
byte_view_tab.h \
byte_view_text.h \
capture_file.h \
@@ -225,6 +227,7 @@ MOC_HDRS = \
UI_FILES = \
about_dialog.ui \
bluetooth_att_server_attributes_dialog.ui \
+ bluetooth_devices_dialog.ui \
capture_file_properties_dialog.ui \
capture_interfaces_dialog.ui \
capture_preferences_frame.ui \
@@ -335,6 +338,7 @@ WIRESHARK_QT_SRC = \
about_dialog.cpp \
accordion_frame.cpp \
bluetooth_att_server_attributes_dialog.cpp \
+ bluetooth_devices_dialog.cpp \
byte_view_tab.cpp \
byte_view_text.cpp \
capture_file.cpp \
diff --git a/ui/qt/Wireshark.pro b/ui/qt/Wireshark.pro
index 4267e98601..9da9457968 100644
--- a/ui/qt/Wireshark.pro
+++ b/ui/qt/Wireshark.pro
@@ -207,6 +207,7 @@ HEADERS_WS_C = \
FORMS += \
about_dialog.ui \
bluetooth_att_server_attributes_dialog.ui \
+ bluetooth_devices_dialog.ui \
capture_file_properties_dialog.ui \
capture_interfaces_dialog.ui \
capture_preferences_frame.ui \
@@ -269,6 +270,7 @@ HEADERS += $$HEADERS_WS_C \
about_dialog.h \
accordion_frame.h \
bluetooth_att_server_attributes_dialog.h \
+ bluetooth_devices_dialog.h \
capture_file_properties_dialog.h \
capture_interfaces_dialog.h \
capture_preferences_frame.h \
@@ -613,6 +615,7 @@ SOURCES += \
about_dialog.cpp \
accordion_frame.cpp \
bluetooth_att_server_attributes_dialog.cpp \
+ bluetooth_devices_dialog.cpp \
byte_view_tab.cpp \
byte_view_text.cpp \
capture_file.cpp \
diff --git a/ui/qt/bluetooth_devices_dialog.cpp b/ui/qt/bluetooth_devices_dialog.cpp
new file mode 100644
index 0000000000..73efe791bb
--- /dev/null
+++ b/ui/qt/bluetooth_devices_dialog.cpp
@@ -0,0 +1,412 @@
+/* bluetooth_devices_dialog.cpp
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "bluetooth_devices_dialog.h"
+#include "ui_bluetooth_devices_dialog.h"
+
+#include "epan/epan.h"
+#include "epan/addr_resolv.h"
+#include "epan/to_str.h"
+#include "epan/epan_dissect.h"
+#include "epan/dissectors/packet-bluetooth.h"
+#include "epan/dissectors/packet-bthci_evt.h"
+
+#include "ui/simple_dialog.h"
+
+#include <QClipboard>
+#include <QContextMenuEvent>
+#include <QPushButton>
+#include <QTreeWidget>
+#include <QFileDialog>
+
+static const int column_number_bd_addr = 0;
+static const int column_number_bd_addr_oui = 1;
+static const int column_number_name = 2;
+static const int column_number_lmp_version = 3;
+static const int column_number_lmp_subversion = 4;
+static const int column_number_manufacturer = 5;
+static const int column_number_hci_version = 6;
+static const int column_number_hci_revision = 7;
+static const int column_number_is_local_adapter = 8;
+
+typedef struct _item_data_t {
+ guint32 interface_id;
+ guint32 adapter_id;
+ guint32 frame_number;
+} item_data_t;
+
+Q_DECLARE_METATYPE(item_data_t *)
+
+static gboolean
+bluetooth_device_tap_packet(void *tapinfo_ptr, packet_info *pinfo, epan_dissect_t *edt, const void* data)
+{
+ bluetooth_devices_tapinfo_t *tapinfo = (bluetooth_devices_tapinfo_t *) tapinfo_ptr;
+
+ if (tapinfo->tap_packet)
+ tapinfo->tap_packet(tapinfo, pinfo, edt, data);
+
+ return TRUE;
+}
+
+static void
+bluetooth_device_tap_reset(void *tapinfo_ptr)
+{
+ bluetooth_devices_tapinfo_t *tapinfo = (bluetooth_devices_tapinfo_t *) tapinfo_ptr;
+
+ if (tapinfo->tap_reset)
+ tapinfo->tap_reset(tapinfo);
+}
+
+
+static void
+bluetooth_devices_tap(void *data)
+{
+ GString *error_string;
+
+ error_string = register_tap_listener("bluetooth.device", data, NULL,
+ 0,
+ bluetooth_device_tap_reset,
+ bluetooth_device_tap_packet,
+ NULL
+ );
+
+ if (error_string != NULL) {
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
+ "%s", error_string->str);
+ g_string_free(error_string, TRUE);
+ }
+}
+
+
+BluetoothDevicesDialog::BluetoothDevicesDialog(QWidget &parent, CaptureFile &cf) :
+ WiresharkDialog(parent, cf),
+ ui(new Ui::BluetoothDevicesDialog)
+{
+ ui->setupUi(this);
+ resize(parent.width() * 4 / 5, parent.height() * 2 / 3);
+
+ connect(ui->tableTreeWidget, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(tableContextMenu(const QPoint &)));
+ connect(ui->interfaceComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(interfaceCurrentIndexChanged(int)));
+ connect(ui->showInformationStepsCheckBox, SIGNAL(stateChanged(int)), this, SLOT(showInformationStepsChanged(int)));
+
+ ui->tableTreeWidget->sortByColumn(column_number_bd_addr, Qt::AscendingOrder);
+
+ context_menu_.addActions(QList<QAction *>() << ui->actionCopy_Cell);
+ context_menu_.addActions(QList<QAction *>() << ui->actionCopy_Rows);
+ context_menu_.addActions(QList<QAction *>() << ui->actionCopy_All);
+ context_menu_.addActions(QList<QAction *>() << ui->actionSave_as_image);
+
+ tapinfo_.tap_packet = tapPacket;
+ tapinfo_.tap_reset = tapReset;
+ tapinfo_.ui = this;
+
+ bluetooth_devices_tap(&tapinfo_);
+
+ cap_file_.retapPackets();
+}
+
+
+BluetoothDevicesDialog::~BluetoothDevicesDialog()
+{
+ delete ui;
+
+ remove_tap_listener(&tapinfo_);
+}
+
+
+void BluetoothDevicesDialog::captureFileClosing()
+{
+ remove_tap_listener(&tapinfo_);
+
+ ui->interfaceComboBox->setEnabled(FALSE);
+ ui->showInformationStepsCheckBox->setEnabled(FALSE);
+
+ WiresharkDialog::captureFileClosing();
+}
+
+
+void BluetoothDevicesDialog::changeEvent(QEvent *event)
+{
+ if (0 != event)
+ {
+ switch (event->type())
+ {
+ case QEvent::LanguageChange:
+ ui->retranslateUi(this);
+ break;
+ default:
+ break;
+ }
+ }
+ QDialog::changeEvent(event);
+}
+
+
+void BluetoothDevicesDialog::tableContextMenu(const QPoint &pos)
+{
+ context_menu_.exec(ui->tableTreeWidget->viewport()->mapToGlobal(pos));
+}
+
+
+void BluetoothDevicesDialog::on_actionCopy_Cell_triggered()
+{
+ QClipboard *clipboard = QApplication::clipboard();
+ QString copy;
+
+ copy = QString(ui->tableTreeWidget->currentItem()->text(ui->tableTreeWidget->currentColumn()));
+
+ clipboard->setText(copy);
+}
+
+
+void BluetoothDevicesDialog::on_actionCopy_Rows_triggered()
+{
+ QClipboard *clipboard = QApplication::clipboard();
+ QString copy;
+ QList<QTreeWidgetItem *> items;
+ QList<QTreeWidgetItem *>::iterator i_item;
+
+ items = ui->tableTreeWidget->selectedItems();
+
+ for (i_item = items.begin(); i_item != items.end(); ++i_item) {
+ copy += QString("%1 %2 %3 %4 %5 %6 %7 %8 %9\n")
+ .arg((*i_item)->text(column_number_bd_addr), -20)
+ .arg((*i_item)->text(column_number_bd_addr_oui), -20)
+ .arg((*i_item)->text(column_number_name), -30)
+ .arg((*i_item)->text(column_number_lmp_version), -20)
+ .arg((*i_item)->text(column_number_lmp_subversion), -20)
+ .arg((*i_item)->text(column_number_manufacturer), -30)
+ .arg((*i_item)->text(column_number_hci_version), -20)
+ .arg((*i_item)->text(column_number_hci_revision), -20)
+ .arg((*i_item)->text(column_number_is_local_adapter), -20);
+ }
+
+ clipboard->setText(copy);
+}
+
+void BluetoothDevicesDialog::tapReset(void *tapinfo_ptr )
+{
+ bluetooth_devices_tapinfo_t *tapinfo = (bluetooth_devices_tapinfo_t *) tapinfo_ptr;
+ BluetoothDevicesDialog *bluetooth_devices_dialog = static_cast<BluetoothDevicesDialog *>(tapinfo->ui);
+
+
+ bluetooth_devices_dialog->ui->tableTreeWidget->clear();
+}
+
+gboolean BluetoothDevicesDialog::tapPacket(void *tapinfo_ptr, packet_info *pinfo, epan_dissect_t *, const void *data)
+{
+ bluetooth_devices_tapinfo_t *tapinfo = static_cast<bluetooth_devices_tapinfo_t *>(tapinfo_ptr);
+ BluetoothDevicesDialog *dialog = static_cast<BluetoothDevicesDialog *>(tapinfo->ui);
+ bluetooth_device_tap_t *tap_device = static_cast<bluetooth_device_tap_t *>(const_cast<void *>(data));
+ QString bd_addr;
+ QString bd_addr_oui;
+ QString name;
+ const gchar *manuf;
+ QTreeWidgetItem *item = NULL;
+
+ if (pinfo->phdr->presence_flags & WTAP_HAS_INTERFACE_ID) {
+ gchar *interface;
+ const char *interface_name;
+
+ interface_name = epan_get_interface_name(pinfo->epan, pinfo->phdr->interface_id);
+ interface = wmem_strdup_printf(wmem_packet_scope(), "%u: %s", pinfo->phdr->interface_id, interface_name);
+
+ if (dialog->ui->interfaceComboBox->findText(interface) == -1)
+ dialog->ui->interfaceComboBox->addItem(interface);
+
+ if (interface && dialog->ui->interfaceComboBox->currentIndex() > 0) {
+ if (dialog->ui->interfaceComboBox->currentText() != interface)
+ return TRUE;
+ }
+ }
+
+ if (tap_device->has_bd_addr) {
+ bd_addr.sprintf("%02x:%02x:%02x:%02x:%02x:%02x", tap_device->bd_addr[0], tap_device->bd_addr[1], tap_device->bd_addr[2], tap_device->bd_addr[3], tap_device->bd_addr[4], tap_device->bd_addr[5]);
+
+ manuf = get_ether_name(tap_device->bd_addr);
+ if (manuf) {
+ int pos;
+
+ bd_addr_oui = QString(manuf);
+ pos = bd_addr_oui.indexOf('_');
+ if (pos < 0) {
+ manuf = NULL;
+ } else {
+ bd_addr_oui.remove(pos, bd_addr_oui.size());
+ }
+ }
+
+ if (!manuf)
+ bd_addr_oui = "";
+ }
+
+ if (dialog->ui->showInformationStepsCheckBox->checkState() != Qt::Checked) {
+ QTreeWidgetItemIterator i_item(dialog->ui->tableTreeWidget);
+
+ while (*i_item) {
+ QTreeWidgetItem *current_item = static_cast<QTreeWidgetItem*>(*i_item);
+ item_data_t *item_data = current_item->data(0, Qt::UserRole).value<item_data_t *>();
+
+ if ((tap_device->has_bd_addr && current_item->text(column_number_bd_addr) == bd_addr) ||
+ (tap_device->is_local &&
+ item_data->interface_id == tap_device->interface_id &&
+ item_data->adapter_id == tap_device->adapter_id &&
+ !current_item->text(column_number_is_local_adapter).isEmpty())) {
+ item = current_item;
+ break;
+ }
+ i_item += 1;
+ }
+ }
+
+ if (!item) {
+ item = new QTreeWidgetItem(dialog->ui->tableTreeWidget);
+ item->setText(column_number_bd_addr, bd_addr);
+ item->setText(column_number_bd_addr_oui, bd_addr_oui);
+ if (tap_device->is_local) {
+ item->setText(column_number_is_local_adapter, tr("true"));
+ }
+
+ item_data_t *item_data = wmem_new(wmem_file_scope(), item_data_t);
+ item_data->interface_id = tap_device->interface_id;
+ item_data->adapter_id = tap_device->adapter_id;
+ item_data->frame_number = pinfo->fd->num;
+ item->setData(0, Qt::UserRole, QVariant::fromValue<item_data_t *>(item_data));
+ }
+
+ if (tap_device->type == BLUETOOTH_DEVICE_BD_ADDR) {
+ item->setText(column_number_bd_addr, bd_addr);
+ item->setText(column_number_bd_addr_oui, bd_addr_oui);
+ }
+
+ if (tap_device->type == BLUETOOTH_DEVICE_NAME)
+ item->setText(column_number_name, tap_device->data.name);
+
+ if (tap_device->type == BLUETOOTH_DEVICE_LOCAL_ADAPTER)
+ item->setText(column_number_is_local_adapter, tr("true"));
+
+ if (tap_device->type == BLUETOOTH_DEVICE_LOCAL_VERSION) {
+ item->setText(column_number_hci_version, val_to_str_const(tap_device->data.local_version.hci_version, bthci_evt_hci_version, "Unknown 0x%02x"));
+ item->setText(column_number_hci_revision, QString("").sprintf("%u", tap_device->data.local_version.hci_revision));
+ item->setText(column_number_lmp_version, val_to_str_const(tap_device->data.local_version.lmp_version, bthci_evt_lmp_version, "Unknown 0x%02x"));
+ item->setText(column_number_lmp_subversion, QString("").sprintf("%u", tap_device->data.local_version.lmp_subversion));
+ item->setText(column_number_manufacturer, val_to_str_ext_const(tap_device->data.local_version.manufacturer, &bluetooth_company_id_vals_ext, "Unknown 0x%04x"));
+ }
+ if (tap_device->type == BLUETOOTH_DEVICE_REMOTE_VERSION) {
+ item->setText(column_number_lmp_version, val_to_str_const(tap_device->data.remote_version.lmp_version, bthci_evt_lmp_version, "Unknown 0x%02x"));
+ item->setText(column_number_lmp_subversion, QString("").sprintf("%u", tap_device->data.remote_version.lmp_subversion));
+ item->setText(column_number_manufacturer, val_to_str_ext_const(tap_device->data.remote_version.manufacturer, &bluetooth_company_id_vals_ext, "Unknown 0x%04x"));
+ }
+
+ for (int i = 0; i < dialog->ui->tableTreeWidget->columnCount(); i++) {
+ dialog->ui->tableTreeWidget->resizeColumnToContents(i);
+ }
+
+ return TRUE;
+}
+
+void BluetoothDevicesDialog::interfaceCurrentIndexChanged(int)
+{
+ cap_file_.retapPackets();
+}
+
+void BluetoothDevicesDialog::showInformationStepsChanged(int)
+{
+ cap_file_.retapPackets();
+}
+
+void BluetoothDevicesDialog::on_tableTreeWidget_itemActivated(QTreeWidgetItem *item, int)
+{
+ if (!cap_file_.isValid())
+ return;
+
+ item_data_t *item_data = item->data(0, Qt::UserRole).value<item_data_t *>();
+
+ emit goToPacket(item_data->frame_number);
+
+}
+
+void BluetoothDevicesDialog::on_actionCopy_All_triggered()
+{
+ QClipboard *clipboard = QApplication::clipboard();
+ QString copy;
+ QTreeWidgetItemIterator i_item(ui->tableTreeWidget);
+
+ copy += QString("%1 %2 %3 %4 %5 %6 %7 %8 %9\n")
+ .arg(ui->tableTreeWidget->headerItem()->text(column_number_bd_addr), -20)
+ .arg(ui->tableTreeWidget->headerItem()->text(column_number_bd_addr_oui), -20)
+ .arg(ui->tableTreeWidget->headerItem()->text(column_number_name), -30)
+ .arg(ui->tableTreeWidget->headerItem()->text(column_number_lmp_version), -20)
+ .arg(ui->tableTreeWidget->headerItem()->text(column_number_lmp_subversion), -20)
+ .arg(ui->tableTreeWidget->headerItem()->text(column_number_manufacturer), -30)
+ .arg(ui->tableTreeWidget->headerItem()->text(column_number_hci_version), -20)
+ .arg(ui->tableTreeWidget->headerItem()->text(column_number_hci_revision), -20)
+ .arg(ui->tableTreeWidget->headerItem()->text(column_number_is_local_adapter), -20);
+
+ while (*i_item) {
+ QTreeWidgetItem *item = static_cast<QTreeWidgetItem*>(*i_item);
+ copy += QString("%1 %2 %3 %4 %5 %6 %7 %8 %9\n")
+ .arg(item->text(column_number_bd_addr), -20)
+ .arg(item->text(column_number_bd_addr_oui), -20)
+ .arg(item->text(column_number_name), -30)
+ .arg(item->text(column_number_lmp_version), -20)
+ .arg(item->text(column_number_lmp_subversion), -20)
+ .arg(item->text(column_number_manufacturer), -30)
+ .arg(item->text(column_number_hci_version), -20)
+ .arg(item->text(column_number_hci_revision), -20)
+ .arg(item->text(column_number_is_local_adapter), -20);
+ i_item += 1;
+ }
+
+ clipboard->setText(copy);
+}
+
+void BluetoothDevicesDialog::on_actionSave_as_image_triggered()
+{
+ QPixmap image;
+
+ QString fileName = QFileDialog::getSaveFileName(this, tr("Save Table Image"),
+ "bluetooth_devices_table.png",
+ tr("PNG Image (*.png)"));
+
+ if (fileName.isEmpty()) return;
+
+ image = QPixmap::grabWidget(ui->tableTreeWidget);
+ image.save(fileName, "PNG");
+}
+
+void BluetoothDevicesDialog::on_buttonBox_clicked(QAbstractButton *button _U_)
+{
+/* if (button == foo_button_) */
+}
+
+/*
+ * Editor modelines
+ *
+ * Local Variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * ex: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
diff --git a/ui/qt/bluetooth_devices_dialog.h b/ui/qt/bluetooth_devices_dialog.h
new file mode 100644
index 0000000000..e33328d988
--- /dev/null
+++ b/ui/qt/bluetooth_devices_dialog.h
@@ -0,0 +1,105 @@
+/* bluetooth_devices_dialog.h
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef BLUETOOTH_DEVICES_DIALOG_H
+#define BLUETOOTH_DEVICES_DIALOG_H
+
+#include "config.h"
+
+#include <glib.h>
+
+#include "wireshark_dialog.h"
+#include "cfile.h"
+
+#include "epan/tap.h"
+
+#include <QMenu>
+
+class QAbstractButton;
+class QPushButton;
+class QTreeWidgetItem;
+
+typedef struct _bluetooth_devices_tapinfo_t {
+ tap_reset_cb tap_reset;
+ tap_packet_cb tap_packet;
+ void *ui;
+} bluetooth_devices_tapinfo_t;
+
+namespace Ui {
+class BluetoothDevicesDialog;
+}
+
+class BluetoothDevicesDialog : public WiresharkDialog
+{
+ Q_OBJECT
+
+public:
+ explicit BluetoothDevicesDialog(QWidget &parent, CaptureFile &cf);
+ ~BluetoothDevicesDialog();
+
+public slots:
+
+signals:
+ void updateFilter(QString &filter, bool force = false);
+ void captureFileChanged(capture_file *cf);
+ void goToPacket(int packet_num);
+
+protected:
+
+protected slots:
+ void changeEvent(QEvent* event);
+
+private:
+ Ui::BluetoothDevicesDialog *ui;
+
+ bluetooth_devices_tapinfo_t tapinfo_;
+ QMenu context_menu_;
+
+ static void tapReset(void *tapinfo_ptr);
+ static gboolean tapPacket(void *tapinfo_ptr, packet_info *pinfo, epan_dissect_t *, const void *data);
+
+private slots:
+ void captureFileClosing();
+ void on_tableTreeWidget_itemActivated(QTreeWidgetItem *item, int);
+ void on_buttonBox_clicked(QAbstractButton *button);
+ void on_actionCopy_Cell_triggered();
+ void on_actionCopy_Rows_triggered();
+ void on_actionCopy_All_triggered();
+ void on_actionSave_as_image_triggered();
+ void tableContextMenu(const QPoint &pos);
+ void interfaceCurrentIndexChanged(int index);
+ void showInformationStepsChanged(int state);
+};
+
+#endif // BLUETOOTH_DEVICES_DIALOG_H
+
+/*
+ * Editor modelines
+ *
+ * Local Variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * ex: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
diff --git a/ui/qt/bluetooth_devices_dialog.ui b/ui/qt/bluetooth_devices_dialog.ui
new file mode 100644
index 0000000000..e3a9dbe242
--- /dev/null
+++ b/ui/qt/bluetooth_devices_dialog.ui
@@ -0,0 +1,210 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>BluetoothDevicesDialog</class>
+ <widget class="QDialog" name="BluetoothDevicesDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>880</width>
+ <height>477</height>
+ </rect>
+ </property>
+ <property name="baseSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="windowTitle">
+ <string>Bluetooth Devices</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QTreeWidget" name="tableTreeWidget">
+ <property name="contextMenuPolicy">
+ <enum>Qt::CustomContextMenu</enum>
+ </property>
+ <property name="selectionMode">
+ <enum>QAbstractItemView::ExtendedSelection</enum>
+ </property>
+ <property name="textElideMode">
+ <enum>Qt::ElideMiddle</enum>
+ </property>
+ <property name="rootIsDecorated">
+ <bool>false</bool>
+ </property>
+ <property name="itemsExpandable">
+ <bool>false</bool>
+ </property>
+ <property name="sortingEnabled">
+ <bool>true</bool>
+ </property>
+ <attribute name="headerCascadingSectionResizes">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="headerHighlightSections">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="headerShowSortIndicator" stdset="0">
+ <bool>true</bool>
+ </attribute>
+ <column>
+ <property name="text">
+ <string>BD_ADDR</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>OUI</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Name</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>LMP Version</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>LMP Subversion</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Manufacturer</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>HCI Version</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>HCI Revision</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Is Local Adapter</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0">
+ <property name="spacing">
+ <number>-1</number>
+ </property>
+ <property name="sizeConstraint">
+ <enum>QLayout::SetDefaultConstraint</enum>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QComboBox" name="interfaceComboBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>350</width>
+ <height>0</height>
+ </size>
+ </property>
+ <item>
+ <property name="text">
+ <string>All Interfaces</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="showInformationStepsCheckBox">
+ <property name="text">
+ <string>Show information steps</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Close</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ <action name="actionCopy_Cell">
+ <property name="text">
+ <string>Copy Cell</string>
+ </property>
+ </action>
+ <action name="actionCopy_Rows">
+ <property name="text">
+ <string>Copy Rows</string>
+ </property>
+ </action>
+ <action name="actionCopy_All">
+ <property name="text">
+ <string>Copy All</string>
+ </property>
+ </action>
+ <action name="actionSave_as_image">
+ <property name="text">
+ <string>Save as image</string>
+ </property>
+ </action>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>BluetoothDevicesDialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>374</x>
+ <y>407</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>374</x>
+ <y>214</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>BluetoothDevicesDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>374</x>
+ <y>407</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>374</x>
+ <y>214</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/ui/qt/main_window.h b/ui/qt/main_window.h
index cb50134d78..37431d4b61 100644
--- a/ui/qt/main_window.h
+++ b/ui/qt/main_window.h
@@ -485,6 +485,7 @@ private slots:
void on_actionTelephonySipFlows_triggered();
void on_actionATT_Server_Attributes_triggered();
+ void on_actionDevices_triggered();
void externalMenuItem_triggered();
diff --git a/ui/qt/main_window.ui b/ui/qt/main_window.ui
index d0d8171e1f..de8489c108 100644
--- a/ui/qt/main_window.ui
+++ b/ui/qt/main_window.ui
@@ -528,6 +528,7 @@
<string>&amp;Bluetooth</string>
</property>
<addaction name="actionATT_Server_Attributes"/>
+ <addaction name="actionDevices"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuEdit"/>
@@ -2290,6 +2291,11 @@
<string>Devices</string>
</property>
</action>
+ <action name="actionDevices">
+ <property name="text">
+ <string>Devices</string>
+ </property>
+ </action>
<action name="actionServices">
<property name="text">
<string>Services</string>
diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp
index 200bd2704e..f24516c040 100644
--- a/ui/qt/main_window_slots.cpp
+++ b/ui/qt/main_window_slots.cpp
@@ -75,6 +75,7 @@
#include "about_dialog.h"
#include "bluetooth_att_server_attributes_dialog.h"
+#include "bluetooth_devices_dialog.h"
#include "capture_file_dialog.h"
#include "capture_file_properties_dialog.h"
#include "coloring_rules_dialog.h"
@@ -2805,6 +2806,16 @@ void MainWindow::on_actionATT_Server_Attributes_triggered()
bluetooth_att_sever_attributes_dialog->show();
}
+void MainWindow::on_actionDevices_triggered()
+{
+ BluetoothDevicesDialog *bluetooth_devices_dialog = new BluetoothDevicesDialog(*this, capture_file_);
+ connect(bluetooth_devices_dialog, SIGNAL(goToPacket(int)),
+ packet_list_, SLOT(goToPacket(int)));
+ connect(bluetooth_devices_dialog, SIGNAL(updateFilter(QString&, bool)),
+ this, SLOT(filterPackets(QString&, bool)));
+ bluetooth_devices_dialog->show();
+}
+
// Help Menu
void MainWindow::on_actionHelpContents_triggered() {