WaypointView.cc 16.4 KB
Newer Older
pixhawk's avatar
pixhawk committed
1
/*===================================================================
pixhawk's avatar
pixhawk committed
2 3 4 5 6 7 8 9
======================================================================*/

/**
 * @file
 *   @brief Displays one waypoint
 *
 *   @author Lorenz Meier <mavteam@student.ethz.ch>
 *   @author Benjamin Knecht <mavteam@student.ethz.ch>
10
 *   @author Petri Tanskanen <mavteam@student.ethz.ch>
pixhawk's avatar
pixhawk committed
11 12 13 14 15 16
 *
 */

#include <QDoubleSpinBox>
#include <QDebug>

17 18
#include <cmath>
#include <qmath.h>
pixhawk's avatar
pixhawk committed
19

pixhawk's avatar
pixhawk committed
20 21
#include "WaypointView.h"
#include "ui_WaypointView.h"
22
#include "ui_QGCCustomWaypointAction.h"
pixhawk's avatar
pixhawk committed
23 24

WaypointView::WaypointView(Waypoint* wp, QWidget* parent) :
pixhawk's avatar
pixhawk committed
25
        QWidget(parent),
26
        customCommand(new Ui_QGCCustomWaypointAction),
pixhawk's avatar
pixhawk committed
27
        m_ui(new Ui::WaypointView)
pixhawk's avatar
pixhawk committed
28 29 30 31
{
    m_ui->setupUi(this);

    this->wp = wp;
pixhawk's avatar
pixhawk committed
32
    connect(wp, SIGNAL(destroyed(QObject*)), this, SLOT(deleted(QObject*)));
33

34 35 36
    // CUSTOM COMMAND WIDGET
    customCommand->setupUi(m_ui->customActionWidget);

37
    // add actions
38 39 40 41 42 43 44 45
    m_ui->comboBox_action->addItem(tr("Navigate"),MAV_CMD_NAV_WAYPOINT);
    m_ui->comboBox_action->addItem(tr("TakeOff"),MAV_CMD_NAV_TAKEOFF);
    m_ui->comboBox_action->addItem(tr("Loiter Unlim."),MAV_CMD_NAV_LOITER_UNLIM);
    m_ui->comboBox_action->addItem(tr("Loiter Time"),MAV_CMD_NAV_LOITER_TIME);
    m_ui->comboBox_action->addItem(tr("Loiter Turns"),MAV_CMD_NAV_LOITER_TURNS);
    m_ui->comboBox_action->addItem(tr("Return to Launch"),MAV_CMD_NAV_RETURN_TO_LAUNCH);
    m_ui->comboBox_action->addItem(tr("Land"),MAV_CMD_NAV_LAND);
    m_ui->comboBox_action->addItem(tr("Other"), MAV_COMMAND_ENUM_END);
46 47 48 49 50
    //    m_ui->comboBox_action->addItem(tr("Delay"), MAV_ACTION_DELAY_BEFORE_COMMAND);
    //    m_ui->comboBox_action->addItem(tr("Ascend/Descent"), MAV_ACTION_ASCEND_AT_RATE);
    //    m_ui->comboBox_action->addItem(tr("Change Mode"), MAV_ACTION_CHANGE_MODE);
    //    m_ui->comboBox_action->addItem(tr("Relay ON"), MAV_ACTION_RELAY_ON);
    //    m_ui->comboBox_action->addItem(tr("Relay OFF"), MAV_ACTION_RELAY_OFF);
51 52 53 54

    // add frames 
    m_ui->comboBox_frame->addItem("Global",MAV_FRAME_GLOBAL);
    m_ui->comboBox_frame->addItem("Local",MAV_FRAME_LOCAL);
55 56 57 58 59
    m_ui->comboBox_frame->addItem("Mission",MAV_FRAME_MISSION);

    // Initialize view correctly
    updateActionView(wp->getAction());
    updateFrameView(wp->getFrame());
60

pixhawk's avatar
pixhawk committed
61
    // Read values and set user interface
62
    updateValues();
pixhawk's avatar
pixhawk committed
63

64 65 66 67 68 69
    // Check for mission frame
    if (wp->getFrame() == MAV_FRAME_MISSION)
    {
        m_ui->comboBox_action->setCurrentIndex(m_ui->comboBox_action->count()-1);
    }

70 71 72 73
    // defaults
    //changedAction(wp->getAction());
    //changedFrame(wp->getFrame());

74 75 76 77 78 79 80
    connect(m_ui->posNSpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setX(double)));
    connect(m_ui->posESpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setY(double)));
    connect(m_ui->posDSpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setZ(double)));

    connect(m_ui->lonSpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setX(double)));
    connect(m_ui->latSpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setY(double)));
    connect(m_ui->altSpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setZ(double)));
