CalcScreen::CalcScreen(QQuickItem *parent) : QQuickPaintedItem(parent), m_calc(NULL) { // setFillColor(Qt::color1); connect(this, SIGNAL( widthChanged() ), this, SLOT( setLcd() )); connect(this, SIGNAL( heightChanged() ), this, SLOT( setLcd() )); }
void onLcd(HttpRequest &request, HttpResponse &response) { int y = request.getQueryParameter("y").toInt(); String text = request.getQueryParameter("text"); setLcd(y, text); JsonObjectStream* stream = new JsonObjectStream(); JsonObject& json = stream->getRoot(); json["status"] = (bool)true; response.setAllowCrossDomainOrigin("*"); response.setHeader("Access-Control-Allow-Methods", "GET,POST,PUT,DELETE,OPTIONS"); response.setHeader("Access-Control-Allow-Headers", "Content-Type, Access-Control-Allow-Headers, Authorization, X-Request, X-Request, X-Requested-With"); response.sendJsonObject(stream); }
void wsMessageReceived(WebSocket& socket, const String& message) { WebSocketsList &clients = server.getActiveWebSockets(); StaticJsonBuffer<200> jsonBuffer; JsonObject& root = jsonBuffer.parseObject(message); String actionName = root["name"].asString(); if(actionName=="enhance"){ setEnhance(!enhance); }else if(actionName=="power"){ setPower(!power); }else if(actionName=="mute"){ setMmute(!mute); }else if(actionName=="mixing"){ setMixing(!mixing); }else if(actionName=="frequency"){ setFrequency(root["val"]); }else if(actionName=="source"){ setSource(root["val"]); }else if (actionName == "volumeFR") { setVolume(CHAN_FR, root["val"]); } else if (actionName == "volumeFL") { setVolume(CHAN_FL, root["val"]); } else if (actionName == "volumeRR") { setVolume(CHAN_RR, root["val"]); } else if (actionName == "volumeRL") { setVolume(CHAN_RL, root["val"]); } else if (actionName == "volumeCEN") { setVolume(CHAN_CEN, root["val"]); } else if (actionName == "volumeSW") { setVolume(CHAN_SW, root["val"]); } else if (actionName == "volumeALLCH") { setVolume(CHAN_ALL, root["val"]); } else if (actionName == "volumeSW") { setVolume(CHAN_SW, root["val"]); } else if (actionName == "lcdText") { setLcd(root["line"], root["val"]); } sendUpdate(); Serial.printf("WebSocket message received:\r\n%s\r\n", actionName); }