Changeset 341
- Timestamp:
- 03/27/12 15:14:06 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/project/PuzzleboxSynapseEmotiv/PuzzleboxSynapseEmotiv/main.cpp
r340 r341 14 14 #define USE_COMPOSER = True; 15 15 16 void logEmotivUpdate(std::ostream& os, unsigned int userID, EmoStateHandle eState, bool withHeader = false); 16 //void logEmotivUpdate(std::ostream& os, unsigned int userID, EmoStateHandle eState, bool withHeader = false); 17 void logEmotivUpdate(unsigned int userID, EmoStateHandle eState, bool withHeader = false); 17 18 18 19 int main(int argc, char** argv) { … … 30 31 try { 31 32 32 // if (argc != 2) {33 // throw std::exception("Please supply the log file name.\nUsage: EmoStateLogger [log_file_name].");34 // }35 36 // std::cout << "===================================================================" << std::endl;37 // std::cout << "Example to show how to log the EmoState from EmoEngine/EmoComposer." << std::endl;38 // std::cout << "===================================================================" << std::endl;39 // std::cout << "Press '1' to start and connect to the EmoEngine " << std::endl;40 // std::cout << "Press '2' to connect to the EmoComposer " << std::endl;41 // std::cout << ">> ";42 43 // std::getline(std::cin, input, '\n');44 // option = atoi(input.c_str());45 46 // switch (option) {47 // case 1:48 // {49 // if (EE_EngineConnect() != EDK_OK) {50 // throw std::exception("Emotiv Engine start up failed.");51 // }52 // break;53 // }54 // case 2:55 // {56 // std::cout << "Target IP of EmoComposer? [127.0.0.1] ";57 // std::getline(std::cin, input, '\n');58 59 // if (input.empty()) {60 // input = std::string("127.0.0.1");61 // }62 63 // if (EE_EngineRemoteConnect(input.c_str(), composerPort) != EDK_OK) {64 // std::string errMsg = "Cannot connect to EmoComposer on [" + input + "]";65 // throw std::exception(errMsg.c_str());66 // }67 // break;68 // }69 // default:70 // throw std::exception("Invalid option...");71 // break;72 // }73 74 75 //std::cout << "Target IP of EmoComposer? [127.0.0.1] ";76 //std::getline(std::cin, input, '\n');77 78 //if (input.empty()) {79 // input = std::string("127.0.0.1");80 //}81 82 33 if (EE_EngineRemoteConnect(emotivHost.c_str(), composerPort) != EDK_OK) { 83 34 std::string errMsg = "Cannot connect to EmoComposer on [" + emotivHost + "]"; 84 35 throw std::exception(errMsg.c_str()); 85 36 } 86 //break;87 88 37 89 38 std::cout << "Start receiving EmoState! Press any key to stop logging...\n" << std::endl; 90 39 91 std::ofstream ofs(argv[1]);40 //std::ofstream ofs(argv[1]); 92 41 bool writeHeader = true; 93 42 … … 110 59 printf("%10.3fs : New EmoState from user %d ...\r", timestamp, userID); 111 60 112 logEmotivUpdate(ofs, userID, eState, writeHeader); 61 //logEmotivUpdate(ofs, userID, eState, writeHeader); 62 logEmotivUpdate(userID, eState, writeHeader); 113 63 writeHeader = false; 114 64 } … … 122 72 } 123 73 124 ofs.close();74 //ofs.close(); 125 75 } 126 76 catch (const std::exception& e) { … … 138 88 139 89 140 void logEmotivUpdate(std::ostream& os, unsigned int userID, EmoStateHandle eState, bool withHeader) { 90 //void logEmotivUpdate(std::ostream& os, unsigned int userID, EmoStateHandle eState, bool withHeader) { 91 void logEmotivUpdate(unsigned int userID, EmoStateHandle eState, bool withHeader) { 141 92 142 93 // Create the top header … … 207 158 std::cout << ES_CognitivGetCurrentActionPower(eState); 208 159 209 //std::cout << std::endl;160 std::cout << std::endl; 210 161 } 211 162
Note: See TracChangeset
for help on using the changeset viewer.