pixhawk's avatar
pixhawk committed
81 82 83 84

    //hidden degree to radian conversion of the yaw angle
    connect(m_ui->yawSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setYaw(int)));
    connect(this, SIGNAL(setYaw(double)), wp, SLOT(setYaw(double)));
pixhawk's avatar
pixhawk committed
85 86 87 88 89

    connect(m_ui->upButton, SIGNAL(clicked()), this, SLOT(moveUp()));
    connect(m_ui->downButton, SIGNAL(clicked()), this, SLOT(moveDown()));
    connect(m_ui->removeButton, SIGNAL(clicked()), this, SLOT(remove()));

pixhawk's avatar
pixhawk committed
90 91
    connect(m_ui->autoContinue, SIGNAL(stateChanged(int)), this, SLOT(changedAutoContinue(int)));
    connect(m_ui->selectedBox, SIGNAL(stateChanged(int)), this, SLOT(changedCurrent(int)));
92 93
    connect(m_ui->comboBox_action, SIGNAL(activated(int)), this, SLOT(changedAction(int)));
    connect(m_ui->comboBox_frame, SIGNAL(activated(int)), this, SLOT(changedFrame(int)));
pixhawk's avatar
pixhawk committed
94

95 96
    connect(m_ui->orbitSpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setLoiterOrbit(double)));
    connect(m_ui->acceptanceSpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setAcceptanceRadius(double)));
pixhawk's avatar
pixhawk committed
97
    connect(m_ui->holdTimeSpinBox, SIGNAL(valueChanged(int)), wp, SLOT(setHoldTime(int)));
98 99 100 101 102 103 104 105
    connect(m_ui->turnsSpinBox, SIGNAL(valueChanged(int)), wp, SLOT(setTurns(int)));

    // Connect actions
    connect(customCommand->commandSpinBox, SIGNAL(valueChanged(int)),   wp, SLOT(setAction(int)));
    connect(customCommand->param1SpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setParam1(double)));
    connect(customCommand->param2SpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setParam2(double)));
    connect(customCommand->param3SpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setParam3(double)));
    connect(customCommand->param4SpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setParam4(double)));
106 107
    connect(customCommand->param5SpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setParam5(double)));
    connect(customCommand->param6SpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setParam6(double)));
108 109 110

    // MISSION ELEMENT WIDGET
    // TODO
pixhawk's avatar
pixhawk committed
111 112 113 114 115
}

void WaypointView::setYaw(int yawDegree)
{
    emit setYaw((double)yawDegree*M_PI/180.);
pixhawk's avatar
pixhawk committed
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
}

void WaypointView::moveUp()
{
    emit moveUpWaypoint(wp);
}

void WaypointView::moveDown()
{
    emit moveDownWaypoint(wp);
}

void WaypointView::remove()
{
    emit removeWaypoint(wp);
131
    deleteLater();
pixhawk's avatar
pixhawk committed
132 133
}

pixhawk's avatar
pixhawk committed
134
void WaypointView::changedAutoContinue(int state)
pixhawk's avatar
pixhawk committed
135 136
{
    if (state == 0)
137
        wp->setAutocontinue(false);
pixhawk's avatar
pixhawk committed
138
    else
139
        wp->setAutocontinue(true);
pixhawk's avatar
pixhawk committed
140 141
}

