From 9642f41ffa762213dc947407ac2ca484b14fd5c7 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Sat, 30 Jun 2012 18:45:03 +0100 Subject: segfaults intermittently --- src/obtsDevice.cpp | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) (limited to 'src/obtsDevice.cpp') 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::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); -- cgit v1.2.3