|
From: <ma...@us...> - 2010-12-22 19:56:47
|
Revision: 221
http://openautomation.svn.sourceforge.net/openautomation/?rev=221&view=rev
Author: mayerch
Date: 2010-12-22 19:56:41 +0000 (Wed, 22 Dec 2010)
Log Message:
-----------
A few more DPT (as it's work in progress there a quite a lot encoding functions missing!)
Modified Paths:
--------------
CometVisu/trunk/visu/transforms/transform_knx.js
Modified: CometVisu/trunk/visu/transforms/transform_knx.js
===================================================================
--- CometVisu/trunk/visu/transforms/transform_knx.js 2010-12-14 21:57:43 UTC (rev 220)
+++ CometVisu/trunk/visu/transforms/transform_knx.js 2010-12-22 19:56:41 UTC (rev 221)
@@ -23,14 +23,158 @@
addTransform( 'DPT', {
'1.001': {
name : 'DPT_Switch',
- encode: function( i ){
- return i.toSting( 16 );
+ encode: function( phy ){
+ return phy.toSting( 16 );
},
- decode: function( i ){
- return parseInt( i , 16 );
+ decode: function( hex ){
+ return parseInt( hex , 16 );
}
},
'1': {
link : '1.001'
+ },
+
+ '2': {
+ link : '1.001'
+ },
+
+ '3': {
+ link : '1.001'
+ },
+
+ '4.001': {
+ name : 'DPT_Char_ASCII',
+ encode: function( phy ){
+ return phy.charCodeAt( 0 ).toString( 16 );
+ },
+ decode: function( hex ){
+ return String.fromCharCode(parseInt( hex, 16 ));
+ }
+ },
+ '4': {
+ link : '4.001'
+ },
+
+ '5.001' : {
+ name : 'DPT_Scaling',
+ encode: function( phy ){
+ return phy;
+ },
+ decode: function( hex ){
+ return parseInt( hex, 16 );
+ }
+ },
+ '5.004' : {
+ name : 'DPT_Percent_U8',
+ encode: function( phy ){
+ return phy;
+ },
+ decode: function( hex ){
+ return parseInt( hex, 16 ) * 100 / 255.0;
+ }
+ },
+ '5': {
+ link : '5.004'
+ },
+
+ '6.001' : {
+ name : 'DPT_Percent_V8',
+ encode: function( phy ){
+ return phy;
+ },
+ decode: function( hex ){
+ var val = parseInt( hex, 16 )
+ return val > 127 ? (val-256) : val;
+ }
+ },
+ '6': {
+ link : '6.001'
+ },
+
+ '7.001' : {
+ name : 'DPT_Value_2_Ucount',
+ encode: function( phy ){
+ return phy;
+ },
+ decode: function( hex ){
+ return parseInt( hex, 16 );
+ }
+ },
+ '7': {
+ link : '7.001'
+ },
+
+ '8.001' : {
+ name : 'DPT_Value_2_Count',
+ encode: function( phy ){
+ return phy;
+ },
+ decode: function( hex ){
+ var val = parseInt( hex, 16 );
+ return val > 32767 ? (val-65536) : val;
+ }
+ },
+ '8': {
+ link : '8.001'
+ },
+
+ '12.001' : {
+ name : 'DPT_Value_4_Ucount',
+ encode: function( phy ){
+ return phy;
+ },
+ decode: function( hex ){
+ return parseInt( hex, 16 );
+ }
+ },
+ '12': {
+ link : '12.001'
+ },
+
+ '13.001' : {
+ name : 'DPT_Value_4_Count',
+ encode: function( phy ){
+ return phy;
+ },
+ decode: function( hex ){
+ var val = parseInt( hex, 16 );
+ return val > 2147483647 ? (val-4294967296) : val;
+ }
+ },
+ '13': {
+ link : '13.001'
+ },
+
+ '14.001' : {
+ name : 'DPT_Value_Acceleration_Angular',
+ encode: function( phy ){
+ return phy;
+ },
+ decode: function( hex ){
+ var val = parseInt( hex, 16 );
+ var sign = (val & 0x80000000) ? -1 : 1;
+ var exp =((val & 0x7F800000) >> 23) - 127;
+ var mant = (val & 0x007FFFFF | 0x00800000);
+ return sign * Math.pow( 2, exp ) * ( mant / (1 << 23));
+ }
+ },
+ /* 9 Zeilen:
+ },
+ '.001' : {
+ name : '',
+ encode: function( phy ){
+ return phy;
+ },
+ decode: function( hex ){
+ return hex;
+ }
}
+ */ /////////////////////////////////////////////////
+ /* 3 Zeilen:
+ }
+ '': {
+ link : '.001'
+ },
+ */
+ 'temp dummy' : {link:'1.001'}
} );
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-12-23 20:30:23
|
Revision: 224
http://openautomation.svn.sourceforge.net/openautomation/?rev=224&view=rev
Author: mayerch
Date: 2010-12-23 20:30:17 +0000 (Thu, 23 Dec 2010)
Log Message:
-----------
Added more encodings
Modified Paths:
--------------
CometVisu/trunk/visu/transforms/transform_knx.js
Modified: CometVisu/trunk/visu/transforms/transform_knx.js
===================================================================
--- CometVisu/trunk/visu/transforms/transform_knx.js 2010-12-22 21:07:26 UTC (rev 223)
+++ CometVisu/trunk/visu/transforms/transform_knx.js 2010-12-23 20:30:17 UTC (rev 224)
@@ -24,7 +24,7 @@
'1.001': {
name : 'DPT_Switch',
encode: function( phy ){
- return phy.toSting( 16 );
+ return phy.toString( 16 );
},
decode: function( hex ){
return parseInt( hex , 16 );
@@ -58,7 +58,7 @@
'5.001' : {
name : 'DPT_Scaling',
encode: function( phy ){
- return phy;
+ return phy.toString( 16 );
},
decode: function( hex ){
return parseInt( hex, 16 );
@@ -67,7 +67,7 @@
'5.004' : {
name : 'DPT_Percent_U8',
encode: function( phy ){
- return phy;
+ return parseInt( phy * 255 / 100 ).toSting( 16 );
},
decode: function( hex ){
return parseInt( hex, 16 ) * 100 / 255.0;
@@ -80,7 +80,8 @@
'6.001' : {
name : 'DPT_Percent_V8',
encode: function( phy ){
- return phy;
+ var val = phy < 0 ? phy + 256 : phy;
+ return val.toString( 16 );
},
decode: function( hex ){
var val = parseInt( hex, 16 )
@@ -94,7 +95,7 @@
'7.001' : {
name : 'DPT_Value_2_Ucount',
encode: function( phy ){
- return phy;
+ return phy.toString( 16 );
},
decode: function( hex ){
return parseInt( hex, 16 );
@@ -107,7 +108,8 @@
'8.001' : {
name : 'DPT_Value_2_Count',
encode: function( phy ){
- return phy;
+ var val = phy < 0 ? phy + 65536 : phy;
+ return val.toString( 16 );
},
decode: function( hex ){
var val = parseInt( hex, 16 );
@@ -121,7 +123,7 @@
'12.001' : {
name : 'DPT_Value_4_Ucount',
encode: function( phy ){
- return phy;
+ return phy.toString( 16 );
},
decode: function( hex ){
return parseInt( hex, 16 );
@@ -134,7 +136,8 @@
'13.001' : {
name : 'DPT_Value_4_Count',
encode: function( phy ){
- return phy;
+ var val = phy < 0 ? phy + 4294967296 : phy;
+ return val.toString( 16 );
},
decode: function( hex ){
var val = parseInt( hex, 16 );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-12-23 22:39:11
|
Revision: 225
http://openautomation.svn.sourceforge.net/openautomation/?rev=225&view=rev
Author: mayerch
Date: 2010-12-23 22:39:04 +0000 (Thu, 23 Dec 2010)
Log Message:
-----------
Added decoding of DPT9
Modified Paths:
--------------
CometVisu/trunk/visu/transforms/transform_knx.js
Modified: CometVisu/trunk/visu/transforms/transform_knx.js
===================================================================
--- CometVisu/trunk/visu/transforms/transform_knx.js 2010-12-23 20:30:17 UTC (rev 224)
+++ CometVisu/trunk/visu/transforms/transform_knx.js 2010-12-23 22:39:04 UTC (rev 225)
@@ -120,6 +120,26 @@
link : '8.001'
},
+ '9.001' : {
+ name : 'DPT_Value_Temp',
+ encode: function( phy ){
+ return phy;
+ },
+ decode: function( hex ){
+ var bin1 = parseInt( hex.substr(0,2), 16 );
+ var bin2 = parseInt( hex.substr(2,2), 16 );
+ var sign = parseInt( bin1 & 0x80 );
+ var exp = parseInt( bin1 & 0x78 ) >> 3;
+ var mant = parseInt( ((bin1 & 0x7) << 8) | bin2 );
+ if( sign != 0 )
+ mant = -(~(mant - 1) & 0x7ff);
+ return (1 << exp) * 0.01 * mant;
+ }
+ },
+ '9': {
+ link : '9.001'
+ },
+
'12.001' : {
name : 'DPT_Value_4_Ucount',
encode: function( phy ){
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-12-26 22:59:00
|
Revision: 228
http://openautomation.svn.sourceforge.net/openautomation/?rev=228&view=rev
Author: mayerch
Date: 2010-12-26 22:58:54 +0000 (Sun, 26 Dec 2010)
Log Message:
-----------
Brought DPT 5 up to spec
Modified Paths:
--------------
CometVisu/trunk/visu/transforms/transform_knx.js
Modified: CometVisu/trunk/visu/transforms/transform_knx.js
===================================================================
--- CometVisu/trunk/visu/transforms/transform_knx.js 2010-12-26 21:30:38 UTC (rev 227)
+++ CometVisu/trunk/visu/transforms/transform_knx.js 2010-12-26 22:58:54 UTC (rev 228)
@@ -57,24 +57,42 @@
'5.001' : {
name : 'DPT_Scaling',
+ unit : '%',
encode: function( phy ){
- return phy.toString( 16 );
+ return parseInt( phy * 255 / 100 ).toString( 16 );
},
decode: function( hex ){
- return parseInt( hex, 16 );
+ return parseInt( hex, 16 ) * 100 / 255.0;
}
},
+ '5.003' : {
+ name : 'DPT_Angle',
+ unit : '°',
+ encode: function( phy ){
+ return parseInt( phy * 255 / 360 ).toString( 16 );
+ },
+ decode: function( hex ){
+ return parseInt( hex, 16 ) * 100 / 360.0;
+ }
+ },
'5.004' : {
name : 'DPT_Percent_U8',
+ unit : '%',
encode: function( phy ){
- return parseInt( phy * 255 / 100 ).toSting( 16 );
+ return phy.toString( 16 );
},
decode: function( hex ){
- return parseInt( hex, 16 ) * 100 / 255.0;
+ return parseInt( hex, 16 );
}
},
+ '5.010': {
+ link : '5.004',
+ name : 'DPT_Value_1_Ucount',
+ unit : '-'
+ },
'5': {
- link : '5.004'
+ link : '5.004',
+ name : '8-Bit Unsigned Value'
},
'6.001' : {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-12-27 18:26:09
|
Revision: 229
http://openautomation.svn.sourceforge.net/openautomation/?rev=229&view=rev
Author: mayerch
Date: 2010-12-27 18:26:03 +0000 (Mon, 27 Dec 2010)
Log Message:
-----------
Create encoding for DPT 9 (+ temporary test function that will be deleted again later)
Modified Paths:
--------------
CometVisu/trunk/visu/transforms/transform_knx.js
Modified: CometVisu/trunk/visu/transforms/transform_knx.js
===================================================================
--- CometVisu/trunk/visu/transforms/transform_knx.js 2010-12-26 22:58:54 UTC (rev 228)
+++ CometVisu/trunk/visu/transforms/transform_knx.js 2010-12-27 18:26:03 UTC (rev 229)
@@ -141,9 +141,19 @@
'9.001' : {
name : 'DPT_Value_Temp',
encode: function( phy ){
- return phy;
+ if( undefined === phy || NaN == phy ) return '7fff';
+ var sign = phy < 0 ? 0x8000 : 0;
+ var mant = Math.round(phy * 100.0);
+ var exp = 0;
+ while( Math.abs(mant) > 2047 ) {
+ mant >>= 1;
+ exp++;
+ }
+ var v = ( sign | (exp<<11) | (mant & 0x07ff) ).toString( 16 );
+ return new Array(4 - v.length + 1).join('0') + v;
},
decode: function( hex ){
+ if( 0x7fff == parseInt( hex, 16 ) ) return NaN;
var bin1 = parseInt( hex.substr(0,2), 16 );
var bin2 = parseInt( hex.substr(2,2), 16 );
var sign = parseInt( bin1 & 0x80 );
@@ -226,4 +236,33 @@
},
*/
'temp dummy' : {link:'1.001'}
-} );
\ No newline at end of file
+} );
+
+//////
+// To be deleted later: a test function to check if the coding is consistent
+function TEST( DPT, Bytes )
+{
+ var maxErr = 5;
+ DPT = 'DPT:' + DPT;
+ for( i = 0; i < Math.pow(2,8*Bytes); i++ )
+ {
+ var v = i.toString( 16 );
+ v = new Array(2*Bytes - v.length + 1).join('0') + v;
+ var test = Transform[DPT].encode(
+ Transform[DPT].decode(v)
+ );
+ //console.log(i,v,test);
+ if( v != test )
+ {
+ var v2 = Transform[DPT].decode(v);
+ var test2 = Transform[DPT].decode(
+ Transform[DPT].encode(v2)
+ );
+ if( v2 != test2 )
+ {
+ console.log( i, v, test, Transform[DPT].decode(v), v2, test2, maxErr );
+ if( (--maxErr) < 0 ) return maxErr;
+ }
+ }
+ }
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-12-27 22:51:23
|
Revision: 230
http://openautomation.svn.sourceforge.net/openautomation/?rev=230&view=rev
Author: mayerch
Date: 2010-12-27 22:51:16 +0000 (Mon, 27 Dec 2010)
Log Message:
-----------
Send according to KNX spec (add 0x80 depending on data length)
Modified Paths:
--------------
CometVisu/trunk/visu/transforms/transform_knx.js
Modified: CometVisu/trunk/visu/transforms/transform_knx.js
===================================================================
--- CometVisu/trunk/visu/transforms/transform_knx.js 2010-12-27 18:26:03 UTC (rev 229)
+++ CometVisu/trunk/visu/transforms/transform_knx.js 2010-12-27 22:51:16 UTC (rev 230)
@@ -24,7 +24,7 @@
'1.001': {
name : 'DPT_Switch',
encode: function( phy ){
- return phy.toString( 16 );
+ return (phy | 0x80).toString( 16 );
},
decode: function( hex ){
return parseInt( hex , 16 );
@@ -45,7 +45,8 @@
'4.001': {
name : 'DPT_Char_ASCII',
encode: function( phy ){
- return phy.charCodeAt( 0 ).toString( 16 );
+ var val = phy.charCodeAt( 0 ).toString( 16 );
+ return (val.length == 1 ? '800' : '80') + val;
},
decode: function( hex ){
return String.fromCharCode(parseInt( hex, 16 ));
@@ -59,7 +60,8 @@
name : 'DPT_Scaling',
unit : '%',
encode: function( phy ){
- return parseInt( phy * 255 / 100 ).toString( 16 );
+ var val = parseInt( phy * 255 / 100 ).toString( 16 );
+ return (val.length == 1 ? '800' : '80') + val;
},
decode: function( hex ){
return parseInt( hex, 16 ) * 100 / 255.0;
@@ -69,7 +71,8 @@
name : 'DPT_Angle',
unit : '°',
encode: function( phy ){
- return parseInt( phy * 255 / 360 ).toString( 16 );
+ var val = parseInt( phy * 255 / 360 ).toString( 16 );
+ return (val.length == 1 ? '800' : '80') + val;
},
decode: function( hex ){
return parseInt( hex, 16 ) * 100 / 360.0;
@@ -79,7 +82,8 @@
name : 'DPT_Percent_U8',
unit : '%',
encode: function( phy ){
- return phy.toString( 16 );
+ var val = phy.toString( 16 );
+ return (val.length == 1 ? '800' : '80') + val;
},
decode: function( hex ){
return parseInt( hex, 16 );
@@ -99,7 +103,8 @@
name : 'DPT_Percent_V8',
encode: function( phy ){
var val = phy < 0 ? phy + 256 : phy;
- return val.toString( 16 );
+ val = val.toString( 16 );
+ return (val.length == 1 ? '800' : '80') + val;
},
decode: function( hex ){
var val = parseInt( hex, 16 )
@@ -113,7 +118,8 @@
'7.001' : {
name : 'DPT_Value_2_Ucount',
encode: function( phy ){
- return phy.toString( 16 );
+ var val = phy.toString( 16 );
+ return (val.length == 1 ? '800' : '80') + val;
},
decode: function( hex ){
return parseInt( hex, 16 );
@@ -127,7 +133,7 @@
name : 'DPT_Value_2_Count',
encode: function( phy ){
var val = phy < 0 ? phy + 65536 : phy;
- return val.toString( 16 );
+ return '80' + val.toString( 16 );
},
decode: function( hex ){
var val = parseInt( hex, 16 );
@@ -149,8 +155,8 @@
mant >>= 1;
exp++;
}
- var v = ( sign | (exp<<11) | (mant & 0x07ff) ).toString( 16 );
- return new Array(4 - v.length + 1).join('0') + v;
+ var val = ( sign | (exp<<11) | (mant & 0x07ff) ).toString( 16 );
+ return '80' + ( new Array(4 - val.length + 1).join('0') + val );
},
decode: function( hex ){
if( 0x7fff == parseInt( hex, 16 ) ) return NaN;
@@ -171,7 +177,8 @@
'12.001' : {
name : 'DPT_Value_4_Ucount',
encode: function( phy ){
- return phy.toString( 16 );
+ var val = phy.toString( 16 );
+ return (val.length == 1 ? '800' : '80') + val;
},
decode: function( hex ){
return parseInt( hex, 16 );
@@ -185,7 +192,8 @@
name : 'DPT_Value_4_Count',
encode: function( phy ){
var val = phy < 0 ? phy + 4294967296 : phy;
- return val.toString( 16 );
+ val = val.toString( 16 );
+ return (val.length == 1 ? '800' : '80') + val;
},
decode: function( hex ){
var val = parseInt( hex, 16 );
@@ -199,7 +207,7 @@
'14.001' : {
name : 'DPT_Value_Acceleration_Angular',
encode: function( phy ){
- return phy;
+ return '80' + phy;
},
decode: function( hex ){
var val = parseInt( hex, 16 );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-12-28 12:04:46
|
Revision: 234
http://openautomation.svn.sourceforge.net/openautomation/?rev=234&view=rev
Author: mayerch
Date: 2010-12-28 12:04:40 +0000 (Tue, 28 Dec 2010)
Log Message:
-----------
Bug fix
Modified Paths:
--------------
CometVisu/trunk/visu/transforms/transform_knx.js
Modified: CometVisu/trunk/visu/transforms/transform_knx.js
===================================================================
--- CometVisu/trunk/visu/transforms/transform_knx.js 2010-12-27 23:54:56 UTC (rev 233)
+++ CometVisu/trunk/visu/transforms/transform_knx.js 2010-12-28 12:04:40 UTC (rev 234)
@@ -75,7 +75,7 @@
return (val.length == 1 ? '800' : '80') + val;
},
decode: function( hex ){
- return parseInt( hex, 16 ) * 100 / 360.0;
+ return parseInt( hex, 16 ) * 360 / 255.0;
}
},
'5.004' : {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-02-13 13:03:59
|
Revision: 293
http://openautomation.svn.sourceforge.net/openautomation/?rev=293&view=rev
Author: mayerch
Date: 2011-02-13 13:03:53 +0000 (Sun, 13 Feb 2011)
Log Message:
-----------
Fix DPT 5.004 (and thus also the important 5.010) encoding when a non natural number (i.e. no integer) got passed.
This caused troubles in the very important case where a slider is connected to a dimmer.
Modified Paths:
--------------
CometVisu/trunk/visu/transforms/transform_knx.js
Modified: CometVisu/trunk/visu/transforms/transform_knx.js
===================================================================
--- CometVisu/trunk/visu/transforms/transform_knx.js 2011-02-11 22:35:52 UTC (rev 292)
+++ CometVisu/trunk/visu/transforms/transform_knx.js 2011-02-13 13:03:53 UTC (rev 293)
@@ -82,7 +82,7 @@
name : 'DPT_Percent_U8',
unit : '%',
encode: function( phy ){
- var val = phy.toString( 16 );
+ var val = parseInt( phy ).toString( 16 );
return (val.length == 1 ? '800' : '80') + val;
},
decode: function( hex ){
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-02-20 20:57:51
|
Revision: 301
http://openautomation.svn.sourceforge.net/openautomation/?rev=301&view=rev
Author: mayerch
Date: 2011-02-20 20:57:45 +0000 (Sun, 20 Feb 2011)
Log Message:
-----------
- Added transform for datapoint 20.102 (DPT_HVACMode)
- Extended the transform data structure by a "range" element that might contain min/max or an enum
Modified Paths:
--------------
CometVisu/trunk/visu/transforms/transform_knx.js
Modified: CometVisu/trunk/visu/transforms/transform_knx.js
===================================================================
--- CometVisu/trunk/visu/transforms/transform_knx.js 2011-02-20 15:52:44 UTC (rev 300)
+++ CometVisu/trunk/visu/transforms/transform_knx.js 2011-02-20 20:57:45 UTC (rev 301)
@@ -225,6 +225,57 @@
},
unit : '-'
},
+ '20.102': {
+ name : 'DPT_HVACMode',
+ lname : {
+ 'de': 'KONNEX Betriebsart'
+ },
+ unit : '-',
+ range : {
+ enum: [ 'auto', 'comfort', 'standby', 'economy', 'building_protection' ]
+ },
+ encode: function( phy ){
+ var val;
+ switch( phy )
+ {
+ case 1:
+ case 'comfort':
+ val = 1;
+ break;
+ case 2:
+ case 'standby':
+ val = 2;
+ break;
+ case 3:
+ case 'economy':
+ val = 3;
+ break;
+ case 4:
+ case 'building_protection':
+ val = 4;
+ break;
+ default: // actually "case 0:" / "auto"
+ val = 0;
+ }
+ val = val.toString( 16 );
+ return (val.length == 1 ? '800' : '80') + val;
+ },
+ decode: function( hex ){
+ switch( parseInt( hex, 16 ) )
+ {
+ case 1:
+ return 'comfort';
+ case 2:
+ return 'standby';
+ case 3:
+ return 'economy';
+ case 4:
+ return 'building_protection';
+ default: // actually "case 0:"
+ return 'auto';
+ }
+ },
+ },
/* 9 Zeilen:
},
'.001' : {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-05-27 18:12:26
|
Revision: 347
http://openautomation.svn.sourceforge.net/openautomation/?rev=347&view=rev
Author: mayerch
Date: 2011-05-27 18:12:20 +0000 (Fri, 27 May 2011)
Log Message:
-----------
Added tranformation for DPT 9.004
Modified Paths:
--------------
CometVisu/trunk/visu/transforms/transform_knx.js
Modified: CometVisu/trunk/visu/transforms/transform_knx.js
===================================================================
--- CometVisu/trunk/visu/transforms/transform_knx.js 2011-05-26 15:33:39 UTC (rev 346)
+++ CometVisu/trunk/visu/transforms/transform_knx.js 2011-05-27 18:12:20 UTC (rev 347)
@@ -182,6 +182,9 @@
return (1 << exp) * 0.01 * mant;
}
},
+ '9.004': {
+ link : '9.001'
+ },
'9': {
link : '9.001'
},
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-08-10 19:38:36
|
Revision: 399
http://openautomation.svn.sourceforge.net/openautomation/?rev=399&view=rev
Author: makki1
Date: 2011-08-10 19:38:27 +0000 (Wed, 10 Aug 2011)
Log Message:
-----------
Add DPT16 to transform_knx (UTF8 vs 8859-1 maybe not yet perfect but ASCII works)
Modified Paths:
--------------
CometVisu/trunk/visu/transforms/transform_knx.js
Modified: CometVisu/trunk/visu/transforms/transform_knx.js
===================================================================
--- CometVisu/trunk/visu/transforms/transform_knx.js 2011-08-09 19:07:58 UTC (rev 398)
+++ CometVisu/trunk/visu/transforms/transform_knx.js 2011-08-10 19:38:27 UTC (rev 399)
@@ -268,13 +268,47 @@
}
},
'14': {
- link : '14.001',
+ link : '16.001',
name : '4 byte float',
lname : {
'de': '4 Byte Gleitkommazahl'
},
unit : '-'
},
+ '16.001' : {
+ name : 'DPT_String_8859_1',
+ lname : {
+ 'de': '14 Byte Text ISO-8859-1'
+ },
+ decode: function( hex ){
+ console.log('16-val: ' + hex);
+ var val="";
+ var chars;
+ for (var i=0;i<28;i=i+2) {
+ chars=parseInt(hex.substr(i,2),16);
+ if (chars>0) {
+ val+=String.fromCharCode(chars);
+ }
+ }
+ return val;
+ }
+ },
+ '16.000': {
+ link : '16.001',
+ name : 'DPT_String_ASCII',
+ lname : {
+ 'de': '14 Byte Text ASCII'
+ },
+ unit : '-'
+ },
+ '16': {
+ link : '16.001',
+ name : 'DPT_String_ASCII',
+ lname : {
+ 'de': '14 Byte Text ASCII'
+ },
+ unit : '-'
+ },
'20.102': {
name : 'DPT_HVACMode',
lname : {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-08-10 19:39:14
|
Revision: 400
http://openautomation.svn.sourceforge.net/openautomation/?rev=400&view=rev
Author: makki1
Date: 2011-08-10 19:39:08 +0000 (Wed, 10 Aug 2011)
Log Message:
-----------
Add DPT16 to transform_knx - forgot to remove debugging
Modified Paths:
--------------
CometVisu/trunk/visu/transforms/transform_knx.js
Modified: CometVisu/trunk/visu/transforms/transform_knx.js
===================================================================
--- CometVisu/trunk/visu/transforms/transform_knx.js 2011-08-10 19:38:27 UTC (rev 399)
+++ CometVisu/trunk/visu/transforms/transform_knx.js 2011-08-10 19:39:08 UTC (rev 400)
@@ -281,7 +281,6 @@
'de': '14 Byte Text ISO-8859-1'
},
decode: function( hex ){
- console.log('16-val: ' + hex);
var val="";
var chars;
for (var i=0;i<28;i=i+2) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-08-10 19:47:05
|
Revision: 401
http://openautomation.svn.sourceforge.net/openautomation/?rev=401&view=rev
Author: makki1
Date: 2011-08-10 19:46:59 +0000 (Wed, 10 Aug 2011)
Log Message:
-----------
Add DPT16 to transform_knx - grrrmpf, dont trash DPT14 - copy&paste :o
Modified Paths:
--------------
CometVisu/trunk/visu/transforms/transform_knx.js
Modified: CometVisu/trunk/visu/transforms/transform_knx.js
===================================================================
--- CometVisu/trunk/visu/transforms/transform_knx.js 2011-08-10 19:39:08 UTC (rev 400)
+++ CometVisu/trunk/visu/transforms/transform_knx.js 2011-08-10 19:46:59 UTC (rev 401)
@@ -268,7 +268,7 @@
}
},
'14': {
- link : '16.001',
+ link : '14.001',
name : '4 byte float',
lname : {
'de': '4 Byte Gleitkommazahl'
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-10-15 16:00:47
|
Revision: 448
http://openautomation.svn.sourceforge.net/openautomation/?rev=448&view=rev
Author: makki1
Date: 2011-10-15 16:00:41 +0000 (Sat, 15 Oct 2011)
Log Message:
-----------
Add some missing links for DPT sub-types (incomplete; see Artifact 3424149)
Modified Paths:
--------------
CometVisu/trunk/visu/transforms/transform_knx.js
Modified: CometVisu/trunk/visu/transforms/transform_knx.js
===================================================================
--- CometVisu/trunk/visu/transforms/transform_knx.js 2011-10-15 11:03:10 UTC (rev 447)
+++ CometVisu/trunk/visu/transforms/transform_knx.js 2011-10-15 16:00:41 UTC (rev 448)
@@ -33,6 +33,18 @@
'1': {
link : '1.001'
},
+ '1.002': {
+ link : '1.001'
+ },
+ '1.003': {
+ link : '1.001'
+ },
+ '1.008': {
+ link : '1.001'
+ },
+ '1.009': {
+ link : '1.001'
+ },
'2': {
link : '1.001'
@@ -185,6 +197,18 @@
'9.004': {
link : '9.001'
},
+ '9.007': {
+ link : '9.001'
+ },
+ '9.008': {
+ link : '9.001'
+ },
+ '9.020': {
+ link : '9.001'
+ },
+ '9.021': {
+ link : '9.001'
+ },
'9': {
link : '9.001'
},
@@ -407,4 +431,4 @@
}
}
}
-}
\ No newline at end of file
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-11-13 14:45:36
|
Revision: 516
http://openautomation.svn.sourceforge.net/openautomation/?rev=516&view=rev
Author: mayerch
Date: 2011-11-13 14:45:30 +0000 (Sun, 13 Nov 2011)
Log Message:
-----------
Add encode function for DPT16 (= 14 byte text)
Modified Paths:
--------------
CometVisu/trunk/visu/transforms/transform_knx.js
Modified: CometVisu/trunk/visu/transforms/transform_knx.js
===================================================================
--- CometVisu/trunk/visu/transforms/transform_knx.js 2011-11-12 21:10:43 UTC (rev 515)
+++ CometVisu/trunk/visu/transforms/transform_knx.js 2011-11-13 14:45:30 UTC (rev 516)
@@ -304,6 +304,15 @@
lname : {
'de': '14 Byte Text ISO-8859-1'
},
+ encode: function( phy ){
+ var val = '80';
+ for( var i = 0; i < 14; i++ )
+ {
+ var c = phy.charCodeAt( i );
+ val += c ? ( (c < 16 ? '0' : '') + c.toString( 16 ) ) : '00';
+ }
+ return val;
+ },
decode: function( hex ){
var val="";
var chars;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2012-07-13 17:39:55
|
Revision: 918
http://openautomation.svn.sourceforge.net/openautomation/?rev=918&view=rev
Author: makki1
Date: 2012-07-13 17:39:48 +0000 (Fri, 13 Jul 2012)
Log Message:
-----------
Fix encoding of DPT7/8/12/13
Modified Paths:
--------------
CometVisu/trunk/visu/transforms/transform_knx.js
Modified: CometVisu/trunk/visu/transforms/transform_knx.js
===================================================================
--- CometVisu/trunk/visu/transforms/transform_knx.js 2012-07-13 07:54:14 UTC (rev 917)
+++ CometVisu/trunk/visu/transforms/transform_knx.js 2012-07-13 17:39:48 UTC (rev 918)
@@ -142,8 +142,8 @@
'7.001' : {
name : 'DPT_Value_2_Ucount',
encode: function( phy ){
- var val = phy.toString( 16 );
- return (val.length == 1 ? '800' : '80') + val;
+ var val = zeroFillString( parseInt(phy).toString( 16 ), 4);
+ return '80' + val;
},
decode: function( hex ){
return parseInt( hex, 16 );
@@ -156,8 +156,9 @@
'8.001' : {
name : 'DPT_Value_2_Count',
encode: function( phy ){
- var val = phy < 0 ? phy + 65536 : phy;
- return '80' + val.toString( 16 );
+ var val = parseInt ( phy );
+ val = val < 0 ? val + 65536 : val;
+ return '80' + zeroFillString( val.toString( 16 ), 4);
},
decode: function( hex ){
var val = parseInt( hex, 16 );
@@ -254,8 +255,8 @@
'12.001' : {
name : 'DPT_Value_4_Ucount',
encode: function( phy ){
- var val = phy.toString( 16 );
- return (val.length == 1 ? '800' : '80') + val;
+ var val = zeroFillString( parseInt(phy).toString( 16 ), 8);
+ return '80' + val;
},
decode: function( hex ){
return parseInt( hex, 16 );
@@ -268,9 +269,9 @@
'13.001' : {
name : 'DPT_Value_4_Count',
encode: function( phy ){
- var val = phy < 0 ? phy + 4294967296 : phy;
- val = val.toString( 16 );
- return (val.length == 1 ? '800' : '80') + val;
+ var val = parseInt ( phy );
+ val = val < 0 ? val + 4294967296 : val;
+ return '80' + zeroFillString( val.toString( 16 ), 8);
},
decode: function( hex ){
var val = parseInt( hex, 16 );
@@ -284,7 +285,7 @@
'14.001' : {
name : 'DPT_Value_Acceleration_Angular',
encode: function( phy ){
- return '80' + phy;
+ //FIXME: unimplemented (jspack?)
},
decode: function( hex ){
var val = parseInt( hex, 16 );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|