142
void WaypointView::updateActionView(int action)
143 144
{
    // expose ui based on action
145

146 147
    switch(action)
    {
148
    case MAV_CMD_NAV_TAKEOFF:
149 150 151 152 153 154 155
        m_ui->orbitSpinBox->hide();
        m_ui->yawSpinBox->hide();
        m_ui->turnsSpinBox->hide();
        m_ui->autoContinue->hide();
        m_ui->holdTimeSpinBox->hide();
        m_ui->acceptanceSpinBox->hide();
        m_ui->customActionWidget->hide();
156 157
        m_ui->takeOffAngleSpinBox->show();
        break;
158
    case MAV_CMD_NAV_LAND:
159 160 161 162 163 164 165 166 167
        m_ui->orbitSpinBox->hide();
        m_ui->takeOffAngleSpinBox->hide();
        m_ui->yawSpinBox->hide();
        m_ui->turnsSpinBox->hide();
        m_ui->autoContinue->hide();
        m_ui->holdTimeSpinBox->hide();
        m_ui->acceptanceSpinBox->hide();
        m_ui->customActionWidget->hide();
        break;
168
    case MAV_CMD_NAV_RETURN_TO_LAUNCH:
169 170 171 172 173 174 175 176
        m_ui->orbitSpinBox->hide();
        m_ui->takeOffAngleSpinBox->hide();
        m_ui->yawSpinBox->hide();
        m_ui->turnsSpinBox->hide();
        m_ui->autoContinue->hide();
        m_ui->holdTimeSpinBox->hide();
        m_ui->acceptanceSpinBox->hide();
        m_ui->customActionWidget->hide();
177
        break;
178
    case MAV_CMD_NAV_WAYPOINT:
179 180 181 182 183 184
        m_ui->orbitSpinBox->hide();
        m_ui->takeOffAngleSpinBox->hide();
        m_ui->turnsSpinBox->hide();
        m_ui->holdTimeSpinBox->hide();
        m_ui->customActionWidget->hide();

185
        m_ui->autoContinue->show();
186 187
        m_ui->acceptanceSpinBox->show();
        m_ui->yawSpinBox->show();
188
        break;
189
    case MAV_CMD_NAV_LOITER_UNLIM:
190 191 192 193 194 195 196 197 198
        m_ui->takeOffAngleSpinBox->hide();
        m_ui->yawSpinBox->hide();
        m_ui->turnsSpinBox->hide();
        m_ui->autoContinue->hide();
        m_ui->holdTimeSpinBox->hide();
        m_ui->acceptanceSpinBox->hide();
        m_ui->customActionWidget->hide();
        m_ui->orbitSpinBox->show();
        break;
199
    case MAV_CMD_NAV_LOITER_TURNS:
200 201 202 203 204 205 206 207 208
        m_ui->takeOffAngleSpinBox->hide();
        m_ui->yawSpinBox->hide();
        m_ui->autoContinue->hide();
        m_ui->holdTimeSpinBox->hide();
        m_ui->acceptanceSpinBox->hide();
        m_ui->customActionWidget->hide();
        m_ui->orbitSpinBox->show();
        m_ui->turnsSpinBox->show();
        break;
209
    case MAV_CMD_NAV_LOITER_TIME:
210 211 212 213 214 215
        m_ui->takeOffAngleSpinBox->hide();
        m_ui->yawSpinBox->hide();
        m_ui->turnsSpinBox->hide();
        m_ui->autoContinue->hide();
        m_ui->acceptanceSpinBox->hide();
        m_ui->customActionWidget->hide();
216 217 218 219
        m_ui->orbitSpinBox->show();
        m_ui->holdTimeSpinBox->show();
        break;
    default:
220
        break;
221 222 223
    }
}

224 225 226 227
/**
 * @param index The index of the combo box of the action entry, NOT the action ID
 */
