summaryrefslogtreecommitdiff
path: root/src/testApp.cpp
diff options
context:
space:
mode:
authorTim Redfern <tim@eclectronics.org>2012-06-30 18:45:03 +0100
committerTim Redfern <tim@eclectronics.org>2012-06-30 18:45:03 +0100
commit9642f41ffa762213dc947407ac2ca484b14fd5c7 (patch)
tree7156f3b2ef85f4b6fe1f743817dd3cf1080af01b /src/testApp.cpp
parent4525c22d902e1eff47d6a8a64d022d885ac3a76a (diff)
segfaults intermittently
Diffstat (limited to 'src/testApp.cpp')
-rw-r--r--src/testApp.cpp72
1 files changed, 36 insertions, 36 deletions
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();
}