void HtcuniversalModemService::signalQualityNotification(const QString &msg) { // parse the proprietary unsollicited signal quality notification (@HTCCSQ). uint posn = 8; uint rssi = QAtUtils::parseNumber(msg, posn); indicators()->setSignalQuality((int)rssi, 4); }
void NeoModemService::sigq(const QString & msg) { // Automatic signal quality update, in the range 0-31, e.g. _OSIGQ: 7,0 uint posn = 8; uint rssi = QAtUtils::parseNumber(msg, posn); indicators()->setSignalQuality((int)rssi, 31); }
BOOL CMainFrame::CreateStatusBar() { std::vector<UINT> indicators(1, ID_SEPARATOR); ConfigSection items(m_frameNode.GetSection(L"statusbar/indicators")); for (int i = 0; ; i++) { ConfigSection item(items.GetSectionByIndex(L"item", i)); UINT id = GetNodeID(item, L"id"); if (0 == id) break; indicators.push_back(id); if (ID_SEPARATOR == id && indicators.front() == id) indicators.erase(indicators.begin()); } VERIFY(m_statusBar.Create(m_mainwnd) && m_statusBar.SetIndicators(&indicators[0], x3::GetSize(indicators))); m_statusBar.SetCommandBars(m_cmdbars); m_statusBar.SetDrawDisabledText(FALSE); m_statusBar.GetStatusBarCtrl().SetMinHeight(22); m_statusBar.GetPane(0)->SetMargins(8, 1, 2, 1); return TRUE; }
void BehaviorProvider::outBehaviorData() { indicators(); //-----old ledRequest runBehavior(); selfMessageQueue->SetMessageData(idMotionCmd,idMotionEngineWindow,idActuatorThread, sizeof(MotionCmd),(char*)theMotionCmd); selfMessageQueue->SetMessageData(idLocData,idRobotThread,idNetworkThread, sizeof(TeamUDPData),(char*)theTeamUDPData); }
void NeoModemService::initialize() { // Disable cell broadcast, GTA04 modem probably does not know AT+CSCB commands suppressInterface < QCellBroadcast > (); if (!callProvider()) { setCallProvider(new NeoCallProvider(this)); } QModemService::initialize(); // Disable signal and battery polling, just do initial signal check indicators()->setPolling(false, true, false); }
HtcuniversalModemService::HtcuniversalModemService (const QString& service, QSerialIODeviceMultiplexer *mux, QObject *parent) : QModemService(service, mux, parent), manager(0), battery(0) { connect(this, SIGNAL(resetModem()), this, SLOT(reset())); primaryAtChat()->registerNotificationType ("@HTCCSQ:", this, SLOT(signalQualityNotification(QString))); manager = new QHardwareManager("QPowerSource"); connect(manager, SIGNAL(providerAdded(QString)), this, SLOT(newBatteryAdded(QString))); indicators()->setBatteryCharge(100, 100, QModemIndicators::PoweredByBattery); }
void JLinkage::clusterPSMatrix(std::vector<std::vector<int> >& result) { /* allocate memory */ std::vector<std::vector<double> > distances(line_count, std::vector<double>(line_count, 0)); std::vector<std::vector<int> > clusters(line_count, std::vector<int>(line_count, 0)); std::vector<int> indicators(line_count, 1); /* initialization */ double minDis = 1; int indexA = 0, indexB = 0; for(int i = 0; i < line_count; i++) { clusters[i][i] = 1; for(int j = i + 1; j < line_count; j++) { const double jd = jaccardDist(PSMatrix[i], PSMatrix[j]); distances[i][j] = jd; distances[j][i] = jd; if(jd < minDis) { minDis = jd; indexA = i; indexB = j; } } } while(minDis != 1) { /* merge two clusters */ for(int i = 0; i < line_count; i++) { if(clusters[indexA][i] || clusters[indexB][i]) clusters[indexA][i] = clusters[indexB][i] = 1; } indicators[indexB] = 0; for(int i = 0; i < JLINKAGE_MODEL_SIZE; i++) { PSMatrix[indexA] = PSMatrix[indexB] = PSMatrix[indexA]&PSMatrix[indexB]; } /* recalculate distance */ for(int i = 0; i < line_count; i++) { distances[indexA][i] = jaccardDist(PSMatrix[indexA], PSMatrix[i]); distances[i][indexA] = distances[indexA][i]; } /* find minimum distance */ minDis = 1; for(int i = 0; i < line_count; i++) { if(indicators[i] == 0) continue; for(int j = i + 1; j < line_count; j++) { if(indicators[j] == 0) continue; if(distances[i][j] < minDis) { minDis = distances[i][j]; indexA = i; indexB = j; } } } } /* calculate cluster size */ std::vector<int> clusterSizes(line_count); for(int i = 0; i < line_count; i++) { int cs = 0; if(indicators[i]) { for(int j = 0; j < line_count; j++) { if(clusters[i][j]) ++cs; } } clusterSizes[i] = cs; } const int cluster_num = 3; result.clear(); result.resize(cluster_num, std::vector<int>(line_count)); /* choose the largest three clusters */ int count = 0; while(count < cluster_num) { int max_index = 0; int max_size = clusterSizes[0]; for(int i = 1; i < line_count; i++) { if(max_size < clusterSizes[i]) { max_size = clusterSizes[i]; max_index = i; } } result[count] = clusters[max_index]; count++; clusterSizes[max_index] = 0; } /* print clusters */ /* for(int i = 0; i < cluster_num; i++) { printf("Cluster %d:\n", i); for(int j = 0; j < line_count; j++) { if(result[i][j]) printf("%d ", j); } printf("\n"); } */ }