iSuccess( true )
{
qDebug() << "OperationModeToggler::OperationModeToggler( ... )";
+
+ qRegisterMetaType<DeviceManager::ErrorCode>("DeviceManager::ErrorCode");
+
+ connect( iAlarmSender, SIGNAL( alarmSendingFailed( DeviceManager::ErrorCode, const QString& ) ),
+ this, SIGNAL( error( DeviceManager::ErrorCode, const QString& ) ) );
+ connect( iConfigurator, SIGNAL( configuringError( DeviceManager::ErrorCode ) ),
+ this, SLOT( createError( DeviceManager::ErrorCode ) ) );
+ connect( iDataStorage, SIGNAL( dataStorageInitFailed( DeviceManager::ErrorCode ) ),
+ this, SLOT( createError( DeviceManager::ErrorCode ) ) );
}
OperationModeToggler::~OperationModeToggler()
{
case DeviceManager::EmptyMode:
// error occured. Mode cannot be changed
- emit error( DeviceManager::ModeNotFetched );
+ createError( DeviceManager::ModeNotFetched );
iSuccess = false;
return;
case DeviceManager::StandAloneMode:
emit changingMode( "Storing information about the new operation mode." );
sleep( 2 );
if( !storeOperationMode( DeviceManager::KioskMode, iDataStorage ) ) {
- emit error( DeviceManager::ModeNotStored );
+ createError( DeviceManager::ModeNotStored );
iSuccess = false;
}
}
emit changingMode( "Storing information about the new operation mode." );
sleep( 2 );
if( !storeOperationMode( DeviceManager::StandAloneModeInProgress, iDataStorage ) ) {
- emit error( DeviceManager::ModeNotStored );
+ createError( DeviceManager::ModeNotStored );
iSuccess = false;
}
}
bool OperationModeToggler::success()
{
+ qDebug() << "OperationModeToggler::success()";
return iSuccess;
}
return false;
return true;
}
+
+void OperationModeToggler::createError( DeviceManager::ErrorCode aCode )
+{
+ qDebug() << "OperationModeToggler::createError( DeviceManager::ErrorCode )";
+ QString empty = "";
+ emit error( aCode, empty );
+}
+