void WaypointView::changedAction(int index)
228 229
{
    // set waypoint action
230
    int actionIndex = m_ui->comboBox_action->itemData(index).toUInt();
231
    if (actionIndex < MAV_COMMAND_ENUM_END && actionIndex >= 0)
232
    {
233
        MAV_COMMAND action = (MAV_COMMAND) actionIndex;
234 235 236 237 238 239 240 241 242
        wp->setAction(action);
    }

    // Expose ui based on action
    // Change to mission frame
    // if action is unknown

    switch(actionIndex)
    {
243 244 245 246 247 248 249 250 251
    case MAV_CMD_NAV_TAKEOFF:
    case MAV_CMD_NAV_LAND:
    case MAV_CMD_NAV_RETURN_TO_LAUNCH:
    case MAV_CMD_NAV_WAYPOINT:
    case MAV_CMD_NAV_LOITER_UNLIM:
    case MAV_CMD_NAV_LOITER_TURNS:
    case MAV_CMD_NAV_LOITER_TIME:
    case MAV_CMD_NAV_DELAY:
    case MAV_CMD_SYS_SET_MODE:
252 253
        // Back to global frame
        if (wp->getFrame() == MAV_FRAME_MISSION) changedFrame(0);
254 255
        // Update view
        updateActionView(actionIndex);
256
        break;
257
    case MAV_COMMAND_ENUM_END:
258 259 260 261 262 263 264
    default:
        // Switch to mission frame
        changedFrame(MAV_FRAME_MISSION);
        wp->setFrame(MAV_FRAME_MISSION);
        break;
    }
}
265

266 267
void WaypointView::updateFrameView(int frame)
{
268 269 270
    switch(frame)
    {
    case MAV_FRAME_GLOBAL:
pixhawk's avatar
pixhawk committed
271 272 273
        m_ui->posNSpinBox->hide();
        m_ui->posESpinBox->hide();
        m_ui->posDSpinBox->hide();
274 275 276
        m_ui->lonSpinBox->show();
        m_ui->latSpinBox->show();
        m_ui->altSpinBox->show();
277 278 279
        // Coordinate frame
        m_ui->comboBox_frame->show();
        m_ui->customActionWidget->hide();
280 281
        break;
    case MAV_FRAME_LOCAL:
pixhawk's avatar
pixhawk committed
282 283 284
        m_ui->lonSpinBox->hide();
        m_ui->latSpinBox->hide();
        m_ui->altSpinBox->hide();
285 286 287
        m_ui->posNSpinBox->show();
        m_ui->posESpinBox->show();
        m_ui->posDSpinBox->show();
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316
        // Coordinate frame
        m_ui->comboBox_frame->show();
        m_ui->customActionWidget->hide();
        break;
    case MAV_FRAME_MISSION:
        // Hide almost everything
        m_ui->orbitSpinBox->hide();
        m_ui->takeOffAngleSpinBox->hide();
        m_ui->yawSpinBox->hide();
        m_ui->turnsSpinBox->hide();
        m_ui->holdTimeSpinBox->hide();
        m_ui->acceptanceSpinBox->hide();
        m_ui->posDSpinBox->hide();
        m_ui->posESpinBox->hide();
        m_ui->posNSpinBox->hide();
        m_ui->latSpinBox->hide();
        m_ui->lonSpinBox->hide();
        m_ui->altSpinBox->hide();
        m_ui->comboBox_frame->hide();

        // Show action widget
        if (!m_ui->customActionWidget->isVisible())
        {
            m_ui->customActionWidget->show();
        }
        if (!m_ui->autoContinue->isVisible())
        {
            m_ui->autoContinue->show();
        }
317 318 319 320 321 322
        break;
    default:
        std::cerr << "unknown frame" << std::endl;
    }
}

pixhawk's avatar
pixhawk committed
323 324 325 326 327 328 329 330
void WaypointView::deleted(QObject* waypoint)
{
    if (waypoint == this->wp)
    {
        deleteLater();
    }
}

331 332 333 334 335 336 337 338 339
void WaypointView::changedFrame(int index)
{
    // set waypoint action
    MAV_FRAME frame = (MAV_FRAME)m_ui->comboBox_frame->itemData(index).toUInt();
    wp->setFrame(frame);

    updateFrameView(frame);
}

