summaryrefslogtreecommitdiff
path: root/src/testApp.cpp
diff options
context:
space:
mode:
authorTim Redfern <tim@eclectronics.org>2012-06-29 18:36:46 +0100
committerTim Redfern <tim@eclectronics.org>2012-06-29 18:36:46 +0100
commitafed229f7f70d51313239394f6e1079fa6086da3 (patch)
tree4a2573cadf335eff1201f5a4833dcabf963d1151 /src/testApp.cpp
parent4fdefc87b20f2a0c10f6497232edb9fd0cdfd58a (diff)
nearly finished
Diffstat (limited to 'src/testApp.cpp')
-rw-r--r--src/testApp.cpp39
1 files changed, 31 insertions, 8 deletions
diff --git a/src/testApp.cpp b/src/testApp.cpp
index cc15122..9de5fab 100644
--- a/src/testApp.cpp
+++ b/src/testApp.cpp
@@ -39,6 +39,13 @@ basically working
-fading feature
-draw incoming events text
+//logarithmic time
+//better colours/ thicker lines?
+//line in middle?
+//colours from networks
+//ripples from events
+//ringing and connected segments of call - polygons much more transparent
+
*/
std::vector<std::string> split(std::string l, char delim)
@@ -111,6 +118,7 @@ void testApp::setup(){
}
}
+ textimg.loadImage("text.png");
bgimg.setUseTexture(true);
@@ -130,9 +138,12 @@ void testApp::setup(){
string def="";
devices["base"]=obtsDevice(def,def,def,icons,ofVec2f(0,0));
+ devices["base"].connect();
message="";
messageTime=0.0f;
+
+ showFps=false;
}
@@ -191,7 +202,7 @@ void testApp::update(){
if(mess.length()){
messageTime=ofGetElapsedTimef();
printf("%s\n",mess.c_str());
- vector<string> tokens=split(mess,',');
+ vector<string> tokens=split(mess,'^');
//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")) { //this is an event
message=tokens[0]+" "+tokens[3];
@@ -208,15 +219,15 @@ void testApp::update(){
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());
+ string t_number=split(tokens[3],' ')[4];
+ printf(">>> SMS from %s to %s (%i)\n",number.c_str(),t_number.c_str(),devices.count(t_number));
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());
+ 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]);
}
@@ -224,14 +235,14 @@ void testApp::update(){
}
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());
+ 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());
+ printf(">>> call connected from %s to %s\n",number.c_str(),t_number.c_str());
if (devices.count(t_number)) {
devices[number].connectCall();
}
@@ -245,12 +256,18 @@ void testApp::update(){
//--------------------------------------------------------------
void testApp::draw(){
+ devices["base"].excite();
ofSetLineWidth(1.5f);
glDisable(GL_LIGHTING);
ofSetHexColor(0xffffff);
bgimg.draw(0,0,windowWidth,windowHeight);
+
+ ofEnableAlphaBlending();
+ ofSetColor(0xff,0xff,0xff,0x1f);
+ textimg.draw(0,windowHeight-textimg.getHeight());
+ ofDisableAlphaBlending();
camera.begin();
@@ -300,9 +317,13 @@ void testApp::draw(){
camera.end();
ofSetHexColor(0xffffff);
+
char reportStr[1024];
- sprintf(reportStr, "fps: %3.0f", ofGetFrameRate());
- ofDrawBitmapString(reportStr, windowWidth-70, 12);
+
+ if (showFps) {
+ sprintf(reportStr, "fps: %3.0f", ofGetFrameRate());
+ ofDrawBitmapString(reportStr, windowWidth-70, 12);
+ }
int amt=255-((ofGetElapsedTimef()-messageTime)*25.0f);
@@ -325,6 +346,8 @@ void testApp::keyPressed(int key){
ofSaveFrame();
printf("[%8.2f] saved an image\n",ofGetElapsedTimef());
break;
+ case 'f':
+ showFps=!showFps;
}
}