summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xeventStreamer/config.local6
-rwxr-xr-xeventStreamer/config.py6
-rw-r--r--openBTSviz.layout12
-rw-r--r--src/main.cpp2
-rw-r--r--src/obtsDevice.cpp4
-rw-r--r--src/testApp.cpp143
-rw-r--r--src/testApp.h9
7 files changed, 107 insertions, 75 deletions
diff --git a/eventStreamer/config.local b/eventStreamer/config.local
deleted file mode 100755
index 02b8af0..0000000
--- a/eventStreamer/config.local
+++ /dev/null
@@ -1,6 +0,0 @@
-mysql_ip="127.0.0.1"
-mysql_user="openBTS"
-mysql_pword="openBTS"
-mysql_db="openBTS_01"
-viz_port=7888
-viz_ip="127.0.0.1" \ No newline at end of file
diff --git a/eventStreamer/config.py b/eventStreamer/config.py
index 1b9fe51..707ab83 100755
--- a/eventStreamer/config.py
+++ b/eventStreamer/config.py
@@ -1,6 +1,6 @@
-mysql_ip="134.226.86.120"
-mysql_user="tim"
-mysql_pword="Visualise this"
+mysql_ip="127.0.0.1"
+mysql_user="openBTS"
+mysql_pword="openBTS"
mysql_db="openbts"
viz_port=7888
viz_ip="127.0.0.1" \ No newline at end of file
diff --git a/openBTSviz.layout b/openBTSviz.layout
index 49cf98f..3cf6ef2 100644
--- a/openBTSviz.layout
+++ b/openBTSviz.layout
@@ -10,19 +10,19 @@
<File name="config.make" open="1" top="0" tabpos="3">
<Cursor position="328" topLine="0" />
</File>
- <File name="src/main.cpp" open="1" top="0" tabpos="5">
- <Cursor position="215" topLine="0" />
+ <File name="src/main.cpp" open="1" top="1" tabpos="5">
+ <Cursor position="235" topLine="0" />
</File>
<File name="src/obtsDevice.cpp" open="1" top="0" tabpos="7">
- <Cursor position="674" topLine="142" />
+ <Cursor position="5589" topLine="149" />
</File>
<File name="src/obtsDevice.h" open="1" top="0" tabpos="8">
<Cursor position="1726" topLine="10" />
</File>
- <File name="src/testApp.cpp" open="1" top="1" tabpos="6">
- <Cursor position="6717" topLine="184" />
+ <File name="src/testApp.cpp" open="1" top="0" tabpos="6">
+ <Cursor position="10057" topLine="299" />
</File>
<File name="src/testApp.h" open="1" top="0" tabpos="4">
- <Cursor position="629" topLine="0" />
+ <Cursor position="815" topLine="4" />
</File>
</CodeBlocks_layout_file>
diff --git a/src/main.cpp b/src/main.cpp
index 904ded2..7119c0b 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -6,7 +6,7 @@
int main( ){
ofAppGlutWindow window;
- ofSetupOpenGL(&window, 1440,900, OF_FULLSCREEN); // <-------- setup the GL context
+ ofSetupOpenGL(&window, 1600,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 ebb1fb6..5677d0a 100644
--- a/src/obtsDevice.cpp
+++ b/src/obtsDevice.cpp
@@ -116,7 +116,7 @@ void obtsDevice::draw(float t)
timeScale=t;
float decay=2.0;
float now=ofGetElapsedTimef();
- if ((now-lastUsed) > 600) disconnect(); //connection timeout 10 minutes
+ if ((now-lastUsed) > 6) disconnect(); //connection timeout 10 minutes
float timeSeg=now-lastTime;
lastTime=now;
//draw a line at the angular position of the device
@@ -172,7 +172,7 @@ void obtsDevice::draw(float t)
glVertex3f(cos(coords.x)*coords.y,sin(coords.x)*coords.y,etimepos);
glEnd();
}
- if (((*i).endTime<0.1f)&&((now-(*i).startTime)>30.0f)) endCall();
+ if (((*i).endTime<0.1f)&&((now-(*i).startTime)>3.0f)) endCall(); //was 30
}
diff --git a/src/testApp.cpp b/src/testApp.cpp
index 8be99a6..5830c12 100644
--- a/src/testApp.cpp
+++ b/src/testApp.cpp
@@ -144,6 +144,11 @@ void testApp::setup(){
messageTime=0.0f;
showFps=false;
+
+ dragStartX=dragStartY=0;
+ dragSavedX=dragSavedY=dragOffsX=dragOffsY=0.0f;
+
+ ofBackground(0);
}
@@ -204,57 +209,75 @@ void testApp::update(){
printf("%s\n",mess.c_str());
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];
- 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/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].excite(); //just in case it hasnt been recognised
- 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[t_number].excite(); //just in case it hasnt been recognised
- devices[number].call(&devices[t_number]);
- }
- 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].excite(); //just in case it hasnt been recognised
- 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[t_number].excite(); //just in case it hasnt been recognised
- devices[number].connectCall();
- }
- }
- if(tokens[3].find("GSM release")!=string::npos) devices[number].endCall();
-
+ if (tokens.size()>3) {
+ if (!tokens[0].substr(0,4).compare("IMSI")) { //this is an event
+ message=tokens[0]+" "+tokens[3];
+ 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/3)+(windowWidth/6);
+
+ float x=cos(a)*r;
+ float y=sin(a)*r;
+
+ //add subtlety
+ //for (int i=0;i<devices.size()) {
+ // float d=
+ //}
+
+ 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) {
+ if (split(tokens[3],' ').size()>4) {
+ 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].excite(); //just in case it hasnt been recognised
+ devices[number].sms(&devices[t_number]);
+ }
+ }
+ }
+ if(tokens[3].find("connect acknowledge")!=string::npos) {
+ if (split(tokens[3],' ').size()>3) {
+ 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].excite(); //just in case it hasnt been recognised
+ devices[number].call(&devices[t_number]);
+ }
+ else devices[number].call(&devices["base"]);
+ }
+ }
+ if(tokens[3].find("call confirmed")!=string::npos) {
+ if (split(tokens[3],' ').size()>4) {
+ 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].excite(); //just in case it hasnt been recognised
+ devices[number].ringing(&devices[t_number]);
+ }
+ }
+ }
+ if(tokens[3].find("connect to")!=string::npos) {
+ if (split(tokens[3],' ').size()>3) {
+ 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].excite(); //just in case it hasnt been recognised
+ devices[number].connectCall();
+ }
+ }
+ }
+ if(tokens[3].find("GSM release")!=string::npos) devices[number].endCall();
+ }
}
}
@@ -272,7 +295,7 @@ void testApp::draw(){
ofEnableAlphaBlending();
ofSetColor(0xff,0xff,0xff,0x5f);
- textimg.draw(0,windowHeight-(textimg.getHeight()*2),textimg.getWidth()*2,textimg.getHeight()*2);
+ textimg.draw(0,windowHeight-(textimg.getHeight())); //*2),textimg.getWidth()*2,textimg.getHeight()*2);
ofDisableAlphaBlending();
camera.begin();
@@ -284,6 +307,8 @@ void testApp::draw(){
ofPushMatrix();
ofRotate(ofGetElapsedTimef(),0,0,1);
+ ofRotate(dragOffsX,0,0,1);
+ ofRotate(dragOffsY,1,0,0);
ofNoFill();
@@ -369,17 +394,27 @@ void testApp::mouseMoved(int x, int y ){
//--------------------------------------------------------------
void testApp::mouseDragged(int x, int y, int button){
-
+ dragOffsX=dragSavedX+(x-dragStartX);
+ dragOffsY=dragSavedY+(y-dragStartY);
+ //if (button) {
+ // printf("drag: %f,%f\n",dragOffsX,dragOffsY);
+ //}
}
//--------------------------------------------------------------
void testApp::mousePressed(int x, int y, int button){
+ dragStartX=x;
+ dragStartY=y;
+ //if (button) {
+ // printf("start: %i %i,%i\n",button,x,y);
+ //}
}
//--------------------------------------------------------------
void testApp::mouseReleased(int x, int y, int button){
-
+ dragSavedX+=x-dragStartX;
+ dragSavedY+=y-dragStartY;
}
//--------------------------------------------------------------
diff --git a/src/testApp.h b/src/testApp.h
index 98c4527..b8066e0 100644
--- a/src/testApp.h
+++ b/src/testApp.h
@@ -25,7 +25,7 @@ class testApp : public ofBaseApp{
ofxUDPManager udpConnection;
ofCamera camera;
-
+
map<string,obtsDevice> devices;
ofImage bgimg;
@@ -33,11 +33,14 @@ class testApp : public ofBaseApp{
ofColor *cols;
ofImage *icons;
-
+
string message;
float messageTime;
-
+
bool showFps;
+ int dragStartX,dragStartY;
+ float dragSavedX,dragSavedY,dragOffsX,dragOffsY;
+
};