summaryrefslogtreecommitdiff
path: root/src/obtsDevice.h
blob: 5f01277df0549bfd6af1d57d2d6ba588e4a5c8a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#ifndef OBTSDEVICE_H
#define OBTSDEVICE_H

#include "ofMain.h"

/*
created with icon, colour, linesize etc
in order to draw need to know:

time now: in order to draw relatively (this is not actual time as it can draw historically)
scale: fixed (defined at object creation)
or always zoom out? (begin time defined at object creation)

events: connect(is create) disconnect() call(* obtsDevice) hangup() sms(* obtsDevice)
functions: draw(time) getPosition(time) 

variables: pointer to icon image

//draw the icons - passed the IMEI
//colours for networks
//connect & disconnect

*/

class obtsDevice;  //forward declaration

struct timeseg{
	timeseg(){
		startTime=ofGetElapsedTimef();
		endTime=0.0f;
	}
	float startTime;
	float endTime;
};

struct tsms{
	tsms(obtsDevice* to){ 
		recipient=to;
		time=ofGetElapsedTimef();
	}
	obtsDevice *recipient;
	float time;
};

struct tcall{
	tcall(obtsDevice* to,bool _connected){
		recipient=to;
		startTime=ofGetElapsedTimef();
		endTime=0.0f;
		connected=_connected;
		if (connected) connectedTime=startTime;
		else connectedTime=0.0f;
	}
	void connect(){
		connected=true;
		connectedTime=ofGetElapsedTimef();
	}
	obtsDevice *recipient;
	float startTime;
	float connectedTime;
	float endTime;
	bool connected;
};


class obtsDevice
{
    public:
	obtsDevice();
        obtsDevice(string &imsi,string &imei,string &num,ofImage *_icon,ofVec2f _coords);
        virtual ~obtsDevice();
	void draw(float ts); //units per second
	void connect();
	void disconnect();
	void ringing(obtsDevice *to);
	void call(obtsDevice *to);
	void connectCall();
	void endCall();
	void sms(obtsDevice *to);
	void excite(float amount=0.99);
	float timeCoord(float t);
    protected:
    private:
	float exciteLevel;
	float lastUsed;
	float timeScale;
	string IMSI,IMEI,number;
	ofVec2f coords; //angular coords
	vector<timeseg> connectionHistory;
	vector<tsms> smsHistory; //argle
	vector<tcall> callHistory;
	ofImage *icon;
	bool active,calling;
    
	float lastTime;
    
	ofColor colour;
};




#endif // OBTSDEVICE_H