From 74b9797991ceaabf98613a70a10a4b329a254c93 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Thu, 28 Jun 2012 20:48:25 +0100 Subject: drawing calls and sms --- src/testApp.cpp | 126 ++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 99 insertions(+), 27 deletions(-) (limited to 'src/testApp.cpp') diff --git a/src/testApp.cpp b/src/testApp.cpp index ae42217..3ce4f36 100644 --- a/src/testApp.cpp +++ b/src/testApp.cpp @@ -33,6 +33,12 @@ position update function to interpolate position +basically working +-antialisaing on polys in crazy +-colours of everything pretty naff +-fading feature +-draw incoming events text + */ std::vector split(std::string l, char delim) @@ -71,7 +77,7 @@ void testApp::setup(){ camera.cacheMatrices(); //stop error messages */ - ofSetFrameRate(25); + //ofSetFrameRate(25); ofSetCircleResolution(windowWidth); ofEnableSmoothing(); @@ -81,24 +87,6 @@ void testApp::setup(){ camera.setFov(6.5); camera.cacheMatrices(); - numLines=100; - - lines = new ofPoint[numLines]; - imeis = new string[numLines]; - for (int i=0;i" at call commence. + * "GSM disconnect" and then "GSM release" at call end. + + b.) To a mobile number: + + * "GSM alerting " when ringing. + * "GSM call confirmed to " when ringing at both ends. + * "GSM connect to " at pickup. + * "GSM disconnect" as above at end, then "GSM release from mysql -u tim -h 134.226.86.120 -p + + > use openbts + + */ char udpMessage[1024]; udpConnection.Receive(udpMessage,1024); string message=udpMessage; if(message.length()){ vector tokens=split(message,','); - string imsi=tokens[0].substr(4); //long dev=atol(n.c_str()); something crazy going on. this always seems to read out 32 bits - if (!tokens[0].substr(0,4).compare("IMSI")) { //not an event - if (!devices.count(imsi)) { + if (!tokens[0].substr(0,4).compare("IMSI")) { //this is an event + string number=tokens[2]; + if (!devices.count(number)) { + string imei=string(tokens[1]); + string imsi=string(tokens[0].substr(4)); //create a new device at a random position float a=ofRandom(TWO_PI); - float r=ofRandom(windowWidth/2); - devices[imsi]=obtsDevice(imsi,icons,ofVec2f(a,r)); + float r=ofRandom(windowWidth/3)+(windowWidth/6); + devices[number]=obtsDevice(imsi,imei,number,icons,ofVec2f(a,r)); + } + devices[number].excite(); //whenever an event concerns a device it brightens + + if(tokens[3].find("joined network")!=string::npos) devices[number].connect(); + if(tokens[3].find("leaving network")!=string::npos) devices[number].disconnect(); + if(tokens[3].find("queued")!=string::npos) { + string t_number=split(tokens[3],' ')[2]; + printf("SMS from %s to %s\n",number.c_str(),t_number.c_str()); + if (devices.count(t_number)) { + devices[number].sms(&devices[t_number]); + } + } + if(tokens[3].find("connect acknowledge")!=string::npos) { + string t_number=split(tokens[3],' ')[3]; + printf("call from %s to %s\n",number.c_str(),t_number.c_str()); + if (devices.count(t_number)) { + devices[number].call(&devices[t_number]); + } + else devices[number].call(&devices["default"]); + } + if(tokens[3].find("call confirmed")!=string::npos) { + string t_number=split(tokens[3],' ')[4]; + printf("ringing from %s to %s\n",number.c_str(),t_number.c_str()); + if (devices.count(t_number)) { + devices[number].ringing(&devices[t_number]); + } + } + if(tokens[3].find("connect to")!=string::npos) { + string t_number=split(tokens[3],' ')[3]; + printf("call connected from %s to %s\n",number.c_str(),t_number.c_str()); + if (devices.count(t_number)) { + devices[number].connectCall(); + } } - printf("%s\n",imsi.c_str()); + if(tokens[3].find("GSM release")!=string::npos) devices[number].endCall(); + + } else printf("%s\n",tokens[0].c_str()); } @@ -168,9 +241,8 @@ void testApp::update(){ //-------------------------------------------------------------- void testApp::draw(){ - if (ofRandom(1.0)>0.99) start=min(99,start+1); - if (ofRandom(1.0)>0.98) end=min(99,end+1); + ofSetLineWidth(1.5f); glDisable(GL_LIGHTING); bgimg.draw(0,0,windowWidth,windowHeight); -- cgit v1.2.3