msg-chumby-display 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bin/msg-chumby-daemon +6 -1
- data/etc/msgchumbydaemonrc +7 -4
- data/lib/msg-chumby-daemon/http-xml-server.rb +20 -1
- data/widget/currentpower/currentpower Report.txt +1 -1
- data/widget/currentpower/currentpower.swd +0 -0
- data/widget/currentpower/currentpower.swf +0 -0
- data/widget/last_reading/DataArray.as +116 -0
- data/widget/last_reading/Gluehlampe.fla +0 -0
- data/widget/last_reading/Gluehlampe.swf +0 -0
- data/widget/last_reading/Gluehlampe_frames.fla +0 -0
- data/widget/last_reading/Gluehlampe_frames.swf +0 -0
- data/widget/last_reading/Makefile +30 -0
- data/widget/last_reading/Makefile.orig +60 -0
- data/widget/last_reading/README.rdoc +50 -0
- data/widget/last_reading/README.rtf +57 -0
- data/widget/last_reading/XmlParse.as +1 -0
- data/widget/last_reading/caurina/transitions/AuxFunctions.as +88 -0
- data/widget/last_reading/caurina/transitions/Equations.as +713 -0
- data/widget/last_reading/caurina/transitions/PropertyInfoObj.as +86 -0
- data/widget/last_reading/caurina/transitions/SpecialProperty.as +48 -0
- data/widget/last_reading/caurina/transitions/SpecialPropertyModifier.as +39 -0
- data/widget/last_reading/caurina/transitions/SpecialPropertySplitter.as +46 -0
- data/widget/last_reading/caurina/transitions/TweenListObj.as +227 -0
- data/widget/last_reading/caurina/transitions/Tweener.as +1121 -0
- data/widget/last_reading/caurina/transitions/properties/ColorShortcuts.as +471 -0
- data/widget/last_reading/caurina/transitions/properties/CurveModifiers.as +104 -0
- data/widget/last_reading/caurina/transitions/properties/DisplayShortcuts.as +158 -0
- data/widget/last_reading/caurina/transitions/properties/FilterShortcuts.as +516 -0
- data/widget/last_reading/caurina/transitions/properties/SoundShortcuts.as +83 -0
- data/widget/last_reading/caurina/transitions/properties/TextShortcuts.as +151 -0
- data/widget/last_reading/energietacho.fla +0 -0
- data/widget/last_reading/energietacho.swf +0 -0
- metadata +30 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/bin/msg-chumby-daemon
CHANGED
@@ -92,6 +92,11 @@ else
|
|
92
92
|
end
|
93
93
|
local_id=$CONFIG['FLUKSO_LOCAL_ID']
|
94
94
|
puts "Using Flukso at location #{location} with ID #{local_id}" if $verbose
|
95
|
+
low_bound=$CONFIG['CONSUMPTION_LOW']
|
96
|
+
mid_bound=$CONFIG['CONSUMPTION_MID']
|
97
|
+
high_bound=$CONFIG['CONSUMPTION_HIGH']
|
98
|
+
boundaries = {:low => low_bound, :mid => mid_bound, :high => high_bound}
|
99
|
+
puts "with consumption boundaries #{boundaries}" if $verbose
|
95
100
|
end
|
96
101
|
|
97
102
|
reading_cache=MSG_Chumby::Reading_Cache.new();
|
@@ -101,7 +106,7 @@ $lasthour_importer=MSG_Chumby::LastHourImporter.new(reading_cache, sensor_id, to
|
|
101
106
|
$lastday_importer=MSG_Chumby::LastDayImporter.new(reading_cache, sensor_id, token);
|
102
107
|
$shortterm_thread=nil;
|
103
108
|
$longterm_thread=nil;
|
104
|
-
$server=MSG_Chumby::HTTP_XML_Server.new("0.0.0.0", 3000, reading_cache);
|
109
|
+
$server=MSG_Chumby::HTTP_XML_Server.new("0.0.0.0", 3000, reading_cache, boundaries);
|
105
110
|
|
106
111
|
|
107
112
|
def startAll
|
data/etc/msgchumbydaemonrc
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
# These are the access parameters of the CC-HPC demo flukso - replace
|
2
2
|
# with your own parameters!
|
3
|
-
ACCESS_TOKEN: "
|
4
|
-
SENSOR_ID: "
|
3
|
+
ACCESS_TOKEN: "3f05b2e0ae297c4b850bd2608a79448a"
|
4
|
+
SENSOR_ID: "aefd1e23cbbf573cb7b8624aa474fced"
|
5
5
|
FLUKSO_LOCATION_METHOD: "static"
|
6
|
-
FLUKSO_HOST: "
|
6
|
+
FLUKSO_HOST: "flukso.kl.dfki.de"
|
7
7
|
FLUKSO_PORT: "80"
|
8
|
-
FLUKSO_LOCAL_ID: "
|
8
|
+
FLUKSO_LOCAL_ID: "aefd1e23cbbf573cb7b8624aa474fced"
|
9
|
+
CONSUMPTION_LOW: "150"
|
10
|
+
CONSUMPTION_MID: "800"
|
11
|
+
CONSUMPTION_HIGH: "2000"
|
@@ -152,8 +152,25 @@ module MSG_Chumby
|
|
152
152
|
end
|
153
153
|
end
|
154
154
|
|
155
|
+
class BoundaryHandler < Mongrel::HttpHandler
|
156
|
+
def initialize(boundaries)
|
157
|
+
@boundaries =
|
158
|
+
{'low' => [boundaries[:low]],
|
159
|
+
'mid' => [boundaries[:mid]],
|
160
|
+
'high' => [boundaries[:high]]}
|
161
|
+
@cached_document=XmlSimple.xml_out(@boundaries ,{'RootName' => "consumption"})
|
162
|
+
end
|
163
|
+
def process(request, response)
|
164
|
+
response.start(200) do |head,out|
|
165
|
+
head["Content-Type"] = "text/xml"
|
166
|
+
out.write(@cached_document);
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
|
155
172
|
class HTTP_XML_Server
|
156
|
-
def initialize(host, port, reading_cache)
|
173
|
+
def initialize(host, port, reading_cache, boundaries)
|
157
174
|
@server = Mongrel::HttpServer.new(host, port)
|
158
175
|
@server.register("/time", TimeHandler.new)
|
159
176
|
@server.register("/reset", ResetHandler.new)
|
@@ -161,6 +178,8 @@ module MSG_Chumby
|
|
161
178
|
@server.register("/last_minute", LastMinuteHandler.new(reading_cache))
|
162
179
|
@server.register("/last_hour", LastHourHandler.new(reading_cache))
|
163
180
|
@server.register("/last_day", LastDayHandler.new(reading_cache))
|
181
|
+
@server.register("/last_day", LastDayHandler.new(reading_cache))
|
182
|
+
@server.register("/boundary_values", BoundaryHandler.new(boundaries))
|
164
183
|
end
|
165
184
|
def start
|
166
185
|
@threads=@server.run
|
@@ -5,7 +5,7 @@ Metadaten
|
|
5
5
|
---------
|
6
6
|
Byte Wert
|
7
7
|
---- ----
|
8
|
-
1290 <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf:Description rdf:about="" xmlns:xmp="http://ns.adobe.com/xap/1.0/"> <xmp:CreatorTool>Adobe Flash CS4 Professional</xmp:CreatorTool> <xmp:CreateDate>2010-03-15T15:58:56+01:00</xmp:CreateDate> <xmp:MetadataDate>2010-
|
8
|
+
1290 <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf:Description rdf:about="" xmlns:xmp="http://ns.adobe.com/xap/1.0/"> <xmp:CreatorTool>Adobe Flash CS4 Professional</xmp:CreatorTool> <xmp:CreateDate>2010-03-15T15:58:56+01:00</xmp:CreateDate> <xmp:MetadataDate>2010-08-16T11:25:22+02:00</xmp:MetadataDate> <xmp:ModifyDate>2010-08-16T11:25:22+02:00</xmp:ModifyDate> </rdf:Description> <rdf:Description rdf:about="" xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/" xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#"> <xmpMM:InstanceID>xmp.iid:F77F1174072068118F62A77E962FFA57</xmpMM:InstanceID> <xmpMM:DocumentID>xmp.did:F77F1174072068118F62A77E962FFA57</xmpMM:DocumentID> <xmpMM:OriginalDocumentID>xmp.did:F77F11740720681193E68700E4C8E173</xmpMM:OriginalDocumentID> <xmpMM:DerivedFrom rdf:parseType="Resource"> <stRef:instanceID>xmp.iid:F87F11740720681191099C69294AD041</stRef:instanceID> <stRef:documentID>xmp.did:F87F11740720681191099C69294AD041</stRef:documentID> <stRef:originalDocumentID>xmp.did:F77F11740720681193E68700E4C8E173</stRef:originalDocumentID> </xmpMM:DerivedFrom> </rdf:Description> <rdf:Description rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/"> <dc:format>application/x-shockwave-flash</dc:format> </rdf:Description> </rdf:RDF>
|
9
9
|
|
10
10
|
Bild # Bild Byte Gesamt Byte Szene
|
11
11
|
------ --------- ----------- ----------------
|
Binary file
|
Binary file
|
@@ -0,0 +1,116 @@
|
|
1
|
+
class DataArray
|
2
|
+
{
|
3
|
+
|
4
|
+
var dataArray;
|
5
|
+
var _numValues;
|
6
|
+
|
7
|
+
public function DataArray(numValues:Number)
|
8
|
+
{
|
9
|
+
// constructor code
|
10
|
+
//trace("dA constructor");
|
11
|
+
dataArray = new Array(numValues);
|
12
|
+
//trace("length" + dataArray.length);
|
13
|
+
_numValues = numValues;
|
14
|
+
initArray();
|
15
|
+
}
|
16
|
+
|
17
|
+
function initArray()
|
18
|
+
{
|
19
|
+
//trace("init Array");
|
20
|
+
var dal:Number = dataArray.length;
|
21
|
+
//trace("length " + dal);
|
22
|
+
|
23
|
+
for (var i:Number = 0; i < dal; i++)
|
24
|
+
{
|
25
|
+
//trace(i);
|
26
|
+
dataArray[i] = 0;
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
|
31
|
+
function max()
|
32
|
+
{
|
33
|
+
var max:Number = 0;
|
34
|
+
|
35
|
+
for (var i:Number = 0; i < dataArray.length; i++)
|
36
|
+
{
|
37
|
+
if (dataArray[i] > max)
|
38
|
+
{
|
39
|
+
max = dataArray[i];
|
40
|
+
}
|
41
|
+
}
|
42
|
+
return max;
|
43
|
+
}
|
44
|
+
|
45
|
+
function min()
|
46
|
+
{
|
47
|
+
var min:Number = dataArray[0];
|
48
|
+
|
49
|
+
for (var i:Number = 1; i < dataArray.length; i++)
|
50
|
+
{
|
51
|
+
if (dataArray[i] < min)
|
52
|
+
{
|
53
|
+
min = dataArray[i];
|
54
|
+
}
|
55
|
+
}
|
56
|
+
return min;
|
57
|
+
}
|
58
|
+
|
59
|
+
public function addValue(val:Number){
|
60
|
+
//trace("addValue");
|
61
|
+
dataArray.reverse();
|
62
|
+
dataArray.pop();
|
63
|
+
dataArray.reverse();
|
64
|
+
//var help = parseInt(value_reading);
|
65
|
+
dataArray.push(val);
|
66
|
+
|
67
|
+
}
|
68
|
+
|
69
|
+
public function getDataArray(){
|
70
|
+
//trace("da:" +dataArray);
|
71
|
+
return dataArray;
|
72
|
+
}
|
73
|
+
|
74
|
+
public function getNow():Number{
|
75
|
+
return dataArray[_numValues - 1];
|
76
|
+
}
|
77
|
+
// Gibt den Durchschnitt des kompletten DataArrays zurück
|
78
|
+
public function average():Number{
|
79
|
+
var avg:Number = 0;
|
80
|
+
for(var i:Number = 0; i < _numValues; i++){
|
81
|
+
avg += dataArray[i];
|
82
|
+
}
|
83
|
+
avg = Math.round(avg / _numValues);
|
84
|
+
return avg;
|
85
|
+
}
|
86
|
+
// Gibt den Durchschnitt der ersten "num" Zahlen im DataArray zurück
|
87
|
+
public function average_number(num:Number):Number{
|
88
|
+
var avg:Number = 0;
|
89
|
+
for(var i:Number = 0; i <num; i++){
|
90
|
+
avg += dataArray[i];
|
91
|
+
}
|
92
|
+
avg = Math.round(avg / num);
|
93
|
+
return avg;
|
94
|
+
}
|
95
|
+
// Gibt den Durchschnitt von "num" Zahlen ab der Stelle "from" zurück
|
96
|
+
public function average_from_to(from:Number, num:Number):Number{
|
97
|
+
var avg:Number = 0;
|
98
|
+
var help:Number = from + num;
|
99
|
+
for(var i:Number = from; i < (help); i++){
|
100
|
+
avg += dataArray[i];
|
101
|
+
}
|
102
|
+
avg = Math.round(avg / num);
|
103
|
+
return avg;
|
104
|
+
}
|
105
|
+
|
106
|
+
public function getMeasure(low:Number,middle:Number,high:Number):Number{
|
107
|
+
var help = this.getNow();
|
108
|
+
if(help > middle){
|
109
|
+
return 3;
|
110
|
+
} else if (help < middle && help > low ){
|
111
|
+
return 2;
|
112
|
+
} else {
|
113
|
+
return 1;
|
114
|
+
}
|
115
|
+
}
|
116
|
+
}
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,30 @@
|
|
1
|
+
SWF_FILE=energietacho.swf
|
2
|
+
#SWF_FILE=Gluehlampe.swf
|
3
|
+
#SWF_FILE=Gluehlampe_frames.swf
|
4
|
+
CHUMBY_PATH=/tmp
|
5
|
+
CHUMBY_USER=root
|
6
|
+
CHUMBY_IP=192.168.21.209
|
7
|
+
|
8
|
+
default: help
|
9
|
+
|
10
|
+
copy: $(SWF_FILE)
|
11
|
+
scp $< $(CHUMBY_USER)@$(CHUMBY_IP):$(CHUMBY_PATH)
|
12
|
+
|
13
|
+
run: $(SWF_FILE) copy stop
|
14
|
+
ssh $(CHUMBY_USER)@$(CHUMBY_IP) "chumbyflashplayer.x -i $(CHUMBY_PATH)/$< 2>&1 &"
|
15
|
+
|
16
|
+
stop:
|
17
|
+
ssh $(CHUMBY_USER)@$(CHUMBY_IP) "/usr/chumby/scripts/stop_control_panel 2>&1"
|
18
|
+
|
19
|
+
restore: stop
|
20
|
+
ssh $(CHUMBY_USER)@$(CHUMBY_IP) "/usr/chumby/scripts/start_control_panel 2>&1"
|
21
|
+
|
22
|
+
.SILENT:
|
23
|
+
|
24
|
+
help:
|
25
|
+
echo "Copies and runs an SWF file on a local Chumby, please edit the Makefile."
|
26
|
+
echo "Available commands:"
|
27
|
+
echo " * copy: copies $(SWF_FILE) to the chumby at $(CHUMBY_IP)"
|
28
|
+
echo " * run: executes $(SWF_FILE) on the chumby "
|
29
|
+
echo " * stop: stops the currently active control panel"
|
30
|
+
echo " * restore: loads the original control panel (BROKEN?)"
|
@@ -0,0 +1,60 @@
|
|
1
|
+
SWF_FILE=energietacho.swf
|
2
|
+
#SWF_FILE=Gluehlampe.swf
|
3
|
+
#SWF_FILE=Gluehlampe_frames.swf
|
4
|
+
<<<<<<< Updated upstream
|
5
|
+
CHUMBY_PATH=/tmp
|
6
|
+
CHUMBY_USER=root
|
7
|
+
CHUMBY_IP=192.168.21.209
|
8
|
+
|
9
|
+
default: help
|
10
|
+
|
11
|
+
copy: $(SWF_FILE)
|
12
|
+
scp $< $(CHUMBY_USER)@$(CHUMBY_IP):$(CHUMBY_PATH)
|
13
|
+
|
14
|
+
run: $(SWF_FILE) copy stop
|
15
|
+
ssh $(CHUMBY_USER)@$(CHUMBY_IP) "chumbyflashplayer.x -i $(CHUMBY_PATH)/$< 2>&1 &"
|
16
|
+
|
17
|
+
stop:
|
18
|
+
ssh $(CHUMBY_USER)@$(CHUMBY_IP) "/usr/chumby/scripts/stop_control_panel 2>&1"
|
19
|
+
|
20
|
+
restore: stop
|
21
|
+
ssh $(CHUMBY_USER)@$(CHUMBY_IP) "/usr/chumby/scripts/start_control_panel 2>&1"
|
22
|
+
|
23
|
+
.SILENT:
|
24
|
+
|
25
|
+
help:
|
26
|
+
echo "Copies and runs an SWF file on a local Chumby, please edit the Makefile."
|
27
|
+
echo "Available commands:"
|
28
|
+
echo " * copy: copies $(SWF_FILE) to the chumby at $(CHUMBY_IP)"
|
29
|
+
echo " * run: executes $(SWF_FILE) on the chumby "
|
30
|
+
echo " * stop: stops the currently active control panel"
|
31
|
+
echo " * restore: loads the original control panel (BROKEN?)"
|
32
|
+
=======
|
33
|
+
CHUMBY_PATH=/tmp
|
34
|
+
CHUMBY_USER=root
|
35
|
+
CHUMBY_IP=192.168.1.100
|
36
|
+
|
37
|
+
default: help
|
38
|
+
|
39
|
+
copy: $(SWF_FILE)
|
40
|
+
scp $< $(CHUMBY_USER)@$(CHUMBY_IP):$(CHUMBY_PATH)
|
41
|
+
|
42
|
+
run: $(SWF_FILE) copy stop
|
43
|
+
ssh $(CHUMBY_USER)@$(CHUMBY_IP) "chumbyflashplayer.x -i $(CHUMBY_PATH)/$< 2>&1 &"
|
44
|
+
|
45
|
+
stop:
|
46
|
+
ssh $(CHUMBY_USER)@$(CHUMBY_IP) "/usr/chumby/scripts/stop_control_panel 2>&1"
|
47
|
+
|
48
|
+
restore: stop
|
49
|
+
ssh $(CHUMBY_USER)@$(CHUMBY_IP) "/usr/chumby/scripts/start_control_panel 2>&1"
|
50
|
+
|
51
|
+
.SILENT:
|
52
|
+
|
53
|
+
help:
|
54
|
+
echo "Copies and runs an SWF file on a local Chumby, please edit the Makefile."
|
55
|
+
echo "Available commands:"
|
56
|
+
echo " * copy: copies $(SWF_FILE) to the chumby at $(CHUMBY_IP)"
|
57
|
+
echo " * run: executes $(SWF_FILE) on the chumby "
|
58
|
+
echo " * stop: stops the currently active control panel"
|
59
|
+
echo " * restore: loads the original control panel (BROKEN?)"
|
60
|
+
>>>>>>> Stashed changes
|
@@ -0,0 +1,50 @@
|
|
1
|
+
= last_reading widgets
|
2
|
+
|
3
|
+
Widgets to display the last_reading the msg-chumby-daemon received from your Flukso. The boundary values for "low", "middle" and "high" are imported from the msg-chumby-daemon on widget startup. To change these values see the howto.
|
4
|
+
|
5
|
+
= energietacho
|
6
|
+
|
7
|
+
The widget displays the power consumption in a speedometer like view. The needle is rotated based on the last_reading of your flukso and the provided boundary values. If the _high value is exceeded the needle "hangs" at "High" until lower values are received. However, the current consumption in watts is always displayed as digits.
|
8
|
+
|
9
|
+
= Gluehlampe
|
10
|
+
|
11
|
+
The widget displays a lightbulb which glows (off, yellow, red) according to your power consumption and boundary values.
|
12
|
+
This widget uses three MovieClips in one frame which, and exchanges/blends them based on the result of the DataArray.getMeasure method.
|
13
|
+
|
14
|
+
Can be easily adapted by exchanging the three MovieClips with own designs.
|
15
|
+
|
16
|
+
= Gluehlampe_frames
|
17
|
+
|
18
|
+
Here, unlike in the "Gluehlampe" widget, three frames (with one MovieClip each) are used for the different states of power consumption. The shown frame is switched according to the result of DataArray.getMeasure again.
|
19
|
+
|
20
|
+
Can be easily adapted by exchanging the three MovieClips with own designs.
|
21
|
+
|
22
|
+
= files
|
23
|
+
|
24
|
+
- Makefile
|
25
|
+
Used to copy widgets to your chumby and start them. (IP needs to be adjusted!)
|
26
|
+
|
27
|
+
- energietacho.swf | .fla
|
28
|
+
Widget(swf) and Flash(fla) file for the speedometer like widget.
|
29
|
+
|
30
|
+
- Gluehlampe.swf | .fla
|
31
|
+
Widget(swf) and Flash(fla) file for the lightbulb widget using only one frame.
|
32
|
+
|
33
|
+
- Gluehlampe_frames.swf | .fla
|
34
|
+
Widget(swf) and Flash(fla) file for the lightbulb widget using multiple frames.
|
35
|
+
|
36
|
+
- XMLParse.as
|
37
|
+
AS2 file which handles the XML parsing.
|
38
|
+
|
39
|
+
- DataArray.as
|
40
|
+
AS2 file which handles the received data and provides different access methods.
|
41
|
+
|
42
|
+
- caurina.*
|
43
|
+
AS library for easy tweening, etc.
|
44
|
+
|
45
|
+
= howto
|
46
|
+
To simply use the widgets on your chumby with the default values, you can copy them as described in the mySmartGrid developer wiki. (Makefile is included)
|
47
|
+
|
48
|
+
To change the boundary values for the consumption you have to open your msgchumbyrc file and change the three values. These changes will only take effect after a restart of the msg-chumby-daemon with the new msgchumbyrc!
|
49
|
+
|
50
|
+
In the "Gluehlampe" and "Gluehlampe_frames" widgets, the three MovieClips can be exchanged with arbitrary other MovieClips.
|
@@ -0,0 +1,57 @@
|
|
1
|
+
{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf290
|
2
|
+
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
|
3
|
+
{\colortbl;\red255\green255\blue255;}
|
4
|
+
\paperw11900\paperh16840\margl1440\margr1440\vieww12240\viewh12660\viewkind0
|
5
|
+
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\ql\qnatural\pardirnatural
|
6
|
+
|
7
|
+
\f0\fs24 \cf0 = last_reading widgets\
|
8
|
+
\
|
9
|
+
Widgets to display the last_reading the msg-chumby-daemon received from your Flukso. The boundary values for "low", "middle" and "high" consumption are set to 300, 700 and 1500 watts respectively. To change these check the howto section. \
|
10
|
+
\
|
11
|
+
= energietacho \
|
12
|
+
\
|
13
|
+
The widget displays the power consumption in a speedometer like view. The needle is rotated based on the last_reading of your flukso and the provided boundary values. If the _high value is exceeded the needle "hangs" at "High" until lower values are received. However, the current consumption in watts is always displayed as digits. \
|
14
|
+
\
|
15
|
+
= Gluehlampe\
|
16
|
+
\
|
17
|
+
The widget displays a lightbulb which glows (off, yellow, red) according to your power consumption and boundary values. \
|
18
|
+
This widget uses three MovieClips in one frame which, and exchanges/blends them based on the result of the DataArray.getMeasure method. \
|
19
|
+
\
|
20
|
+
Can be easily adapted by exchanging the three MovieClips with own designs.\
|
21
|
+
\
|
22
|
+
= Gluehlampe_frames\
|
23
|
+
\
|
24
|
+
Here, unlike in the "Gluehlampe" widget, three frames (with one MovieClip each) are used for the different states of power consumption. The shown frame is switched according to the result of DataArray.getMeasure again. \
|
25
|
+
\
|
26
|
+
Can be easily adapted by exchanging the three MovieClips with own designs.\
|
27
|
+
\
|
28
|
+
= files\
|
29
|
+
\
|
30
|
+
- Makefile\
|
31
|
+
Used to copy widgets to your chumby and start them. (IP needs to be adjusted!)\
|
32
|
+
\
|
33
|
+
- energietacho.swf | .fla\
|
34
|
+
Widget(swf) and Flash(fla) file for the speedometer like widget.\
|
35
|
+
\
|
36
|
+
- Gluehlampe.swf | .fla\
|
37
|
+
Widget(swf) and Flash(fla) file for the lightbulb widget using only one frame.\
|
38
|
+
\
|
39
|
+
- Gluehlampe_frames.swf | .fla\
|
40
|
+
Widget(swf) and Flash(fla) file for the lightbulb widget using multiple frames.\
|
41
|
+
\
|
42
|
+
- XMLParse.as\
|
43
|
+
AS2 file which handles the XML parsing. \
|
44
|
+
\
|
45
|
+
-DataArray.as\
|
46
|
+
AS2 file which handles the received data and provides different access methods.\
|
47
|
+
\
|
48
|
+
- com.greensock.*\
|
49
|
+
AS library for easy tweening, etc.\
|
50
|
+
\
|
51
|
+
= howto\
|
52
|
+
To simply use the widgets on your chumby with the default values, you can copy them as described in the mySmartGrid developer wiki. (Makefile is included)\
|
53
|
+
\
|
54
|
+
To change the boundary values for the consumption you have to open the respective *.fla file with AdobeFlash. In the "Actions" for the first frame you can enter new values for _low, _middle, and _high boundary values. \
|
55
|
+
You need to recompile/export the widget to get an updated .swf file which you can then transfer to your chumby.\
|
56
|
+
\
|
57
|
+
In the "Gluehlampe" and "Gluehlampe_frames" widgets, the three MovieClips can be exchanged with arbitrary other MovieClips. }
|
@@ -0,0 +1 @@
|
|
1
|
+
class XmlParse
|
@@ -0,0 +1,88 @@
|
|
1
|
+
/**
|
2
|
+
* Generic, auxiliary functions
|
3
|
+
*
|
4
|
+
* @author Zeh Fernando
|
5
|
+
* @version 1.0.0
|
6
|
+
*/
|
7
|
+
|
8
|
+
class caurina.transitions.AuxFunctions {
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Gets the R (xx0000) bits from a number
|
12
|
+
*
|
13
|
+
* @param p_num Number Color number (ie, 0xffff00)
|
14
|
+
* @return Number The R value
|
15
|
+
*/
|
16
|
+
public static function numberToR(p_num:Number):Number {
|
17
|
+
// The initial & is meant to crop numbers bigger than 0xffffff
|
18
|
+
return (p_num & 0xff0000) >> 16;
|
19
|
+
}
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Gets the G (00xx00) bits from a number
|
23
|
+
*
|
24
|
+
* @param p_num Number Color number (ie, 0xffff00)
|
25
|
+
* @return Number The G value
|
26
|
+
*/
|
27
|
+
public static function numberToG(p_num:Number):Number {
|
28
|
+
return (p_num & 0xff00) >> 8;
|
29
|
+
}
|
30
|
+
|
31
|
+
/**
|
32
|
+
* Gets the B (0000xx) bits from a number
|
33
|
+
*
|
34
|
+
* @param p_num Number Color number (ie, 0xffff00)
|
35
|
+
* @return Number The B value
|
36
|
+
*/
|
37
|
+
public static function numberToB(p_num:Number):Number {
|
38
|
+
return (p_num & 0xff);
|
39
|
+
}
|
40
|
+
|
41
|
+
/**
|
42
|
+
* Checks whether a string is on an array
|
43
|
+
*
|
44
|
+
* @param p_string String String to search for
|
45
|
+
* @param p_array Array Array to be searched
|
46
|
+
* @return Boolean Whether the array contains the string or not
|
47
|
+
*/
|
48
|
+
public static function isInArray(p_string:String, p_array:Array):Boolean {
|
49
|
+
var l:Number = p_array.length;
|
50
|
+
for (var i:Number = 0; i < l; i++) {
|
51
|
+
if (p_array[i] == p_string) return true;
|
52
|
+
}
|
53
|
+
return false;
|
54
|
+
}
|
55
|
+
|
56
|
+
/**
|
57
|
+
* Returns the number of properties an object has
|
58
|
+
*
|
59
|
+
* @param p_object Object Target object with a number of properties
|
60
|
+
* @return Number Number of total properties the object has
|
61
|
+
*/
|
62
|
+
public static function getObjectLength(p_object:Object):Number {
|
63
|
+
var totalProperties:Number = 0;
|
64
|
+
for (var pName:String in p_object) totalProperties ++;
|
65
|
+
return totalProperties;
|
66
|
+
}
|
67
|
+
|
68
|
+
/* Takes a variable number of objects as parameters and "adds" their properties, from left to right. If a latter object defines a property as null, it will be removed from the final object
|
69
|
+
* @param args Object(s) A variable number of objects
|
70
|
+
* @return Object An object with the sum of all paremeters added as properties.
|
71
|
+
*/
|
72
|
+
public static function concatObjects(/*objects to concat*/) : Object{
|
73
|
+
var finalObject : Object = {};
|
74
|
+
var currentObject : Object;
|
75
|
+
for (var i : Number = 0; i < arguments.length; i++){
|
76
|
+
currentObject = arguments[i];
|
77
|
+
for (var prop : String in currentObject){
|
78
|
+
if (currentObject[prop] == null){
|
79
|
+
// delete in case is null
|
80
|
+
delete finalObject[prop];
|
81
|
+
}else{
|
82
|
+
finalObject[prop] = currentObject[prop]
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}
|
86
|
+
return finalObject;
|
87
|
+
}
|
88
|
+
}
|