added poke event

This commit is contained in:
2020-04-18 20:18:45 +02:00
parent 4544a38175
commit baac6fef91
3 changed files with 25 additions and 25 deletions

View File

@@ -13,7 +13,7 @@ LEDHandler::LEDHandler(QUdpSocket* sock, TS3Functions ts3Functions)
void LEDHandler::talkingStarted() void LEDHandler::talkingStarted()
{ {
printf("started\n"); printf("started\n");
sendColor(0, 0, 255, 255, 255); sendColor(125, 125, 255, 125, 255);
} }
void LEDHandler::talkingEnded() void LEDHandler::talkingEnded()
@@ -22,17 +22,31 @@ void LEDHandler::talkingEnded()
sendColor(0, 0, 0, 0, 0); sendColor(0, 0, 0, 0, 0);
} }
void LEDHandler::poked()
{
// start timer
sendColor(0, 0, 0, 255, 5);
}
void LEDHandler::sendColor(int R, int G, int B, int W, int t) void LEDHandler::sendColor(int R, int G, int B, int W, int t)
{ {
QByteArray msg; QByteArray msg;
msg[0] = 3; // protocol: DRGBW msg.append(2);
msg[1] = t; // timeout msg.append(t);
msg[2] = R; // R msg.append(R);
msg[2] = B; // G msg.append(G);
msg[2] = G; // B msg.append(B);
msg[2] = W; // W msg.append(W);
for (int i = 0; i < msg.size(); i++)
printf("%1", msg[i]);
printf("\n");
if (mSock->isValid() && mSock->isOpen())
mSock->write(msg); mSock->write(msg);
else
printf("SOCKET ERROR: %1", mSock->errorString().toStdString().c_str());
} }
void LEDHandler::connected() void LEDHandler::connected()

View File

@@ -15,6 +15,7 @@ public:
void talkingEnded(); void talkingEnded();
void talkingStarted(); void talkingStarted();
void poked();
public slots: public slots:
void connected(); void connected();

View File

@@ -56,7 +56,7 @@ const char* ts3plugin_name() {
/* Plugin version */ /* Plugin version */
const char* ts3plugin_version() { const char* ts3plugin_version() {
return "0.4"; return "0.4b";
} }
/* Plugin API version. Must be the same as the clients API major version, else the plugin fails to load. */ /* Plugin API version. Must be the same as the clients API major version, else the plugin fails to load. */
@@ -881,8 +881,6 @@ void ts3plugin_onClientBanFromServerEvent(uint64 serverConnectionHandlerID, anyI
} }
int ts3plugin_onClientPokeEvent(uint64 serverConnectionHandlerID, anyID fromClientID, const char* pokerName, const char* pokerUniqueIdentity, const char* message, int ffIgnored) { int ts3plugin_onClientPokeEvent(uint64 serverConnectionHandlerID, anyID fromClientID, const char* pokerName, const char* pokerUniqueIdentity, const char* message, int ffIgnored) {
anyID myID;
printf("PLUGIN onClientPokeEvent: %llu %d %s %s %d\n", (long long unsigned int)serverConnectionHandlerID, fromClientID, pokerName, message, ffIgnored); printf("PLUGIN onClientPokeEvent: %llu %d %s %s %d\n", (long long unsigned int)serverConnectionHandlerID, fromClientID, pokerName, message, ffIgnored);
/* Check if the Friend/Foe manager has already blocked this poke */ /* Check if the Friend/Foe manager has already blocked this poke */
@@ -890,20 +888,7 @@ int ts3plugin_onClientPokeEvent(uint64 serverConnectionHandlerID, anyID fromClie
return 0; /* Client will block anyways, doesn't matter what we return */ return 0; /* Client will block anyways, doesn't matter what we return */
} }
// if (curl) { mLedHandler->poked();
// curl_easy_setopt(curl, CURLOPT_URL, LED_URL_POKE);
// res = curl_easy_perform(curl);
// Sleep(500);
// res = curl_easy_perform(curl);
// Sleep(500);
// res = curl_easy_perform(curl);
// Sleep(500);
// res = curl_easy_perform(curl);
// Sleep(500);
// curl_easy_setopt(curl, CURLOPT_URL, LED_URL_OFF);
// res = curl_easy_perform(curl);
// }
return 0; /* 0 = handle normally, 1 = client will ignore the poke */ return 0; /* 0 = handle normally, 1 = client will ignore the poke */
} }