本文整理汇总了C++中DeviceManager::sendMessage方法的典型用法代码示例。如果您正苦于以下问题:C++ DeviceManager::sendMessage方法的具体用法?C++ DeviceManager::sendMessage怎么用?C++ DeviceManager::sendMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DeviceManager
的用法示例。
在下文中一共展示了DeviceManager::sendMessage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleShortCmd
//.........这里部分代码省略.........
}
break;
case 'Z': // save throttle settings
if (accelerator) {
accelerator->saveConfiguration();
}
break;
case 'b':
if (brake) {
ThrottleDetector *detector = new ThrottleDetector(brake);
detector->detect();
}
break;
case 'B':
if (brake != NULL) {
brake->saveConfiguration();
}
break;
case 'p':
Logger::console("PASSTHROUGH MODE - All traffic Serial3 <-> SerialUSB");
//this never stops so basically everything dies. you will have to reboot.
int inSerialUSB, inSerial3;
while (1 == 1) {
inSerialUSB = SerialUSB.read();
inSerial3 = Serial3.read();
if (inSerialUSB > -1) {
Serial3.write((char) inSerialUSB);
}
if (inSerial3 > -1) {
SerialUSB.write((char) inSerial3);
}
}
break;
case 'S':
//there is not really any good way (currently) to auto generate this list
//the information just isn't stored anywhere in code. Perhaps we might
//think to change that. Otherwise you must remember to update here or
//nobody will know your device exists. Additionally, these values are
//decoded into decimal from their hex specification in DeviceTypes.h
Logger::console("DMOC645 = %X", DMOC645);
Logger::console("Brusa DMC5 = %X", BRUSA_DMC5);
Logger::console("Brusa Charger = %X", BRUSACHARGE);
Logger::console("TCCH Charger = %X", TCCHCHARGE);
Logger::console("Pot based accelerator = %X", POTACCELPEDAL);
Logger::console("Pot based brake = %X", POTBRAKEPEDAL);
Logger::console("CANBus accelerator = %X", CANACCELPEDAL);
Logger::console("CANBus brake = %X", CANBRAKEPEDAL);
Logger::console("WIFI (iChip2128) = %X", ICHIP2128);
Logger::console("Th!nk City BMS = %X", THINKBMS);
break;
case 's':
Logger::console("Finding and listing all nearby WiFi access points");
deviceManager->sendMessage(DEVICE_WIFI, ICHIP2128, MSG_COMMAND, (void *)"RP20");
break;
case 'W':
Logger::console("Setting Wifi Adapter to WPS mode (make sure you press the WPS button on your router)");
// restore factory defaults and give it some time
deviceManager->sendMessage(DEVICE_WIFI, ICHIP2128, MSG_COMMAND, (void *)"AWPS");
break;
case 'w':
Logger::console("Resetting wifi to factory defaults and setting up GEVCU4.2 Ad Hoc network");
// restore factory defaults and give it some time
// pinMode(43,OUTPUT);
// digitalWrite(43, LOW); //Pin 43 held low for 5 seconds puts Version 4.2 in Recovery mode
// delay(6000);
// digitalWrite(43, HIGH);
// delay(3000);
deviceManager->sendMessage(DEVICE_WIFI, ICHIP2128, MSG_COMMAND, (void *)"FD");//Reset
delay(2000);
deviceManager->sendMessage(DEVICE_WIFI, ICHIP2128, MSG_COMMAND, (void *)"HIF=1"); //Set for RS-232 serial.
delay(1000);
deviceManager->sendMessage(DEVICE_WIFI, ICHIP2128, MSG_COMMAND, (void *)"BDRA");//Auto baud rate selection
delay(1000);
deviceManager->sendMessage(DEVICE_WIFI, ICHIP2128, MSG_COMMAND, (void *)"WLCH=9"); //use whichever channel an AP wants to use
delay(1000);
deviceManager->sendMessage(DEVICE_WIFI, ICHIP2128, MSG_COMMAND, (void *)"WLSI=!GEVCU"); //set for GEVCU aS AP.
delay(1000);
deviceManager->sendMessage(DEVICE_WIFI, ICHIP2128, MSG_COMMAND, (void *)"DIP=192.168.3.10"); //enable IP
delay(1000);
deviceManager->sendMessage(DEVICE_WIFI, ICHIP2128, MSG_COMMAND, (void *)"DPSZ=8"); //set DHCP server for 8
delay(1000);
deviceManager->sendMessage(DEVICE_WIFI, ICHIP2128, MSG_COMMAND, (void *)"RPG=secret"); // set the configuration password for /ichip
delay(1000);
deviceManager->sendMessage(DEVICE_WIFI, ICHIP2128, MSG_COMMAND, (void *)"WPWD=secret"); // set the password to update config params
delay(1000);
deviceManager->sendMessage(DEVICE_WIFI, ICHIP2128, MSG_COMMAND, (void *)"AWS=1"); //turn on web server
delay(1000);
deviceManager->sendMessage(DEVICE_WIFI, ICHIP2128, MSG_COMMAND, (void *)"DOWN"); //cause a reset to allow it to come up with the settings
delay(5000); // a 5 second delay is required for the chip to come back up ! Otherwise commands will be lost
deviceManager->sendMessage(DEVICE_WIFI, ICHIP2128, MSG_CONFIG_CHANGE, NULL); // reload configuration params as they were lost
Logger::console("Wifi 4.2 initialized");
break;
case 'X':
setup(); //this is probably a bad idea. Do not do this while connected to anything you care about - only for debugging in safety!
break;
}
}