MCPcopy Create free account
hub / github.com/SunOner/sunone_aimbot_2 / processIncomingLine

Method processIncomingLine

sunone_aimbot_2/mouse/Arduino.cpp:289–337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

287}
288
289void Arduino::processIncomingLine(const std::string& line)
290{
291 try
292 {
293 auto applyButtonState = [&](uint16_t buttonId, bool pressed)
294 {
295 switch (buttonId)
296 {
297 case 1:
298 shooting_active = pressed;
299 shooting.store(pressed);
300 break;
301 case 2:
302 if (protocol_ == ArduinoProtocol::Teensy41)
303 {
304 zooming_active = pressed;
305 zooming.store(pressed);
306 }
307 else
308 {
309 aiming_active = pressed;
310 aiming.store(pressed);
311 }
312 break;
313 case 5:
314 aiming_active = pressed;
315 aiming.store(pressed);
316 break;
317 default:
318 break;
319 }
320 };
321
322 if (line.rfind("BD:", 0) == 0)
323 {
324 uint16_t buttonId = static_cast<uint16_t>(std::stoi(line.substr(3)));
325 applyButtonState(buttonId, true);
326 }
327 else if (line.rfind("BU:", 0) == 0)
328 {
329 uint16_t buttonId = static_cast<uint16_t>(std::stoi(line.substr(3)));
330 applyButtonState(buttonId, false);
331 }
332 }
333 catch (const std::exception& e)
334 {
335 std::cerr << "[Arduino] Error processing line '" << line << "': " << e.what() << std::endl;
336 }
337}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected