diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.cpp | 2 | ||||
| -rw-r--r-- | src/obtsDevice.cpp | 41 | ||||
| -rw-r--r-- | src/testApp.cpp | 72 |
3 files changed, 59 insertions, 56 deletions
diff --git a/src/main.cpp b/src/main.cpp index ad74a97..904ded2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6,7 +6,7 @@ int main( ){ ofAppGlutWindow window; - ofSetupOpenGL(&window, 450,800, OF_WINDOW ); // <-------- setup the GL context + ofSetupOpenGL(&window, 1440,900, OF_FULLSCREEN); // <-------- setup the GL context printf("%ix%i on screen %ix%i\n",ofGetWidth(),ofGetHeight(),ofGetScreenWidth(),ofGetScreenHeight()); // this kicks off the running of my app // can be OF_WINDOW or OF_FULLSCREEN diff --git a/src/obtsDevice.cpp b/src/obtsDevice.cpp index 630af69..ebb1fb6 100644 --- a/src/obtsDevice.cpp +++ b/src/obtsDevice.cpp @@ -15,15 +15,15 @@ obtsDevice::obtsDevice(string &imsi,string &imei,string &num,ofImage *_icon,ofVe calling=false;
exciteLevel=0.99;
lastTime=ofGetElapsedTimef();
-
-
+
+
if (IMSI.size()) {
-
+
//colour based on IMSI
string cc=IMSI.substr(3,2);
-
+
printf("new device: carrier code %s\n",cc.c_str());
-
+
if(!cc.compare("02")) { //O2
colour=ofColor(0,88,150);
}
@@ -42,7 +42,7 @@ obtsDevice::obtsDevice(string &imsi,string &imei,string &num,ofImage *_icon,ofVe else colour=ofColor(160,160,160);
}
else colour=ofColor(0,0,0);
-
+
}
obtsDevice::~obtsDevice()
@@ -116,23 +116,23 @@ void obtsDevice::draw(float t) timeScale=t;
float decay=2.0;
float now=ofGetElapsedTimef();
- if ((now-lastUsed) > 6000) disconnect(); //connection timeout 10 minutes
+ if ((now-lastUsed) > 600) disconnect(); //connection timeout 10 minutes
float timeSeg=now-lastTime;
lastTime=now;
- //draw a line at the angular position of the device
+ //draw a line at the angular position of the device
//z=0 is the 'surface' i.e. now.
- //the device know the time now and when it was created
+ //the device know the time now and when it was created
//needs to know the time the app began in order to scale the line vertically
//dynamic scaling or fixed vertical scale?
//for dynamic, just scale vertically based on time
//for fixed/dynamic, pass a scaling parameter when drawing
-
+
//enable depth? possible?
//colour based on IMSI, excitation and movement
//sms and calls coloured based on the phone that made them.
-
+
if (connectionHistory.size()) {
-
+
float rf=sin((coords.y/(ofGetWidth()*0.9))*TWO_PI);
ofSetColor(colour); //*rf);
float endPos;
@@ -147,9 +147,9 @@ void obtsDevice::draw(float t) float timepos=-timeCoord(now-(*i).time);
ofLine(cos(coords.x)*coords.y,sin(coords.x)*coords.y,timepos,cos((*i).recipient->coords.x)*(*i).recipient->coords.y,sin((*i).recipient->coords.x)*(*i).recipient->coords.y,timepos);
}
-
+
ofEnableAlphaBlending();
-
+
for (vector<tcall>::iterator i=callHistory.begin();i!=callHistory.end();i++){
float stimepos=-timeCoord(now-(*i).startTime);
float etimepos=((*i).endTime>0.0f?-timeCoord(now-(*i).endTime):0.0f);
@@ -171,12 +171,15 @@ void obtsDevice::draw(float t) glVertex3f(cos((*i).recipient->coords.x)*(*i).recipient->coords.y,sin((*i).recipient->coords.x)*(*i).recipient->coords.y,etimepos);
glVertex3f(cos(coords.x)*coords.y,sin(coords.x)*coords.y,etimepos);
glEnd();
- }
- }
-
+ } + if (((*i).endTime<0.1f)&&((now-(*i).startTime)>30.0f)) endCall();
+ } + +
+
ofDisableAlphaBlending();
-
- int greylev=0x7f+((int)(128.0f*exciteLevel));
+
+ int greylev=160+((int)(95.0f*exciteLevel));
//printf("%s %i\n",number.c_str(),greylev);
ofSetColor(greylev,greylev,greylev,0xff);
ofSetDrawBitmapMode(OF_BITMAPMODE_MODEL_BILLBOARD);
diff --git a/src/testApp.cpp b/src/testApp.cpp index 7b28acd..8be99a6 100644 --- a/src/testApp.cpp +++ b/src/testApp.cpp @@ -66,8 +66,8 @@ void testApp::setup(){ int windowMode = ofGetWindowMode(); if(windowMode == OF_FULLSCREEN){ - this->windowWidth = ofGetScreenWidth(); - this->windowHeight = ofGetScreenHeight(); + this->windowWidth = ofGetWidth(); //Screen + this->windowHeight = ofGetHeight(); //Screen } else if(windowMode == OF_WINDOW){ this->windowWidth = ofGetWidth(); @@ -90,16 +90,16 @@ void testApp::setup(){ ofEnableSmoothing(); camera.setPosition(0,windowHeight*10,windowHeight); - camera.lookAt(ofVec3f(0,0,-windowHeight*.5),ofVec3f(0, 0, 1)); + camera.lookAt(ofVec3f(0,0,-windowHeight*.49),ofVec3f(0, 0, 1)); camera.setFov(6.5); - camera.cacheMatrices(); +// camera.cacheMatrices();3047 bgimg.allocate(256,256,OF_IMAGE_COLOR); cols=new ofColor[4]; - cols[0]=ofColor(80,80,120); - cols[1]=ofColor(80,80,80); + cols[0]=ofColor(100,100,150); + cols[1]=ofColor(100,100,100); cols[2]=ofColor(0,0,0); cols[3]=ofColor(0,0,0); float fi,fj,ifi,ifj; @@ -134,42 +134,42 @@ void testApp::setup(){ udpConnection.Create(); udpConnection.Bind(7888); udpConnection.SetNonBlocking(true); - + string def=""; devices["base"]=obtsDevice(def,def,def,icons,ofVec2f(0,0)); devices["base"].connect(); - + message=""; messageTime=0.0f; - + showFps=false; } //-------------------------------------------------------------- void testApp::update(){ - + //check incoming messages //create device or update as necessary //also display a feed of events in text form - + /* - + MESSAGE FORMAT NETWORK - + * "GSM joined network" for a first time connection * "GSM rejoined network" for a phone coming back - * "GSM leaving network" for a phone leaving. (Though these can't be relied upon) + * "GSM leaving network" for a phone leaving. (Though these can't be relied upon) SMS - + * "SMS to IMSIXXXXXXXXXXXXXXX queued for sending" for an attempt to text a valid number * "SMS to XX failed. Number not found" for an attempt to text an invalid number * "SMS Message acknowledged" A message sent by this IMSI was delivered. - + CALLS a.) To a non-mobile number: @@ -179,11 +179,11 @@ void testApp::update(){ b.) To a mobile number: - * "GSM alerting <phone_number>" when ringing. + * "GSM alerting <phone_number>" when ringing. * "GSM call confirmed to <phone_number>" when ringing at both ends. * "GSM connect to <phone_number>" at pickup. * "GSM disconnect" as above at end, then "GSM release from <phone_number". - + username: "tim" password: "Visualise this" host: 134.226.86.120 @@ -194,7 +194,7 @@ void testApp::update(){ > mysql -u tim -h 134.226.86.120 -p <Enter password> > use openbts - + */ char udpMessage[1024]; udpConnection.Receive(udpMessage,1024); @@ -215,16 +215,16 @@ void testApp::update(){ float r=ofRandom(windowWidth/3)+(windowWidth/6); devices[number]=obtsDevice(imsi,imei,number,icons,ofVec2f(a,r)); } - + if(tokens[3].find("retreived")==string::npos) 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],' ')[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[t_number].connect(); //just in case it hasnt been recognised + devices[t_number].excite(); //just in case it hasnt been recognised devices[number].sms(&devices[t_number]); } } @@ -232,16 +232,16 @@ void testApp::update(){ 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[t_number].connect(); //just in case it hasnt been recognised + devices[t_number].excite(); //just in case it hasnt been recognised devices[number].call(&devices[t_number]); } - else devices[number].call(&devices["default"]); + else devices[number].call(&devices["base"]); } 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[t_number].connect(); //just in case it hasnt been recognised + devices[t_number].excite(); //just in case it hasnt been recognised devices[number].ringing(&devices[t_number]); } } @@ -249,13 +249,13 @@ void testApp::update(){ 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[t_number].connect(); //just in case it hasnt been recognised + devices[t_number].excite(); //just in case it hasnt been recognised devices[number].connectCall(); } } if(tokens[3].find("GSM release")!=string::npos) devices[number].endCall(); - - + + } } } @@ -269,10 +269,10 @@ void testApp::draw(){ glDisable(GL_LIGHTING); ofSetHexColor(0xffffff); bgimg.draw(0,0,windowWidth,windowHeight); - + ofEnableAlphaBlending(); - ofSetColor(0xff,0xff,0xff,0x1f); - textimg.draw(0,windowHeight-textimg.getHeight()); + ofSetColor(0xff,0xff,0xff,0x5f); + textimg.draw(0,windowHeight-(textimg.getHeight()*2),textimg.getWidth()*2,textimg.getHeight()*2); ofDisableAlphaBlending(); camera.begin(); @@ -323,16 +323,16 @@ void testApp::draw(){ camera.end(); ofSetHexColor(0xffffff); - + char reportStr[1024]; - + if (showFps) { sprintf(reportStr, "fps: %3.0f", ofGetFrameRate()); ofDrawBitmapString(reportStr, windowWidth-70, 12); } - - int amt=255-((ofGetElapsedTimef()-messageTime)*25.0f); + + int amt=255-((ofGetElapsedTimef()-messageTime)*8.0f); if (amt>0) { //ofEnableAlphaBlending(); ofSetColor(amt,amt,amt); @@ -341,7 +341,7 @@ void testApp::draw(){ //ofDisableAlphaBlending(); } - + //ofSaveFrame(); } |