pixhawk's avatar
pixhawk committed
340
void WaypointView::changedCurrent(int state)
pixhawk's avatar
pixhawk committed
341
{
pixhawk's avatar
pixhawk committed
342 343
    if (state == 0)
    {
pixhawk's avatar
pixhawk committed
344 345 346
        m_ui->selectedBox->setChecked(true);
        m_ui->selectedBox->setCheckState(Qt::Checked);
        wp->setCurrent(false);
pixhawk's avatar
pixhawk committed
347 348 349
    }
    else
    {
pixhawk's avatar
pixhawk committed
350
        wp->setCurrent(true);
351
        emit changeCurrentWaypoint(wp->getId());   //the slot changeCurrentWaypoint() in WaypointList sets all other current flags to false
pixhawk's avatar
pixhawk committed
352
    }
pixhawk's avatar
pixhawk committed
353 354
}

355 356
void WaypointView::updateValues()
{
pixhawk's avatar
pixhawk committed
357 358 359 360 361 362 363
    // Check if we just lost the wp, delete the widget
    // accordingly
    if (!wp)
    {
        deleteLater();
        return;
    }
364 365
    // Deactivate signals from the WP
    wp->blockSignals(true);
366 367
    // update frame
    MAV_FRAME frame = wp->getFrame();
368
    int frame_index = m_ui->comboBox_frame->findData(frame);
369 370 371
    if (m_ui->comboBox_frame->currentIndex() != frame_index)
    {
        m_ui->comboBox_frame->setCurrentIndex(frame_index);
372
        updateFrameView(frame);
373
    }
374 375 376
    switch(frame)
    {
    case(MAV_FRAME_LOCAL):
pixhawk's avatar
pixhawk committed
377 378 379 380 381 382 383 384 385 386 387 388 389 390
        {
            if (m_ui->posNSpinBox->value() != wp->getX())
            {
                m_ui->posNSpinBox->setValue(wp->getX());
            }
            if (m_ui->posESpinBox->value() != wp->getY())
            {
                m_ui->posESpinBox->setValue(wp->getY());
            }
            if (m_ui->posDSpinBox->value() != wp->getZ())
            {
                m_ui->posDSpinBox->setValue(wp->getZ());
            }
        }
391 392
        break;
    case(MAV_FRAME_GLOBAL):
pixhawk's avatar
pixhawk committed
393 394 395 396 397 398 399 400 401 402 403 404 405 406
        {
            if (m_ui->lonSpinBox->value() != wp->getX())
            {
                m_ui->lonSpinBox->setValue(wp->getX());
            }
            if (m_ui->latSpinBox->value() != wp->getY())
            {
                m_ui->latSpinBox->setValue(wp->getY());
            }
            if (m_ui->altSpinBox->value() != wp->getZ())
            {
                m_ui->altSpinBox->setValue(wp->getZ());
            }
        }
407
        break;
408 409 410 411 412
    case (MAV_FRAME_MISSION):
        {
            // TODO Change to mission view
        }
        break;
413 414
    }

415
    // Update action
lm's avatar
lm committed
416
    MAV_COMMAND action = wp->getAction();
417
    int action_index = m_ui->comboBox_action->findData(action);
418 419 420
    // Set to "Other" action if it was -1
    if (action_index == -1)
    {
lm's avatar
lm committed
421
        action_index = m_ui->comboBox_action->findData(MAV_COMMAND_ENUM_END);
422 423
    }
    // Only update if changed
pixhawk's avatar
pixhawk committed
424 425
    if (m_ui->comboBox_action->currentIndex() != action_index)
    {
426 427 428 429 430 431
        // TODO Action and frame should not be coupled
        if (wp->getFrame() != MAV_FRAME_MISSION)
        {
            m_ui->comboBox_action->setCurrentIndex(action_index);
            updateActionView(action);
        }
pixhawk's avatar
pixhawk committed
432
    }
433 434
    switch(action)
    {
435
    case MAV_CMD_NAV_TAKEOFF:
436
        break;
437
    case MAV_CMD_NAV_LAND:
438
        break;
439
    case MAV_CMD_NAV_WAYPOINT:
440
        break;
441
    case MAV_CMD_NAV_LOITER_UNLIM:
442 443 444 445 446
        break;
    default:
        std::cerr << "unknown action" << std::endl;
    }

pixhawk's avatar
pixhawk committed
447 448 449 450
    if (m_ui->yawSpinBox->value() != wp->getYaw()/M_PI*180.)
    {
        m_ui->yawSpinBox->setValue(wp->getYaw()/M_PI*180.);
    }
pixhawk's avatar
pixhawk committed
451 452 453 454 455 456 457 458
    if (m_ui->selectedBox->isChecked() != wp->getCurrent())
    {
        m_ui->selectedBox->setChecked(wp->getCurrent());
    }
    if (m_ui->autoContinue->isChecked() != wp->getAutoContinue())
    {
        m_ui->autoContinue->setChecked(wp->getAutoContinue());
    }
pixhawk's avatar
pixhawk committed
459
    m_ui->idLabel->setText(QString("%1").arg(wp->getId()));
460
    if (m_ui->orbitSpinBox->value() != wp->getLoiterOrbit())
pixhawk's avatar
pixhawk committed
461
    {
462 463 464 465 466
        m_ui->orbitSpinBox->setValue(wp->getLoiterOrbit());
    }
    if (m_ui->acceptanceSpinBox->value() != wp->getAcceptanceRadius())
    {
        m_ui->acceptanceSpinBox->setValue(wp->getAcceptanceRadius());
pixhawk's avatar
pixhawk committed
467 468 469 470 471
    }
    if (m_ui->holdTimeSpinBox->value() != wp->getHoldTime())
    {
        m_ui->holdTimeSpinBox->setValue(wp->getHoldTime());
    }
472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499

    // UPDATE CUSTOM ACTION WIDGET

    if (customCommand->commandSpinBox->value() != wp->getAction())
    {
        customCommand->commandSpinBox->setValue(wp->getAction());
        qDebug() << "Changed action";
    }
    // Param 1
    if (customCommand->param1SpinBox->value() != wp->getParam1())
    {
        customCommand->param1SpinBox->setValue(wp->getParam1());
    }
    // Param 2
    if (customCommand->param2SpinBox->value() != wp->getParam2())
    {
        customCommand->param2SpinBox->setValue(wp->getParam2());
    }
    // Param 3
    if (customCommand->param3SpinBox->value() != wp->getParam3())
    {
        customCommand->param3SpinBox->setValue(wp->getParam3());
    }
    // Param 4
    if (customCommand->param4SpinBox->value() != wp->getParam4())
    {
        customCommand->param4SpinBox->setValue(wp->getParam4());
    }
500 501 502 503 504 505 506 507 508 509
    // Param 5
    if (customCommand->param5SpinBox->value() != wp->getParam5())
    {
        customCommand->param5SpinBox->setValue(wp->getParam5());
    }
    // Param 6
    if (customCommand->param6SpinBox->value() != wp->getParam6())
    {
        customCommand->param6SpinBox->setValue(wp->getParam6());
    }
510

511
    wp->blockSignals(false);
512 513
}

pixhawk's avatar
pixhawk committed
514
void WaypointView::setCurrent(bool state)
pixhawk's avatar
pixhawk committed
515
{
pixhawk's avatar
pixhawk committed
516 517
    if (state)
    {
pixhawk's avatar
pixhawk committed
518
        m_ui->selectedBox->setCheckState(Qt::Checked);
pixhawk's avatar
pixhawk committed
519 520 521
    }
    else
    {
pixhawk's avatar
pixhawk committed
522
        m_ui->selectedBox->setCheckState(Qt::Unchecked);
pixhawk's avatar
pixhawk committed
523
    }
pixhawk's avatar
pixhawk committed
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540
}

WaypointView::~WaypointView()
{
    delete m_ui;
}

void WaypointView::changeEvent(QEvent *e)
{
    switch (e->type()) {
    case QEvent::LanguageChange:
        m_ui->retranslateUi(this);
        break;
    default:
        break;
    }
}