VOID OALBLMenuSetDeviceId(OAL_BLMENU_ITEM * pMenu) { WCHAR deviceId[OAL_KITL_ID_SIZE]; LPSTR pDeviceId = pMenu->pParam1; UINT i; memset(deviceId, 0, sizeof(deviceId)); OALLog(L" Enter Device Id (* = auto, actual '%S'): ", DeviceId(pDeviceId)); // Read input line if (OALBLMenuReadLine(deviceId, dimof(deviceId)) == 0) goto cleanUp; // Convert unicode to one-byte character string if (deviceId[0] == L'*' && deviceId[1] == L'\0') { memset(pDeviceId, 0, OAL_KITL_ID_SIZE); } else { for (i = 0; i < OAL_KITL_ID_SIZE; i++) { pDeviceId[i] = (UCHAR)deviceId[i]; } } OALLog(L" Device Id set to '%S'\r\n", DeviceId(pDeviceId)); cleanUp: ; }
DeviceManager::DeviceSetupStatus DevicePluginOsdomotics::setupDevice(Device *device) { if (device->deviceClassId() == rplRouterDeviceClassId) { qCDebug(dcOsdomotics) << "Setup RPL router" << device->paramValue("host").toString(); QHostAddress address(device->paramValue("host").toString()); if (address.isNull()) { qCWarning(dcOsdomotics) << "Got invalid address" << device->paramValue("host").toString(); return DeviceManager::DeviceSetupStatusFailure; } QUrl url; url.setScheme("http"); url.setHost(address.toString()); QNetworkReply *reply = networkManagerGet(QNetworkRequest(url)); m_asyncSetup.insert(reply, device); return DeviceManager::DeviceSetupStatusAsync; } else if (device->deviceClassId() == merkurNodeDeviceClassId) { qCDebug(dcOsdomotics) << "Setup Merkur node" << device->paramValue("host").toString(); device->setParentId(DeviceId(device->paramValue("router id").toString())); return DeviceManager::DeviceSetupStatusSuccess; } return DeviceManager::DeviceSetupStatusFailure; }
JsonReply *RulesHandler::FindRules(const QVariantMap ¶ms) { DeviceId deviceId = DeviceId(params.value("deviceId").toString()); QList<RuleId> rules = GuhCore::instance()->findRules(deviceId); QVariantList rulesList; foreach (const RuleId &ruleId, rules) { rulesList.append(ruleId); }
/*! Returns the \l{State} with the given \a stateTypeId of this Device. */ State Device::state(const StateTypeId &stateTypeId) const { for (int i = 0; i < m_states.count(); ++i) { if (m_states.at(i).stateTypeId() == stateTypeId) { return m_states.at(i); } } return State(StateTypeId(), DeviceId()); }
/* readonly attribute DOMString DisplayVendorID; */ NS_IMETHODIMP nsSystemInfo::GetDisplayVendorID(nsAString & aDisplayVendorID) { nsCString DeviceId(mDeviceID); ToUpperCase(DeviceId); PRInt32 start = DeviceId.Find(NS_LITERAL_CSTRING("VEN_")); PRInt32 end = DeviceId.Find(NS_LITERAL_CSTRING("&"), start); DeviceId.Cut(end, DeviceId.Length()); DeviceId.Cut(0, start + 4); DeviceId.Insert("0x", 0, 2); aDisplayVendorID.AssignLiteral(DeviceId.BeginReading()); return NS_OK; }
QList<LogEntry> LogEngine::logEntries() const { QList<LogEntry> results; QSqlQuery query; query.exec("SELECT * FROM entries;"); while (query.next()) { LogEntry entry( QDateTime::fromMSecsSinceEpoch(query.value("timestamp").toLongLong()), (Logging::LoggingLevel)query.value("loggingLevel").toInt(), (Logging::LoggingSource)query.value("sourceType").toInt(), query.value("errorCode").toInt()); entry.setTypeId(query.value("typeId").toUuid()); entry.setDeviceId(DeviceId(query.value("deviceId").toString())); entry.setValue(query.value("value").toString()); if ((Logging::LoggingEventType)query.value("loggingEventType").toInt() == Logging::LoggingEventTypeActiveChange) { entry.setActive(query.value("active").toBool()); } results.append(entry); } return results; }
/*! Returns the list of \l{LogEntry}{LogEntries} of the database matching the given \a filter. \sa LogEntry, LogFilter */ QList<LogEntry> LogEngine::logEntries(const LogFilter &filter) const { qCDebug(dcLogEngine) << "Read logging database" << m_db.databaseName(); QList<LogEntry> results; QSqlQuery query; QString queryCall = "SELECT * FROM entries ORDER BY timestamp;"; if (filter.isEmpty()) { query.exec(queryCall); } else { queryCall = QString("SELECT * FROM entries WHERE %1 ORDER BY timestamp;").arg(filter.queryString()); query.exec(queryCall); } if (query.lastError().isValid()) { qCWarning(dcLogEngine) << "Error fetching log entries. Driver error:" << query.lastError().driverText() << "Database error:" << query.lastError().databaseText(); return QList<LogEntry>(); } while (query.next()) { LogEntry entry( QDateTime::fromTime_t(query.value("timestamp").toLongLong()), (Logging::LoggingLevel)query.value("loggingLevel").toInt(), (Logging::LoggingSource)query.value("sourceType").toInt(), query.value("errorCode").toInt()); entry.setTypeId(query.value("typeId").toUuid()); entry.setDeviceId(DeviceId(query.value("deviceId").toString())); entry.setValue(query.value("value").toString()); if ((Logging::LoggingEventType)query.value("loggingEventType").toInt() == Logging::LoggingEventTypeActiveChange) { entry.setActive(query.value("active").toBool()); } //qCDebug(dcLogEngine) << entry; results.append(entry); } qCDebug(dcLogEngine) << "Fetched" << results.count() << "entries for db query:" << queryCall; return results; }
bool FDeployCommand::Run( ) { bool bDeployed = false; // get the target device FString DevicesList; FParse::Value(FCommandLine::Get(), TEXT("-DEVICE="), DevicesList); // get the file manifest FString Manifest; FParse::Value(FCommandLine::Get(), TEXT("-MANIFEST="), Manifest); FString SourceDir; FParse::Value(FCommandLine::Get(), TEXT("-SOURCEDIR="), SourceDir); ITargetPlatformManagerModule* TPM = GetTargetPlatformManager(); if (!TPM) { return false; } // Initialize the messaging subsystem so we can do device discovery. FModuleManager::Get().LoadModuleChecked("Messaging"); // load plug-in modules // @todo: allow for better plug-in support in standalone Slate apps IPluginManager::Get().LoadModulesForEnabledPlugins(ELoadingPhase::PreDefault); while (!DevicesList.IsEmpty()) { FString Device; if (!DevicesList.Split(TEXT("+"), &Device, &DevicesList)) { Device = DevicesList; DevicesList.Empty(); } double DeltaTime = 0.0; double LastTime = FPlatformTime::Seconds(); // We track the message sent time because we have to keep updating the loop until the message is *actually sent*. (ie all packets queued, sent, buffer flushed, etc.) double MessageSentTime = 0.0; bool bMessageSent = false; while (!GIsRequestingExit && ((MessageSentTime > LastTime + 1.0) || (MessageSentTime <= 0.1))) { FTaskGraphInterface::Get().ProcessThreadUntilIdle(ENamedThreads::GameThread); FTicker::GetCoreTicker().Tick(DeltaTime); FPlatformProcess::Sleep(0); DeltaTime = FPlatformTime::Seconds() - LastTime; LastTime = FPlatformTime::Seconds(); if (!bMessageSent) { const TArray<ITargetPlatform*>& Platforms = TPM->GetActiveTargetPlatforms(); FString Platform; FString DeviceName; Device.Split(TEXT("@"), &Platform, &DeviceName); FTargetDeviceId DeviceId(Platform, DeviceName); ITargetDevicePtr TargetDevice; for (int32 Index = 0; Index < Platforms.Num(); ++Index) { TargetDevice = Platforms[Index]->GetDevice(DeviceId); if (TargetDevice.IsValid()) { FString OutId; if (Platforms[Index]->PackageBuild(SourceDir)) { if (TargetDevice->Deploy(SourceDir, OutId)) { bDeployed = true; } MessageSentTime = LastTime; bMessageSent = true; } else { MessageSentTime = LastTime; bMessageSent = true; } } } } } } return bDeployed; }
// 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "fennel/common/CommonPreamble.h" #include "fennel/cache/CacheImpl.h" #include "fennel/cache/LRUVictimPolicy.h" #include "fennel/cache/TwoQVictimPolicy.h" #include "fennel/common/StatsTarget.h" FENNEL_BEGIN_CPPFILE("$Id$"); const DeviceId Cache::NULL_DEVICE_ID = DeviceId(0); Cache::~Cache() { } CacheAccessor::~CacheAccessor() { } class TwoQPage : public CachePage, public TwoQVictim { public: TwoQPage(Cache &cache,PBuffer buffer) : CachePage(cache, buffer) {