Commit 50f2898b authored by Claes's avatar Claes Committed by Esteban Blanc

Trends, DsTrend, DsTrendCurve and SevHist for javascript

parent 12afe116
......@@ -51,6 +51,7 @@
#include "rt_gdh.h"
#include "rt_gdh_msg.h"
#include "rt_thread.h"
#include "rt_sevcli.h"
#include "jpwr_rt_gdh.h"
......@@ -99,6 +100,7 @@ static void gdh_ConvertUTFstring( char *out, char *in);
static int gdh_JidToPointer( int id, void **p);
static int gdh_JidStore( void *p, pwr_tRefId r, int *id);
static int gdh_JidRemove( pwr_tRefId r);
static sevcli_tCtx gdh_scctx = 0;
JNIEXPORT jint JNICALL Java_jpwr_rt_Gdh_init
(JNIEnv *env, jclass obj)
......@@ -3098,7 +3100,8 @@ JNIEXPORT jint JNICALL Java_jpwr_rt_Gdh_updateCircBuffInfo
case pwr_eType_UInt16:
case pwr_eType_Int16:
case pwr_eType_UInt8:
case pwr_eType_Int8: {
case pwr_eType_Int8:
case pwr_eType_Boolean: {
jintArray jiarray = 0;
jiarray = (*env)->NewIntArray( env, info[i].size);
(*env)->SetIntArrayRegion( env, jiarray, 0, info[i].size, info[i].bufp);
......@@ -3120,6 +3123,394 @@ JNIEXPORT jint JNICALL Java_jpwr_rt_Gdh_updateCircBuffInfo
return 1;
}
JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_getDsTrend
(JNIEnv *env, jobject obj, jstring jdstrend_object, jint jlast_next_idx, jint jlast_buffer, jint jmax_size)
{
int sts = GDH__SUCCESS;
jclass gdhrGetDsTrend_id;
static jmethodID gdhrGetDsTrend_cid = NULL;
jobject gdhrGetDsTrend;
int last_next_idx = jlast_next_idx;
int last_buffer = jlast_buffer;
int max_size = jmax_size;
pwr_sClass_DsTrend tp;
int write_buffer;
int start_idx;
int trend_buff_size = 478;
int j, k;
int idx = 0;
float *data = 0;
int values = 0;
char *dstrend_object;
gdhrGetDsTrend_id = (*env)->FindClass( env, "jpwr/rt/GdhrGetDsTrend");
if(gdhrGetDsTrend_id == NULL) printf("gdhrGetDsTrend_id ks NULL");
if(gdhrGetDsTrend_cid == NULL) {
gdhrGetDsTrend_cid = (*env)->GetMethodID( env, gdhrGetDsTrend_id,
"<init>", "([FIIII)V");
if(gdhrGetDsTrend_cid == NULL) printf("gdhrGetDsTrend_cid is NULL");
}
dstrend_object = (char *)(*env)->GetStringUTFChars(env, jdstrend_object, 0);
gdh_ConvertUTFstring( dstrend_object, dstrend_object);
sts = gdh_GetObjectInfo(dstrend_object, &tp, sizeof(tp));
if (ODD(sts)) {
if (last_next_idx == -1 || last_next_idx == 65535) {
/* Get whole curve */
data = (float *)calloc(1, 4 * max_size);
int write_buffer = (int)tp.WriteBuffer;
start_idx = write_buffer * trend_buff_size / 2
+ (int)tp.NextWriteIndex[write_buffer];
if (start_idx == 0) {
start_idx = tp.NoOfSample - 1 + trend_buff_size / 2;
write_buffer = 1;
} else if (start_idx == trend_buff_size / 2) {
start_idx = tp.NoOfSample - 1;
write_buffer = 0;
} else
start_idx--;
idx = 0;
for (j = start_idx; j >= write_buffer * trend_buff_size / 2; j--) {
if (idx >= max_size)
break;
data[max_size-idx-1] = tp.DataBuffer[j];
idx++;
}
for (j = tp.NoOfSample - 1 + (!write_buffer) * trend_buff_size / 2;
j >= (!write_buffer) * trend_buff_size / 2; j--) {
if (idx >= max_size)
break;
data[max_size-idx-1] = tp.DataBuffer[j];
idx++;
}
if (start_idx
!= (int)tp.NoOfSample - 1 + write_buffer * trend_buff_size / 2) {
for (j = tp.NoOfSample - 1 + write_buffer * trend_buff_size / 2;
j > start_idx; j--) {
if (idx >= max_size)
break;
data[max_size-idx-1] = tp.DataBuffer[j];
idx++;
}
}
last_buffer = tp.WriteBuffer;
last_next_idx = tp.NextWriteIndex[last_buffer];
values = idx;
}
else {
/* Get new value values since last_idx */
if (tp.NextWriteIndex[tp.WriteBuffer]
!= last_next_idx) {
values = tp.NextWriteIndex[tp.WriteBuffer]
- last_next_idx;
if (values < 0)
values = values + tp.NoOfSample;
if (values > max_size)
values = max_size;
data = (float *)calloc(1, 4 * values);
last_next_idx
= tp.NextWriteIndex[tp.WriteBuffer];
for (k = 0; k < values; k++) {
// Add new points
// Insert new value
write_buffer = tp.WriteBuffer;
idx = write_buffer * trend_buff_size / 2
+ (int)tp.NextWriteIndex[write_buffer]
- (values - 1 - k);
idx--;
if (idx < 0)
idx += trend_buff_size;
/*
if (idx == 0 || idx == trend_buff_size * write_buffer)
idx = tp.NoOfSample - 1
+ (!write_buffer) * trend_buff_size / 2;
else
idx--;
*/
data[k] = tp.DataBuffer[idx];
}
}
}
}
jfloatArray jfarray = 0;
if (values > 0) {
jfarray = (*env)->NewFloatArray( env, values);
(*env)->SetFloatArrayRegion( env, jfarray, 0, values, data);
}
(*env)->ReleaseStringUTFChars( env, jdstrend_object, dstrend_object);
if (data)
free(data);
gdhrGetDsTrend = (*env)->NewObject( env, gdhrGetDsTrend_id,
gdhrGetDsTrend_cid,
jfarray,
(jint)values,
(jint)last_next_idx,
(jint)last_buffer,
(jint)sts);
return gdhrGetDsTrend;
}
JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_getSevItemData
(JNIEnv *env, jobject obj, jstring jserver, jobject joid, jstring jattribute, jfloat jtimerange, jint jmax_size)
{
int sts = GDH__SUCCESS;
jclass gdhrSevItemData_id;
static jmethodID gdhrSevItemData_cid = NULL;
jobject gdhrSevItemData;
jclass PwrtObjid_id;
static jmethodID PwrtObjid_getOix = NULL;
static jmethodID PwrtObjid_getVid = NULL;
float timerange = jtimerange;
int max_size = jmax_size;
char *server;
char *attribute;
pwr_tOid oid;
pwr_tOName aname;
pwr_tDeltaTime dt_timerange;
pwr_tTime* tbuf;
void* vbuf;
int rows;
pwr_eType vtype;
unsigned int vsize;
pwr_tTime from, to;
pwr_tDeltaTime diff;
int k;
char *s;
jfloatArray jtarray = 0;
jfloatArray f_varray = 0;
jintArray i_varray = 0;
float *tarray = 0;
void *jvarray = 0;
gdhrSevItemData_id = (*env)->FindClass( env, "jpwr/rt/GdhrSevItemData");
if(gdhrSevItemData_id == NULL) printf("gdhrSevItemData_id ks NULL");
if(gdhrSevItemData_cid == NULL) {
gdhrSevItemData_cid = (*env)->GetMethodID( env, gdhrSevItemData_id,
"<init>", "(I[FLjava/lang/Object;II)V");
if(gdhrSevItemData_cid == NULL) printf("gdhrSevItemData_cid is NULL");
}
PwrtObjid_id = (*env)->FindClass( env, "jpwr/rt/PwrtObjid");
if(PwrtObjid_getOix == NULL || PwrtObjid_getVid == NULL) {
PwrtObjid_getOix = (*env)->GetMethodID( env, PwrtObjid_id, "getOix", "()I");
PwrtObjid_getVid = (*env)->GetMethodID( env, PwrtObjid_id, "getVid", "()I");
}
oid.oix = (*env)->CallIntMethod( env, joid, PwrtObjid_getOix);
oid.vid = (*env)->CallIntMethod( env, joid, PwrtObjid_getVid);
while(1) {
if (!gdh_scctx) {
sevcli_init(&sts, &gdh_scctx);
if (EVEN(sts))
break;
}
server = (char *)(*env)->GetStringUTFChars(env, jserver, 0);
gdh_ConvertUTFstring( server, server);
attribute = (char *)(*env)->GetStringUTFChars(env, jattribute, 0);
gdh_ConvertUTFstring( attribute, attribute);
sevcli_set_servernode(&sts, gdh_scctx, server);
if (EVEN(sts))
break;
time_FloatToD(&dt_timerange, timerange);
time_GetTime(&to);
time_Asub(&from, &to, &dt_timerange);
//memset(&oid, 0, sizeof(oid));
strncpy(aname, attribute, sizeof(aname));
if ((s = strchr(aname, '#')))
*s = 0;
sevcli_get_itemdata(&sts, gdh_scctx, oid, aname, from, to, max_size, &tbuf, &vbuf,
&rows, &vtype, &vsize);
if (EVEN(sts))
break;
tarray = (float *)calloc(1, 4 * rows);
for (k = 0; k < rows; k++) {
time_Adiff(&diff, &to, &tbuf[k]);
time_DToFloat(&tarray[k], &diff);
}
if (rows > 0) {
jtarray = (*env)->NewFloatArray(env, rows);
(*env)->SetFloatArrayRegion(env, jtarray, 0, rows, tarray);
}
switch (vtype) {
case pwr_eType_Float32: {
if (rows > 0) {
f_varray = (*env)->NewFloatArray(env, rows);
(*env)->SetFloatArrayRegion(env, f_varray, 0, rows, vbuf);
jvarray = f_varray;
}
break;
}
case pwr_eType_Int32:
case pwr_eType_UInt32:
case pwr_eType_Boolean: {
if (rows > 0) {
i_varray = (*env)->NewIntArray(env, rows);
(*env)->SetIntArrayRegion(env, i_varray, 0, rows, vbuf);
jvarray = i_varray;
}
break;
}
default:
sts = 0;
break;
}
free(tarray);
free(tbuf);
free(vbuf);
break;
}
(*env)->ReleaseStringUTFChars(env, jserver, server);
(*env)->ReleaseStringUTFChars(env, jattribute, attribute);
gdhrSevItemData = (*env)->NewObject( env, gdhrSevItemData_id,
gdhrSevItemData_cid,
(jint)rows,
jtarray,
jvarray,
(jint)vtype,
(jint)sts);
return gdhrSevItemData;
}
JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_getSevItemInfo
(JNIEnv *env, jobject obj, jstring jsevhist_object)
{
int sts = GDH__SUCCESS;
jclass gdhrSevItemInfo_id;
static jmethodID gdhrSevItemInfo_cid = NULL;
jobject gdhrSevItemInfo;
jclass PwrtObjid_id;
jmethodID PwrtObjid_cid;
jobject objid_obj = NULL;
pwr_tOid oid;
jint oix, vid;
jstring jserver = NULL;
jstring jattr = NULL;
pwr_tAttrRef sevhist_aref;
pwr_tAttrRef thread_aref;
pwr_tAttrRef aref;
pwr_tAttrRef attr_aref;
pwr_tAName aname;
pwr_tCid cid;
pwr_tOid thread_oid;
char server[80];
char *sevhist_object;
pwr_tOName attr;
char *s;
gdhrSevItemInfo_id = (*env)->FindClass( env, "jpwr/rt/GdhrSevItemInfo");
if(gdhrSevItemInfo_id == NULL) printf("gdhrSevItemInfo_id ks NULL");
if(gdhrSevItemInfo_cid == NULL) {
gdhrSevItemInfo_cid = (*env)->GetMethodID( env, gdhrSevItemInfo_id,
"<init>", "(Ljpwr/rt/PwrtObjid;Ljava/lang/String;Ljava/lang/String;I)V");
if(gdhrSevItemInfo_cid == NULL) printf("gdhrSevItemInfo_cid is NULL");
}
PwrtObjid_id = (*env)->FindClass( env, "jpwr/rt/PwrtObjid");
PwrtObjid_cid = (*env)->GetMethodID( env, PwrtObjid_id,
"<init>", "(II)V");
sevhist_object = (char *)(*env)->GetStringUTFChars(env, jsevhist_object, 0);
gdh_ConvertUTFstring(sevhist_object, sevhist_object);
while (1) {
sts = gdh_NameToAttrref(pwr_cNObjid, sevhist_object, &sevhist_aref);
if (EVEN(sts))
break;
sts = gdh_GetAttrRefTid(&sevhist_aref, &cid);
if (EVEN(sts))
break;
if (cid != pwr_cClass_SevHist)
break;
sts = gdh_ArefANameToAref(&sevhist_aref, "ThreadObject", &aref);
if (EVEN(sts))
break;
sts = gdh_GetObjectInfoAttrref(&aref, &thread_oid, sizeof(thread_oid));
if (EVEN(sts))
break;
thread_aref = cdh_ObjidToAref(thread_oid);
sts = gdh_ArefANameToAref(&thread_aref, "ServerNode", &aref);
if (EVEN(sts))
break;
sts = gdh_GetObjectInfoAttrref(&aref, server, sizeof(server));
if (EVEN(sts))
break;
sts = gdh_ArefANameToAref(&sevhist_aref, "Attribute", &aref);
if (EVEN(sts))
break;
sts = gdh_GetObjectInfoAttrref(&aref, &attr_aref, sizeof(attr_aref));
if (EVEN(sts))
break;
sts = gdh_AttrrefToName(&attr_aref, aname, sizeof(aname), cdh_mNName);
if (EVEN(sts))
break;
s = strchr(aname, '.');
if (!s) {
sts = 0;
break;
}
oid = attr_aref.Objid;
strcpy(attr, s+1);
oix = (jint) oid.oix;
vid = (jint) oid.vid;
jattr = (*env)->NewStringUTF(env, attr);
jserver = (*env)->NewStringUTF(env, server);
objid_obj = (*env)->NewObject(env, PwrtObjid_id, PwrtObjid_cid,
oix, vid);
break;
}
gdhrSevItemInfo = (*env)->NewObject(env, gdhrSevItemInfo_id,
gdhrSevItemInfo_cid,
objid_obj,
jattr,
jserver,
(jint)sts);
return gdhrSevItemInfo;
}
static int gdh_JidToPointer( int id, void **p)
{
#if defined HW_X86_64
......
......@@ -407,6 +407,30 @@ JNIEXPORT jint JNICALL Java_jpwr_rt_Gdh_getCircBuffInfo
JNIEXPORT jint JNICALL Java_jpwr_rt_Gdh_updateCircBuffInfo
(JNIEnv *, jobject, jobject, jint);
/*
* Class: jpwr_rt_Gdh
* Method: getDsTrend
* Signature: (Ljava/lang/String;III)Ljpwr/rt/GdhrGetDsTrend;
*/
JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_getDsTrend
(JNIEnv *, jobject, jstring, jint, jint, jint);
/*
* Class: jpwr_rt_Gdh
* Method: getSevItemInfo
* Signature: (Ljava/lang/String;)Ljpwr/rt/GdhrSevItemInfo;
*/
JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_getSevItemInfo
(JNIEnv *, jobject, jstring);
/*
* Class: jpwr_rt_Gdh
* Method: getSevItemData
* Signature: (Ljava/lang/String;Ljpwr/rt/PwrtObjid;Ljava/lang/String;FI)Ljpwr/rt/GdhrSevItemData;
*/
JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_getSevItemData
(JNIEnv *, jobject, jstring, jobject, jstring, jfloat, jint);
#ifdef __cplusplus
}
#endif
......
......@@ -700,6 +700,21 @@ public class Gdh {
*/
public native int updateCircBuffInfo(CircBuffInfo[] info, int info_size);
// public native GdhrGetXttObj[] getAllXttChildrenNative(PwrtObjid objid);
/**
Get data from a DsTrend.
*/
public native GdhrGetDsTrend getDsTrend(String jstrend_object, int last_next_idx,
int last_buffer, int max_size);
/**
Get info of a sevhist object.
*/
public native GdhrSevItemInfo getSevItemInfo(String jsevhist_object);
/**
Get data from a sevhist item.
*/
public native GdhrSevItemData getSevItemData(String jserver, PwrtObjid oid,
String jattribute, float timerange,
int max_size);
}
......
......@@ -128,6 +128,11 @@ public class GdhWebSocketServer
public final static int MH_SYNC = 66;
public final static int MH_ACK = 67;
public final static int GET_OBJECT_FROM_AREF = 68;
public final static int GET_DSTREND = 69;
public final static int GET_DSTRENDCURVE_INFO = 70;
public final static int GET_DSTRENDCURVE_BUFFER = 71;
public final static int GET_SEVHIST_INFO = 72;
public final static int GET_SEVHIST_DATA = 73;
public final static int GET_OP_SELF = 1;
public final static int GET_OP_METHOD_PLC = 2;
......@@ -142,7 +147,6 @@ public class GdhWebSocketServer
public final static int __UNREFED = 0;
static ArrayList<SubElement> subscriptions = new ArrayList<SubElement>();
//static ArrayList subscriptions = new ArrayList();
static int subscriptionCount = 0;
......@@ -165,6 +169,52 @@ public class GdhWebSocketServer
static int lastIndexReffed = 0;
static class CbInfoElem {
int id;
int threadNumber;
int buffCnt;
CircBuffInfo[] cbInfo;
public CbInfoElem(int id, int threadNumber, int buffCnt, CircBuffInfo[] cbInfo) {
this.id = id;
this.threadNumber = threadNumber;
this.buffCnt = buffCnt;
this.cbInfo = cbInfo;
}
public int getId() {
return id;
}
public int getThreadNumber() {
return threadNumber;
}
public CircBuffInfo[] getCbInfo() {
return cbInfo;
}
};
Vector<CbInfoElem> cbInfoList = new Vector<CbInfoElem>();
int cbInfoCnt = 0;
void cbInfoAdd(int id, int threadNumber, int buffCnt, CircBuffInfo[] cbInfo) {
cbInfoList.add(new CbInfoElem(id, threadNumber, buffCnt, cbInfo));
}
void cbInfoShow() {
for (int i = 0; i < cbInfoList.size(); i++)
System.out.println(i + " id " + cbInfoList.get(i).getId() + " thread " + cbInfoList.get(i).getThreadNumber());
}
void cbInfoRemove(int threadNumber) {
for (int i = 0; i < cbInfoList.size(); i++) {
if (cbInfoList.get(i).getThreadNumber() == threadNumber)
cbInfoList.remove(i--);
}
}
CbInfoElem cbInfoGet(int id) {
for (int i = 0; i < cbInfoList.size(); i++) {
if (cbInfoList.get(i).getId() == id)
return cbInfoList.get(i);
}
return null;
}
class WebButton {
public static final int GRAPH = 0;
public static final int LINK = 1;
......@@ -564,6 +614,9 @@ public class GdhWebSocketServer
catch(IOException e) {
errh.error("DataStream failed");
connectionOccupied[threadNumber] = false;
cbInfoRemove(threadNumber);
if (debug)
cbInfoShow();
threadCount--;
setCurrentConnections(threadCount);
return;
......@@ -616,6 +669,9 @@ public class GdhWebSocketServer
timer.cancel();
connectionOccupied[threadNumber] = false;
cbInfoRemove(threadNumber);
if (debug)
cbInfoShow();
threadCount--;
setCurrentConnections(threadCount);
return;
......@@ -2805,6 +2861,619 @@ public class GdhWebSocketServer
}
break;
}
case GET_DSTREND: {
int sts = 123;
int refsize = 0;
int j;
int last_idx;
int last_buffer;
int max_size;
int len;
int i = 6;
last_idx = ((value[i] & 0xFF) << 0) + ((value[i+1] & 0xFF) << 8);
i += 2;
last_buffer = ((value[i] & 0xFF) << 0) + ((value[i+1] & 0xFF) << 8);
i += 2;
max_size = ((value[i] & 0xFF) << 0) + ((value[i+1] & 0xFF) << 8);
i += 2;
len = ((value[i] & 0xFF) << 0) + ((value[i+1] & 0xFF) << 8);
i += 2;
String dstrend = new String( value, i, len);
GdhrGetDsTrend ret = gdh.getDsTrend(dstrend, last_idx, last_buffer,
max_size);
refsize += 4;
refsize += 4;
if (ret.oddSts()) {
refsize += 2;
refsize += 2;
refsize += 2;
refsize += 4 * ret.size;
}
byte[] msg;
int jstart;
if ( refsize + 13 < 125) {
jstart = 15;
msg = new byte[15 + refsize];
msg[0] = (byte)130;
msg[1] = (byte)(13 + refsize);
j = 2;
}
else {
jstart = 17;
msg = new byte[17 + refsize];
msg[0] = (byte)130;
msg[1] = (byte)126;
msg[2] = (byte)(((13 + refsize) >> 8) & 0xFF);
msg[3] = (byte)((13 + refsize) & 0xFF);
j = 4;
}
msg[j++] = GET_DSTREND;
msg[j++] = (byte)(id >> 24);
msg[j++] = (byte)((id >> 16) & 0xFF);
msg[j++] = (byte)((id >> 8) & 0xFF);
msg[j++] = (byte)(id & 0xFF);
msg[j++] = (byte)(sts >> 24);
msg[j++] = (byte)((sts >> 16) & 0xFF);
msg[j++] = (byte)((sts >> 8) & 0xFF);
msg[j++] = (byte)(sts & 0xFF);
if (ret.oddSts()) {
ByteBuffer bb = ByteBuffer.wrap( msg);
bb.putShort( j, (short)ret.last_next_idx);
j += 2;
bb.putShort( j, (short)ret.last_buffer);
j += 2;
bb.putShort( j, (short)ret.size);
j += 2;
for ( i = 0; i < ret.size; i++) {
bb.putFloat(j, ret.data[i]);
j += 4;
}
}
try {
out.write( msg);
out.flush();
}
catch(IOException e) {
System.out.println("GetDsTrend failed" + e.toString());
}
break;
}
case GET_DSTRENDCURVE_INFO: {
int sts = 123;
int refsize = 0;
int j;
int len;
float displayTime = 0;
float displayUpdateTime = 0;
float scanTime = 0;
int noOfSample = 0;
int displayResolution = 0;
int timeResolution = 0;
int elementType = 0;
int cbid;
PwrtAttrRef aref = null;
CdhrFloat fret;
CdhrInt iret;
CdhrString sret;
CdhrAttrRef aret;
int buffCnt = 0;
int i = 6;
len = ((value[i] & 0xFF) << 0) + ((value[i+1] & 0xFF) << 8);
i += 2;
String name = new String( value, i, len);
CircBuffInfo[] cb_info = new CircBuffInfo[2];
if ((sts & 1) == 1) {
fret = gdh.getObjectInfoFloat( name + ".DisplayTime");
if ( fret.evenSts())
sts = fret.getSts();
else
displayTime = fret.value;
}
if ((sts & 1) == 1) {
fret = gdh.getObjectInfoFloat( name + ".DisplayUpdateTime");
if ( fret.evenSts())
sts = fret.getSts();
else
displayUpdateTime = fret.value;
}
if ((sts & 1) == 1) {
fret = gdh.getObjectInfoFloat(name + ".ScanTime");
if ( fret.evenSts())
sts = fret.getSts();
else
scanTime = fret.value;
}
if ((sts & 1) == 1) {
iret = gdh.getObjectInfoInt(name + ".NoOfSample");
if ( iret.evenSts())
sts = iret.getSts();
else
noOfSample = iret.value;
}
if ((sts & 1) == 1) {
iret = gdh.getObjectInfoInt(name + ".DisplayResolution");
if ( iret.evenSts())
sts = iret.getSts();
else
displayResolution = iret.value;
}
if ((sts & 1) == 1) {
iret = gdh.getObjectInfoInt(name + ".TimeResolution");
if ( iret.evenSts())
sts = iret.getSts();
else
timeResolution = iret.value;
}
if ((sts & 1) == 1) {
for (int k = 0; k < 2; k++) {
sret = gdh.getObjectInfoString( name + ".Buffers[" + k + "]");
if ( sret.evenSts())
sts = sret.getSts();
else if (sret.str.equals(""))
sts = 0;
if ((sts & 1) == 1) {
aret = gdh.nameToAttrRef(sret.str);
if ( aret.evenSts())
sts = sret.getSts();
else
aref = aret.aref;
}
if ((sts & 1) == 1) {
iret = gdh.getObjectInfoInt(name + ".AttributeType[" + k + "]");
if ( iret.evenSts())
sts = iret.getSts();
else
elementType = iret.value;
}
if ((sts & 1) != 1) {
if (buffCnt == 0)
break;
else {
sts = 1;
break;
}
}
cb_info[buffCnt] = new CircBuffInfo();
cb_info[buffCnt].circAref = aref;
cb_info[buffCnt].resolution = displayResolution;
cb_info[buffCnt].elementType = elementType;
cb_info[buffCnt].samples = noOfSample;
buffCnt++;
}
}
cbid = cbInfoCnt++;
cbInfoAdd(cbid, threadNumber, buffCnt, cb_info);
if (debug)
cbInfoShow();
refsize += 4;
refsize += 4;
if ((sts & 1) == 1) {
refsize += 4;
refsize += 4;
refsize += 4;
refsize += 4;
refsize += 4;
refsize += 4;
refsize += 4;
for (int k = 0; k < buffCnt; k++)
refsize += 4;
}
byte[] msg;
int jstart;
if ( refsize + 13 < 125) {
jstart = 15;
msg = new byte[15 + refsize];
msg[0] = (byte)130;
msg[1] = (byte)(13 + refsize);
j = 2;
}
else {
jstart = 17;
msg = new byte[17 + refsize];
msg[0] = (byte)130;
msg[1] = (byte)126;
msg[2] = (byte)(((13 + refsize) >> 8) & 0xFF);
msg[3] = (byte)((13 + refsize) & 0xFF);
j = 4;
}
msg[j++] = GET_DSTRENDCURVE_INFO;
msg[j++] = (byte)(id >> 24);
msg[j++] = (byte)((id >> 16) & 0xFF);
msg[j++] = (byte)((id >> 8) & 0xFF);
msg[j++] = (byte)(id & 0xFF);
msg[j++] = (byte)(sts >> 24);
msg[j++] = (byte)((sts >> 16) & 0xFF);
msg[j++] = (byte)((sts >> 8) & 0xFF);
msg[j++] = (byte)(sts & 0xFF);
if ((sts & 1) == 1) {
ByteBuffer bb = ByteBuffer.wrap( msg);
bb.putInt( j, cbid);
j += 4;
bb.putInt( j, displayResolution);
j += 4;
bb.putInt( j, noOfSample);
j += 4;
bb.putFloat( j, displayUpdateTime);
j += 4;
bb.putFloat( j, displayTime);
j += 4;
bb.putFloat( j, scanTime);
j += 4;
bb.putInt( j, buffCnt);
j += 4;
for (int k = 0; k < buffCnt; k++) {
bb.putInt( j, cb_info[k].elementType);
j += 4;
}
}
try {
out.write( msg);
out.flush();
}
catch(IOException e) {
System.out.println("GetDsTrend failed" + e.toString());
}
break;
}
case GET_DSTRENDCURVE_BUFFER: {
int sts = 123;
int refsize = 0;
int j, k;
int elementtype = 0;
int samples;
int len;
int cbid;
int update;
int i = 6;
cbid = ((value[i] & 0xFF) << 0) + ((value[i+1] & 0xFF) << 8) + ((value[i+2] & 0xFF) << 16) + ((value[i+3] & 0xFF) << 24);
i += 4;
samples = ((value[i] & 0xFF) << 0) + ((value[i+1] & 0xFF) << 8) + ((value[i+2] & 0xFF) << 16) + ((value[i+3] & 0xFF) << 24);
i += 4;
update = ((value[i] & 0xFF) << 0) + ((value[i+1] & 0xFF) << 8) + ((value[i+2] & 0xFF) << 16) + ((value[i+3] & 0xFF) << 24);
i += 4;
CbInfoElem elem = cbInfoGet(cbid);
if (elem == null)
sts = 0;
if ((sts & 1) == 1) {
for (k = 0; k < elem.buffCnt; k++) {
if (samples < elem.cbInfo[k].samples)
elem.cbInfo[k].samples = samples;
}
if (update == 0) {
for (k = 0; k < elem.buffCnt; k++)
gdh.getCircBuffInfo(elem.cbInfo[k]);
}
else {
gdh.updateCircBuffInfo(elem.cbInfo, elem.buffCnt);
}
for (k = 0; k < elem.buffCnt; k++) {
if ((sts & 1) != 1)
sts = elem.cbInfo[k].status;
}
}
refsize += 4;
refsize += 4;
if ((sts & 1) == 1) {
refsize += 4;
for (k = 0; k < elem.buffCnt; k++) {
refsize += 4;
refsize += 4;
refsize += 4 * elem.cbInfo[k].size;
}
}
byte[] msg;
int jstart;
if ( refsize + 13 < 125) {
jstart = 15;
msg = new byte[15 + refsize];
msg[0] = (byte)130;
msg[1] = (byte)(13 + refsize);
j = 2;
}
else {
jstart = 17;
msg = new byte[17 + refsize];
msg[0] = (byte)130;
msg[1] = (byte)126;
msg[2] = (byte)(((13 + refsize) >> 8) & 0xFF);
msg[3] = (byte)((13 + refsize) & 0xFF);
j = 4;
}
msg[j++] = GET_DSTRENDCURVE_BUFFER;
msg[j++] = (byte)(id >> 24);
msg[j++] = (byte)((id >> 16) & 0xFF);
msg[j++] = (byte)((id >> 8) & 0xFF);
msg[j++] = (byte)(id & 0xFF);
msg[j++] = (byte)(sts >> 24);
msg[j++] = (byte)((sts >> 16) & 0xFF);
msg[j++] = (byte)((sts >> 8) & 0xFF);
msg[j++] = (byte)(sts & 0xFF);
if ((sts & 1) == 1) {
ByteBuffer bb = ByteBuffer.wrap( msg);
bb.putInt(j, elem.buffCnt);
j += 4;
for (k = 0; k < elem.buffCnt; k++) {
bb.putInt(j, elem.cbInfo[k].size);
j += 4;
bb.putInt(j, elem.cbInfo[k].elementType);
j += 4;
switch (elem.cbInfo[k].elementType) {
case Pwr.eType_Float32:
for ( i = 0; i < elem.cbInfo[k].size; i++) {
bb.putFloat(j, ((float[])elem.cbInfo[k].bufp)[i]);
j += 4;
//System.out.println("Value " + i + " " + ((float[])elem.cbInfo[k].bufp)[i]);
}
break;
case Pwr.eType_Int32:
case Pwr.eType_UInt32:
case Pwr.eType_Int16:
case Pwr.eType_UInt16:
case Pwr.eType_Int8:
case Pwr.eType_UInt8:
case Pwr.eType_Boolean:
for ( i = 0; i < elem.cbInfo[k].size; i++) {
bb.putInt(j, ((int[])elem.cbInfo[k].bufp)[i]);
j += 4;
}
break;
default:;
}
}
}
try {
out.write( msg);
out.flush();
}
catch(IOException e) {
System.out.println("GetDsTrendCurveBuffer failed" + e.toString());
}
break;
}
case GET_SEVHIST_DATA: {
int sts = 123;
int refsize = 0;
int j, k;
int elementtype = 0;
int len;
float timerange;
int max_size;
PwrtObjid oid = new PwrtObjid(0,0);
int i = 6;
timerange = Float.intBitsToFloat(((value[i] & 0xFF) << 0) + ((value[i+1] & 0xFF) << 8) + ((value[i+2] & 0xFF) << 16) + ((value[i+3] & 0xFF) << 24));
i += 4;
max_size = ((value[i] & 0xFF) << 0) + ((value[i+1] & 0xFF) << 8) + ((value[i+2] & 0xFF) << 16) + ((value[i+3] & 0xFF) << 24);
i += 4;
oid.vid = ((value[i] & 0xFF) << 0) + ((value[i+1] & 0xFF) << 8) + ((value[i+2] & 0xFF) << 16) + ((value[i+3] & 0xFF) << 24);
i += 4;
oid.oix = ((value[i] & 0xFF) << 0) + ((value[i+1] & 0xFF) << 8) + ((value[i+2] & 0xFF) << 16) + ((value[i+3] & 0xFF) << 24);
i += 4;
len = ((value[i] & 0xFF) << 0) + ((value[i+1] & 0xFF) << 8);
i += 2;
String server = new String( value, i, len);
i += len;
len = ((value[i] & 0xFF) << 0) + ((value[i+1] & 0xFF) << 8);
i += 2;
String attribute = new String( value, i, len);
i += len;
GdhrSevItemData ret = gdh.getSevItemData(server, oid, attribute, timerange, max_size);
sts = ret.getSts();
//float[] tbuf = {0f, 10f, 20f, 30f, 40f, 50f, 60f, 70f, 80f, 90f, 100f};
//float[] vbuf = {0f, 15.5f, 22.22f, 33.3f, 88f, 77f, 66f, 33f, 44f, 55f, 22f};
refsize += 4;
refsize += 4;
if ((sts & 1) == 1) {
refsize += 4;
refsize += 4;
refsize += ret.tbuf.length * 4;
switch (ret.vtype) {
case Pwr.eType_Float32:
refsize += ((float[])ret.vbuf).length * 4;
break;
case Pwr.eType_Int32:
case Pwr.eType_UInt32:
case Pwr.eType_Int16:
case Pwr.eType_UInt16:
case Pwr.eType_Int8:
case Pwr.eType_UInt8:
case Pwr.eType_Boolean:
refsize += ((int[])ret.vbuf).length * 4;
break;
}
//refsize++; // To avoid disconnect
}
byte[] msg;
int jstart;
if ( refsize + 13 < 125) {
jstart = 15;
msg = new byte[15 + refsize];
msg[0] = (byte)130;
msg[1] = (byte)(13 + refsize);
j = 2;
}
else {
refsize++; // To avoid disconnect
jstart = 17;
msg = new byte[17 + refsize];
msg[0] = (byte)130;
msg[1] = (byte)126;
msg[2] = (byte)(((13 + refsize) >> 8) & 0xFF);
msg[3] = (byte)((13 + refsize) & 0xFF);
j = 4;
}
msg[j++] = GET_SEVHIST_DATA;
msg[j++] = (byte)(id >> 24);
msg[j++] = (byte)((id >> 16) & 0xFF);
msg[j++] = (byte)((id >> 8) & 0xFF);
msg[j++] = (byte)(id & 0xFF);
msg[j++] = (byte)(sts >> 24);
msg[j++] = (byte)((sts >> 16) & 0xFF);
msg[j++] = (byte)((sts >> 8) & 0xFF);
msg[j++] = (byte)(sts & 0xFF);
if ((sts & 1) == 1) {
ByteBuffer bb = ByteBuffer.wrap( msg);
bb.putInt(j, ret.vtype);
j += 4;
bb.putInt(j, ret.tbuf.length);
j += 4;
for (k = 0; k < ret.tbuf.length; k++) {
bb.putFloat(j, ret.tbuf[k]);
j += 4;
//System.out.println("Time " + k + " " + ret.tbuf[k]);
}
switch (ret.vtype) {
case Pwr.eType_Float32:
for (k = 0; k < ((float[])ret.vbuf).length; k++) {
bb.putFloat(j, ((float[])ret.vbuf)[k]);
j += 4;
}
//System.out.println("Send " + sts + " " + ((float[])ret.vbuf).length);
break;
case Pwr.eType_Int32:
case Pwr.eType_UInt32:
case Pwr.eType_Int16:
case Pwr.eType_UInt16:
case Pwr.eType_Int8:
case Pwr.eType_UInt8:
case Pwr.eType_Boolean:
for (k = 0; k < ((int[])ret.vbuf).length; k++) {
bb.putInt(j, ((int[])ret.vbuf)[k]);
j += 4;
//System.out.println("Value " + k + " " + ((int[])ret.vbuf)[k]);
}
System.out.println("Send " + sts + " " + ((int[])ret.vbuf).length);
break;
}
}
try {
out.write( msg);
out.flush();
}
catch(IOException e) {
System.out.println("GetSevHistBuffer failed" + e.toString());
}
break;
}
case GET_SEVHIST_INFO: {
int sts = 123;
int refsize = 0;
int j, k;
int elementtype = 0;
int len;
float timerange;
int max_size;
int i = 6;
len = ((value[i] & 0xFF) << 0) + ((value[i+1] & 0xFF) << 8);
i += 2;
String sevhist_object = new String( value, i, len);
i += len;
GdhrSevItemInfo ret = gdh.getSevItemInfo(sevhist_object);
sts = ret.getSts();
refsize += 4;
refsize += 4;
if ((sts & 1) == 1) {
refsize += 8;
refsize += 2;
refsize += ret.attr.length();
refsize += 2;
refsize += ret.server.length();
}
byte[] msg;
int jstart;
if ( refsize + 13 < 125) {
jstart = 15;
msg = new byte[15 + refsize];
msg[0] = (byte)130;
msg[1] = (byte)(13 + refsize);
j = 2;
}
else {
jstart = 17;
msg = new byte[17 + refsize];
msg[0] = (byte)130;
msg[1] = (byte)126;
msg[2] = (byte)(((13 + refsize) >> 8) & 0xFF);
msg[3] = (byte)((13 + refsize) & 0xFF);
j = 4;
}
msg[j++] = GET_SEVHIST_INFO;
msg[j++] = (byte)(id >> 24);
msg[j++] = (byte)((id >> 16) & 0xFF);
msg[j++] = (byte)((id >> 8) & 0xFF);
msg[j++] = (byte)(id & 0xFF);
msg[j++] = (byte)(sts >> 24);
msg[j++] = (byte)((sts >> 16) & 0xFF);
msg[j++] = (byte)((sts >> 8) & 0xFF);
msg[j++] = (byte)(sts & 0xFF);
if ((sts & 1) == 1) {
ByteBuffer bb = ByteBuffer.wrap( msg);
bb.putInt(j, ret.oid.vid);
j += 4;
bb.putInt(j, ret.oid.oix);
j += 4;
bb.putShort(j, (short)ret.attr.length());
j += 2;
for (k = 0; k < ret.attr.length(); k++)
bb.put( j++, (byte)ret.attr.charAt(k));
bb.putShort(j, (short)ret.server.length());
j += 2;
for (k = 0; k < ret.server.length(); k++)
bb.put( j++, (byte)ret.server.charAt(k));
}
try {
out.write( msg);
out.flush();
}
catch(IOException e) {
System.out.println("GetSevHistInfo failed" + e.toString());
}
break;
}
default:
System.out.println("Unknown function code received: " + value[0]);
}
......@@ -2844,7 +3513,10 @@ public class GdhWebSocketServer
this.trimRefObjectList();
connectionOccupied[threadNumber] = false;
threadCount--;
cbInfoRemove(threadNumber);
if (debug)
cbInfoShow();
threadCount--;
setCurrentConnections(threadCount);
System.out.println("ServerSocket IOException " + e.toString());
System.out.println("Terminating thread " + threadNumber);
......
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2020 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.rt;
import java.io.Serializable;
/**
Return class for functions returning cicular buffer information.
Contains a return status and circular buffer information.
*/
public class GdhrGetDsTrend implements Serializable
{
private static final long serialVersionUID = -2632525127459438144L;
public int sts;
public int last_next_idx;
public int last_buffer;
public int size;
public float[] data;
public GdhrGetDsTrend(float[] data, int size, int last_next_idx, int last_buffer,
int sts)
{
this.data = data;
this.size = size;
this.last_next_idx = last_next_idx;
this.last_buffer = last_buffer;
this.sts = sts;
}
public boolean evenSts() { return (sts % 2 == 0);}
public boolean oddSts() { return (sts % 2 == 1);}
public int getSts() { return sts;}
}
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2020 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.rt;
import java.io.Serializable;
/**
Return class for functions returning cicular buffer information.
Contains a return status and circular buffer information.
*/
public class GdhrSevItemData implements Serializable
{
private static final long serialVersionUID = -650888721059659030L;
public int size;
public float[] tbuf;
public Object vbuf;
public int vtype;
public int sts;
public GdhrSevItemData(int size, float[] tbuf, Object vbuf, int vtype, int sts)
{
this.size = size;
this.tbuf = tbuf;
this.vbuf = vbuf;
this.vtype = vtype;
this.sts = sts;
}
public boolean evenSts() { return (sts % 2 == 0);}
public boolean oddSts() { return (sts % 2 == 1);}
public int getSts() { return sts;}
}
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2020 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
package jpwr.rt;
import java.io.Serializable;
/**
Return class for functions returning cicular buffer information.
Contains a return status and circular buffer information.
*/
public class GdhrSevItemInfo implements Serializable
{
private static final long serialVersionUID = 2932793763480084882L;
public PwrtObjid oid;
public String attr;
public String server;
public int sts;
public GdhrSevItemInfo(PwrtObjid oid, String attr, String server, int sts)
{
this.oid = oid;
this.attr = attr;
this.server = server;
this.sts = sts;
}
public boolean evenSts() { return (sts % 2 == 0);}
public boolean oddSts() { return (sts % 2 == 1);}
public int getSts() { return sts;}
}
......@@ -36,6 +36,9 @@ local_java_sources = \
GdhrsAttrDef.java \
CircBuffInfo.java \
GdhrCircBuffInfo.java \
GdhrGetDsTrend.java \
GdhrSevItemInfo.java \
GdhrSevItemData.java \
GdhApplIfc.java \
Gdh.java \
Sub.java \
......
......@@ -160,7 +160,12 @@ function Gdh() {
GET_OBJECT_FROM_NAME : 65,
MH_SYNC : 66,
MH_ACK : 67,
GET_OBJECT_FROM_AREF : 68
GET_OBJECT_FROM_AREF : 68,
GET_DSTREND : 69,
GET_DSTRENDCURVE_INFO : 70,
GET_DSTRENDCURVE_BUFFER : 71,
GET_SEVHIST_INFO : 72,
GET_SEVHIST_DATA : 73
};
this.debug = false;
......@@ -830,6 +835,226 @@ function Gdh() {
delete this.gdh.pending[id];
break;
}
case Msg.GET_DSTREND: {
var j = 9;
var last_idx = dv.getUint16(j);
j += 2;
var last_buffer = dv.getUint16(j);
j += 2;
var size = dv.getUint16(j);
if ( this.gdh.debug) console.log("GetDsTrend received", id, size, last_idx);
j += 2;
value = new Array(size);
for ( var k = 0; k < size; k++) {
value[k] = dv.getFloat32(j);
j += 4;
}
var result = []
result[0] = last_idx;
result[1] = last_buffer;
result[2] = size;
result[3] = value;
var pending_data = this.gdh.pending[id];
pending_data.func_cb( id, pending_data.data, sts, result);
delete this.gdh.pending[id];
break;
}
case Msg.GET_DSTRENDCURVE_INFO: {
var j = 9;
var cbid = dv.getUint32(j);
j += 4;
var resolution = dv.getUint32(j);
j += 4;
var samples = dv.getUint32(j);
j += 4;
var displayupdatetime = dv.getFloat32(j);
j += 4;
var displaytime = dv.getFloat32(j);
j += 4;
var scantime = dv.getFloat32(j);
j += 4;
var buffcnt = dv.getUint32(j);
j += 4;
var elementtype1 = dv.getUint32(j);
j += 4;
if (buffcnt > 1) {
var elementtype1 = dv.getUint32(j);
j += 4;
}
if ( this.gdh.debug) console.log("GetDsTrendCurveInfo received", id, size);
var result = []
result[0] = cbid;
result[1] = resolution;
result[2] = samples;
result[3] = displayupdatetime;
result[4] = displaytime;
result[5] = scantime;
result[6] = buffcnt;
result[7] = elementtype1;
if (buffcnt > 1)
result[8] = elementtype2;
var pending_data = this.gdh.pending[id];
pending_data.func_cb( id, pending_data.data, sts, result);
delete this.gdh.pending[id];
break;
}
case Msg.GET_DSTRENDCURVE_BUFFER: {
var result = []
if ( sts & 1) {
var buffcnt;
var size1;
var size2;
var elementtype1;
var elementtype2
var value1;
var value2;
var i;
var j = 9;
buffcnt = dv.getUint32(j);
j += 4;
size1 = dv.getUint32(j);
j += 4;
elementtype1 = dv.getUint32(j);
j += 4;
value1 = new Array(size1);
switch (elementtype1) {
case Pwr.eType_Float32:
for ( var k = 0; k < size1; k++) {
value1[k] = dv.getFloat32(j);
j += 4;
}
break;
case Pwr.eType_Int8:
case Pwr.eType_Int16:
case Pwr.eType_Int32:
case Pwr.eType_UInt8:
case Pwr.eType_UInt16:
case Pwr.eType_UInt32:
for ( var k = 0; k < size1; k++) {
value1[k] = dv.getInt32(j);
j += 4;
}
break;
}
if (buffcnt > 1) {
size2 = dv.getUint32(j);
j += 4;
elementtype2 = dv.getUint32(j);
j += 4;
value2 = new Array(size2);
switch (elementtype2) {
case Pwr.eType_Float32:
for ( var k = 0; k < size2; k++) {
value2[k] = dv.getFloat32(j);
j += 4;
}
break;
case Pwr.eType_Int8:
case Pwr.eType_Int16:
case Pwr.eType_Int32:
case Pwr.eType_UInt8:
case Pwr.eType_UInt16:
case Pwr.eType_UInt32:
case Pwr.eType_Boolean:
for ( var k = 0; k < size2; k++) {
value2[k] = dv.getInt32(j);
j += 4;
}
break;
}
}
if ( this.gdh.debug) console.log("GetDsTrendCurveBuffer received", id, size);
result[0] = size1;
result[1] = size1;
result[2] = elementtype1;
result[3] = value1;
if (buffcnt > 1) {
result[4] = size2;
result[5] = elementtype2;
result[6] = value2;
}
}
var pending_data = this.gdh.pending[id];
pending_data.func_cb( id, pending_data.data, sts, result);
delete this.gdh.pending[id];
break;
}
case Msg.GET_SEVHIST_DATA: {
var j = 9;
var vtype = dv.getUint32(j);
j += 4;
var size = dv.getUint32(j);
j += 4;
var tbuf = new Array(size);
for ( var k = 0; k < size; k++) {
tbuf[k] = dv.getFloat32(j);
j += 4;
}
var vbuf = new Array(size);
switch (vtype) {
case Pwr.eType_Float32:
for ( var k = 0; k < size; k++) {
vbuf[k] = dv.getFloat32(j);
j += 4;
}
break;
case Pwr.eType_Int8:
case Pwr.eType_Int16:
case Pwr.eType_Int32:
case Pwr.eType_UInt8:
case Pwr.eType_UInt16:
case Pwr.eType_UInt32:
case Pwr.eType_Boolean:
for ( var k = 0; k < size; k++) {
vbuf[k] = dv.getInt32(j);
j += 4;
}
break;
}
var result = []
result[0] = vtype;
result[1] = size;
result[2] = tbuf;
result[3] = vbuf;
var pending_data = this.gdh.pending[id];
pending_data.func_cb( id, pending_data.data, sts, result);
delete this.gdh.pending[id];
break;
}
case Msg.GET_SEVHIST_INFO: {
var j = 9;
var oid = new PwrtObjid(0,0);
oid.vid = dv.getUint32(j);
j += 4;
oid.oix = dv.getUint32(j);
j += 4;
var len = dv.getUint16(j);
j += 2;
var iarr = new Uint8Array( len);
for ( var k = 0; k < len; k++) {
iarr[k] = dv.getUint8(j++);
}
var attr = String.fromCharCode.apply( null, iarr);
len = dv.getUint16(j);
j += 2;
iarr = new Uint8Array( len);
for ( var k = 0; k < len; k++) {
iarr[k] = dv.getUint8(j++);
}
var server = String.fromCharCode.apply( null, iarr);
var result = []
result[0] = oid;
result[1] = attr;
result[2] = server;
var pending_data = this.gdh.pending[id];
pending_data.func_cb( id, pending_data.data, sts, result);
delete this.gdh.pending[id];
break;
}
default:
console.log("Unknown message type");
}
......@@ -1446,5 +1671,137 @@ function Gdh() {
this.ws.send(buf);
this.next_id++;
};
this.getDsTrend = function( name, last_idx, last_buffer, max_size, return_cb, data) {
var buf = new Uint8Array(14 + name.length);
buf[0] = Msg.GET_DSTREND;
buf[2] = this.next_id & 0xFF;
buf[3] = (this.next_id >> 8) & 0xFF;
buf[4] = (this.next_id >> 16) & 0xFF;
buf[5] = (this.next_id >> 24) & 0xFF;
buf[6] = last_idx & 0xFF;
buf[7] = (last_idx >> 8) & 0xFF;
buf[8] = last_buffer & 0xFF;
buf[9] = (last_buffer >> 8) & 0xFF;
buf[10] = max_size & 0xFF;
buf[11] = (max_size >> 8) & 0xFF;
buf[12] = name.length & 0xFF;
buf[13] = (name.length >> 8) & 0xFF;
var k = 14;
for ( var i = 0; i < name.length; i++) {
buf[k++] = name.charCodeAt(i);
}
this.pending[this.next_id] = new PendingData( return_cb, data);
if (this.debug) console.log( "Sending getDsTrend", this.next_id, name);
this.ws.send(buf);
this.next_id++;
};
this.getDsTrendCurveInfo = function( name, return_cb, data) {
var buf = new Uint8Array(8 + name.length);
buf[0] = Msg.GET_DSTRENDCURVE_INFO;
buf[2] = this.next_id & 0xFF;
buf[3] = (this.next_id >> 8) & 0xFF;
buf[4] = (this.next_id >> 16) & 0xFF;
buf[5] = (this.next_id >> 24) & 0xFF;
buf[6] = name.length & 0xFF;
buf[7] = (name.length >> 8) & 0xFF;
var k = 8;
for ( var i = 0; i < name.length; i++) {
buf[k++] = name.charCodeAt(i);
}
this.pending[this.next_id] = new PendingData( return_cb, data);
if (this.debug) console.log( "Sending getDsTrendCurveInfo", this.next_id, name);
this.ws.send(buf);
this.next_id++;
};
this.getDsTrendCurveBuffer = function( cbid, samples, update, return_cb, data) {
var buf = new Uint8Array(18);
buf[0] = Msg.GET_DSTRENDCURVE_BUFFER;
buf[2] = this.next_id & 0xFF;
buf[3] = (this.next_id >> 8) & 0xFF;
buf[4] = (this.next_id >> 16) & 0xFF;
buf[5] = (this.next_id >> 24) & 0xFF;
buf[6] = cbid & 0xFF;
buf[7] = (cbid >> 8) & 0xFF;
buf[8] = (cbid >> 16) & 0xFF;
buf[9] = (cbid >> 24) & 0xFF;
buf[10] = samples & 0xFF;
buf[11] = (samples >> 8) & 0xFF;
buf[12] = (samples >> 16) & 0xFF;
buf[13] = (samples >> 24) & 0xFF;
buf[14] = update & 0xFF;
buf[15] = (update >> 8) & 0xFF;
buf[16] = (update >> 16) & 0xFF;
buf[17] = (update >> 24) & 0xFF;
this.pending[this.next_id] = new PendingData( return_cb, data);
if (this.debug) console.log( "Sending getDsTrendCurveBuffer", this.next_id, samples, update);
this.ws.send(buf);
this.next_id++;
};
this.getSevHistData = function( timerange, max_size, server, oid, attribute,
return_cb, data) {
var buf = new Uint8Array(26 + server.length + attribute.length);
buf[0] = Msg.GET_SEVHIST_DATA;
buf[2] = this.next_id & 0xFF;
buf[3] = (this.next_id >> 8) & 0xFF;
buf[4] = (this.next_id >> 16) & 0xFF;
buf[5] = (this.next_id >> 24) & 0xFF;
var fbuf = new ArrayBuffer(4);
var fa = new Float32Array(fbuf);
fa[0] = timerange;
var ba = new Uint8Array(fbuf);
buf[6] = ba[0];
buf[7] = ba[1];
buf[8] = ba[2];
buf[9] = ba[3];
buf[10] = max_size & 0xFF;
buf[11] = (max_size >> 8) & 0xFF;
buf[12] = (max_size >> 16) & 0xFF;
buf[13] = (max_size >> 24) & 0xFF;
buf[14] = oid.vid & 0xFF;
buf[15] = (oid.vid >> 8) & 0xFF;
buf[16] = (oid.vid >> 16) & 0xFF;
buf[17] = (oid.vid >> 24) & 0xFF;
buf[18] = oid.oix & 0xFF;
buf[19] = (oid.oix >> 8) & 0xFF;
buf[20] = (oid.oix >> 16) & 0xFF;
buf[21] = (oid.oix >> 24) & 0xFF;
buf[22] = server.length & 0xFF;
buf[23] = (server.length >> 8) & 0xFF;
var k = 24;
for ( var i = 0; i < server.length; i++)
buf[k++] = server.charCodeAt(i);
buf[k++] = attribute.length & 0xFF;
buf[k++] = (attribute.length >> 8) & 0xFF;
for ( var i = 0; i < attribute.length; i++)
buf[k++] = attribute.charCodeAt(i);
this.pending[this.next_id] = new PendingData( return_cb, data);
if (this.debug) console.log( "Sending getSevHistData", this.next_id, attribute);
this.ws.send(buf);
this.next_id++;
};
this.getSevHistInfo = function(sevhist_object, return_cb, data) {
var buf = new Uint8Array(8 + sevhist_object.length);
buf[0] = Msg.GET_SEVHIST_INFO;
buf[2] = this.next_id & 0xFF;
buf[3] = (this.next_id >> 8) & 0xFF;
buf[4] = (this.next_id >> 16) & 0xFF;
buf[5] = (this.next_id >> 24) & 0xFF;
buf[6] = sevhist_object.length & 0xFF;
buf[7] = (sevhist_object.length >> 8) & 0xFF;
var k = 8;
for ( var i = 0; i < sevhist_object.length; i++)
buf[k++] = sevhist_object.charCodeAt(i);
this.pending[this.next_id] = new PendingData( return_cb, data);
if (this.debug) console.log( "Sending getSevHistInfo", this.next_sevhist_object);
this.ws.send(buf);
this.next_id++;
};
}
/** End Gdh **/
......@@ -37,6 +37,8 @@ var Glow = {
eType_DynType2 : 22,
eType_ActionType2 : 23,
eType_AppMotion : 24,
eType_Float : 25,
eType_HorizDirection : 26,
eCtxType_Glow : 0,
eCtxType_Brow : 1,
......@@ -125,6 +127,9 @@ var Glow = {
eDirection_Up : 3,
eDirection_Down : 4,
eHorizDirection_Left : 0,
eHorizDirection_Right : 1,
eAdjustment_Center : 0,
eAdjustment_Right : 1,
eAdjustment_Left : 2,
......@@ -1260,16 +1265,17 @@ var Glow = {
eSave_GrowTrend_trace_data7 : 3223,
eSave_GrowTrend_trace_data8 : 3224,
eSave_GrowTrend_trace_data9 : 3225,
eSave_GrowTrend_trace_data10 : 3226,
eSave_GrowTrend_trace_data10 : 3226,
eSave_GrowTrend_access : 3227,
eSave_GrowTrend_cycle : 3228,
eSave_GrowTrend_cycle : 3228,
eSave_GrowTrend_ref_object : 3229,
eSave_GrowTrend_userdata_cb : 3230,
eSave_GrowTrend_x_max_value_0 : 3231,
eSave_GrowTrend_x_min_value_0 : 3232,
eSave_GrowTrend_x_max_value_1 : 3233,
eSave_GrowTrend_x_min_value_1 : 3234,
eSave_GrowTrend_mode : 3235,
eSave_GrowTrend_mode : 3235,
eSave_GrowTrend_direction : 3236,
eSave_GrowSlider_grownode_part : 3300,
eSave_GrowSlider_direction : 3301,
eSave_GrowSlider_max_value : 3302,
......@@ -9994,8 +10000,9 @@ function GrowTrend( ctx) {
this.x_mark2;
this.y_mark1;
this.y_mark2;
this.mark1_color;
this.mark2_color;
this.mark1_color = Glow.eDrawType_Inherit;
this.mark2_color = Glow.eDrawType_Inherit;
this.direction;
for ( var i = 0; i < Glow.TREND_MAX_CURVES; i++)
this.curve[i] = null;
......@@ -10069,6 +10076,9 @@ function GrowTrend( ctx) {
case Glow.eSave_GrowTrend_curve_width:
this.curve_width = parseInt(tokens[1], 10);
break;
case Glow.eSave_GrowTrend_direction:
this.direction = parseInt(tokens[1], 10);
break;
case Glow.eSave_GrowTrend_scan_time:
this.scan_time = parseFloat( tokens[1]);
break;
......@@ -10109,7 +10119,6 @@ function GrowTrend( ctx) {
if ( end)
break;
}
this.configure_curves();
return i;
};
......@@ -10267,7 +10276,7 @@ function GrowTrend( ctx) {
if ( xm2 >= ll_x && xm2 <= ur_x) {
drawtype = this.mark2_color;
if ( drawtype == Glow.eDrawType_Inherit)
drawtype = Glow.eDrawType_ColorYellow;
drawtype = Glow.eDrawType_ColorRed;
this.ctx.gdraw.line( xm2, ll_y, xm2, ur_y, drawtype, idx, 0);
}
}
......@@ -10293,12 +10302,14 @@ function GrowTrend( ctx) {
if ( ym2 >= ll_y && ym2 <= ur_y) {
drawtype = this.mark2_color;
if ( drawtype == Glow.eDrawType_Inherit)
drawtype = Glow.eDrawType_ColorYellow;
drawtype = Glow.eDrawType_ColorRed;
this.ctx.gdraw.line( ll_x, ym2, ur_x, ym2, drawtype, idx, 0);
}
}
if ( this.border !== 0) {
drawtype = GlowColor.get_drawtype( this.draw_type, Glow.eDrawType_LineHighlight,
highlight, colornode, 0, 0);
this.ctx.gdraw.rect( ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, drawtype, idx, 0);
}
};
......@@ -10381,7 +10392,7 @@ function GrowTrend( ctx) {
this.y_mark1 = this.ur.y - (mark - min) / (max - min) * (this.ur.y - this.ll.y);
}
if ( this.display_y_mark2 !== 0) {
mark = this.y_min_value[0] - (this.y_mark2 - ur.y) *(this.y_max_value[0] - this.y_min_value[0]) / (this.ur.y - this.ll.y);
mark = this.y_min_value[0] - (this.y_mark2 - this.ur.y) *(this.y_max_value[0] - this.y_min_value[0]) / (this.ur.y - this.ll.y);
this.y_mark2 = this.ur.y - (mark - min) / (max - min) * (this.ur.y - this.ll.y);
}
}
......@@ -10463,6 +10474,100 @@ function GrowTrend( ctx) {
this.get_background_object_limits = function( t, type, x, y, bo) {
return 0;
};
this.get_direction = function() {
return this.direction;
};
this.set_data = function( tdata, vdata, curve_idx, data_points) {
var dt, dt_fill;
var points;
var cpoints;
var pointarray;
var point_p;
var i, j, idx;
this.no_of_points = Math.max( 2, this.no_of_points);
points = cpoints = Math.min( this.no_of_points, data_points);
if ( this.fill_curve !== 0)
cpoints += 2;
this.curve_width = Math.min( Glow.DRAW_TYPE_SIZE, Math.max( 1, this.curve_width));
pointarray = new Array(cpoints);
j = curve_idx;
for ( i = 0, idx = 0; i < cpoints; i++, idx++) {
point_p = pointarray[i] = new GlowPointX();
if ( this.fill_curve == 0) {
idx = i;
if ( this.y_max_value[j] != this.y_min_value[j])
point_p.y = this.ur.y - (vdata[idx] - this.y_min_value[j]) /
(this.y_max_value[j] - this.y_min_value[j]) * (this.ur.y - this.ll.y);
point_p.y = Math.max( this.ll.y, Math.min( point_p.y, this.ur.y));
if ( this.direction == Glow.eHorizDirection_Right)
point_p.x = this.ll.x
+ (tdata[idx] - tdata[0]) / (tdata[points - 1] - tdata[0])
* (this.ur.x - this.ll.x);
else
point_p.x = this.ur.x
- (tdata[idx] - tdata[0]) / (tdata[points - 1] - tdata[0])
* (this.ur.x - this.ll.x);
}
else {
if ( i == 0) {
if ( this.direction == Glow.eHorizDirection_Right)
point_p.x = this.ll.x;
else
point_p.x = this.ur.x;
point_p.y = this.ur.y;
idx--;
} else if (i == cpoints -1) {
if ( this.direction == Glow.eHorizDirection_Right)
point_p.x = this.ur.x;
else
point_p.x = this.ll.x;
point_p.y = this.ur.y;
} else {
if ( this.y_max_value[j] != this.y_min_value[j])
point_p.y = this.ur.y
- (vdata[idx] - this.y_min_value[j])
/ (this.y_max_value[j] - this.y_min_value[j]) * (this.ur.y - this.ll.y);
point_p.y = Math.max(this.ll.y, Math.min(point_p.y, this.ur.y));
if (this.direction == Glow.eHorizDirection_Right)
point_p.x = this.ll.x
+ (tdata[idx] - tdata[0]) / (tdata[points - 1] - tdata[0])
* (this.ur.x - this.ll.x);
else
point_p.x = this.ur.x
- (tdata[idx] - tdata[0]) / (tdata[points - 1] - tdata[0])
* (this.ur.x - this.ll.x);
}
}
point_p++;
}
if ( this.curve_drawtype[j] != Glow.eDrawType_Inherit)
dt = this.curve_drawtype[j];
else
dt = this.draw_type;
if ( this.curve_fill_drawtype[j] != Glow.eDrawType_Inherit)
dt_fill = this.curve_fill_drawtype[j];
else
dt_fill = this.draw_type;
this.ctx.nodraw++;
this.curve[j] = new GrowPolyline( ctx);
this.curve[j].init( "", pointarray, cpoints, dt,
this.curve_width,
0, this.fill_curve, 1, 0, dt_fill);
this.ctx.nodraw--;
this.draw();
};
}
GrowTrend.prototype = Object.create(GrowRect.prototype);
......
......@@ -105,6 +105,10 @@ var DynC = {
mDynType2_DigBackgroundColor : 1 << 6,
mDynType2_DigSwap : 1 << 7,
mDynType2_DigScript : 1 << 8,
mDynType2_RefUpdate : 1 << 9,
mDynType2_DsTrend : 1 << 10,
mDynType2_DsTrendCurve : 1 << 11,
mDynType2_SevHist : 1 << 12,
mActionType1_No : 0,
mActionType1_Inherit : 1 << 0,
......@@ -165,41 +169,44 @@ var DynC = {
eDynPrio_Trend : 24,
eDynPrio_FastCurve : 25,
eDynPrio_XY_Curve : 26,
eDynPrio_AnalogText : 27,
eDynPrio_Table : 28,
eDynPrio_SliderBackground : 29,
eDynPrio_Video : 30,
eDynPrio_StatusColor : 31,
eDynPrio_PopupMenu : 32,
eDynPrio_Confirm : 33,
eDynPrio_SetDig : 34,
eDynPrio_ResetDig : 35,
eDynPrio_ToggleDig : 36,
eDynPrio_StoDig : 37,
eDynPrio_Help : 38,
eDynPrio_OpenGraph : 39,
eDynPrio_OpenURL : 40,
eDynPrio_CommandDoubleClick : 41,
eDynPrio_IncrAnalog : 42,
eDynPrio_RadioButton : 43,
eDynPrio_Slider : 44,
eDynPrio_TipText : 45,
eDynPrio_PulldownMenu : 46,
eDynPrio_OptionMenu : 47,
eDynPrio_InputFocus : 48,
eDynPrio_DigCommand : 49,
eDynPrio_SetValue : 50,
eDynPrio_Pie : 51,
eDynPrio_BarChart : 52,
eDynPrio_Axis : 53,
eDynPrio_MethodToolbar : 54,
eDynPrio_MethodPulldownMenu : 55,
eDynPrio_ScrollingText : 56,
eDynPrio_ColorThemeLightness : 57,
eDynPrio_DigSwap : 58,
eDynPrio_DigScript : 59,
eDynPrio_CatchSignal : 60,
eDynPrio_EmitSignal : 61,
eDynPrio_DsTrend : 27,
eDynPrio_DsTrendCurve : 28,
eDynPrio_SevHist : 29,
eDynPrio_AnalogText : 30,
eDynPrio_Table : 31,
eDynPrio_SliderBackground : 32,
eDynPrio_Video : 33,
eDynPrio_StatusColor : 34,
eDynPrio_PopupMenu : 35,
eDynPrio_Confirm : 36,
eDynPrio_SetDig : 37,
eDynPrio_ResetDig : 38,
eDynPrio_ToggleDig : 39,
eDynPrio_StoDig : 40,
eDynPrio_Help : 41,
eDynPrio_OpenGraph : 42,
eDynPrio_OpenURL : 43,
eDynPrio_CommandDoubleClick : 44,
eDynPrio_IncrAnalog : 45,
eDynPrio_RadioButton : 46,
eDynPrio_Slider : 47,
eDynPrio_TipText : 48,
eDynPrio_PulldownMenu : 49,
eDynPrio_OptionMenu : 50,
eDynPrio_InputFocus : 51,
eDynPrio_DigCommand : 52,
eDynPrio_SetValue : 53,
eDynPrio_Pie : 54,
eDynPrio_BarChart : 55,
eDynPrio_Axis : 56,
eDynPrio_MethodToolbar : 57,
eDynPrio_MethodPulldownMenu : 58,
eDynPrio_ScrollingText : 59,
eDynPrio_ColorThemeLightness : 60,
eDynPrio_DigSwap : 61,
eDynPrio_DigScript : 62,
eDynPrio_CatchSignal : 63,
eDynPrio_EmitSignal : 64,
eDynPrio_Script : 9998,
eDynPrio_Command : 9999,
eDynPrio_CloseGraph : 10000,
......@@ -244,6 +251,9 @@ var DynC = {
eSave_DigBackgroundColor : 44,
eSave_DigSwap : 45,
eSave_DigScript : 46,
eSave_RefUpdate : 47,
eSave_DsTrend : 48,
eSave_DsTrendCurve : 49,
eSave_PopupMenu : 50,
eSave_SetDig : 51,
eSave_ResetDig : 52,
......@@ -270,6 +280,7 @@ var DynC = {
eSave_Script : 73,
eSave_CatchSignal : 74,
eSave_EmitSignal : 75,
eSave_SevHist : 76,
eSave_End : 99,
eSave_Dyn_dyn_type1 : 100,
eSave_Dyn_action_type1 : 101,
......@@ -436,6 +447,7 @@ var DynC = {
eSave_XY_Curve_y_mark2_attr : 3422,
eSave_XY_Curve_mark1_color : 3423,
eSave_XY_Curve_mark2_color : 3424,
eSave_XY_Curve_hold_attr : 3425,
eSave_DigCommand_attribute : 3500,
eSave_DigCommand_command : 3501,
eSave_DigCommand_instance : 3502,
......@@ -491,6 +503,29 @@ var DynC = {
eSave_DigScript_script : 4601,
eSave_DigScript_script_len : 4602,
eSave_DigScript_level : 4603,
eSave_RefUpdate_attribute : 4700,
eSave_RefUpdate_whole_graph : 4701,
eSave_DsTrend_dstrend_object1 : 4800,
eSave_DsTrend_dstrend_object2 : 4801,
eSave_DsTrend_mark1_attr : 4802,
eSave_DsTrend_mark2_attr : 4803,
eSave_DsTrend_mark1_color : 4804,
eSave_DsTrend_mark2_color : 4805,
eSave_DsTrend_hold_attr : 4806,
eSave_DsTrend_minvalue_attr1 : 4807,
eSave_DsTrend_maxvalue_attr1 : 4808,
eSave_DsTrend_minvalue_attr2 : 4809,
eSave_DsTrend_maxvalue_attr2 : 4810,
eSave_DsTrendCurve_dstrend_object : 4900,
eSave_DsTrendCurve_mark1_attr : 4902,
eSave_DsTrendCurve_mark2_attr : 4903,
eSave_DsTrendCurve_mark1_color : 4904,
eSave_DsTrendCurve_mark2_color : 4905,
eSave_DsTrendCurve_hold_attr : 4906,
eSave_DsTrendCurve_minvalue_attr1 : 4907,
eSave_DsTrendCurve_maxvalue_attr1 : 4908,
eSave_DsTrendCurve_minvalue_attr2 : 4909,
eSave_DsTrendCurve_maxvalue_attr2 : 4910,
eSave_PopupMenu_ref_object : 5000,
eSave_SetDig_attribute : 5100,
eSave_SetDig_instance : 5101,
......@@ -680,6 +715,24 @@ var DynC = {
eSave_CatchSignal_signal_name : 7400,
eSave_EmitSignal_signal_name : 7500,
eSave_EmitSignal_global : 7501,
eSave_SevHist_sevhist_object1 : 7600,
eSave_SevHist_sevhist_object2 : 7601,
eSave_SevHist_attribute1 : 7602,
eSave_SevHist_attribute2 : 7603,
eSave_SevHist_server : 7604,
eSave_SevHist_mark1_attr : 7605,
eSave_SevHist_mark2_attr : 7606,
eSave_SevHist_mark1_color : 7607,
eSave_SevHist_mark2_color : 7608,
eSave_SevHist_hold_attr : 7609,
eSave_SevHist_minvalue_attr1 : 7610,
eSave_SevHist_maxvalue_attr1 : 7611,
eSave_SevHist_minvalue_attr2 : 7612,
eSave_SevHist_maxvalue_attr2 : 7613,
eSave_SevHist_timerange : 7614,
eSave_SevHist_timerange_attr : 7615,
eSave_SevHist_update_attr : 7616,
eSave_SevHist_updatetime : 7617,
eAnimSequence_Inherit : 0,
eAnimSequence_Cycle : 1,
......@@ -984,6 +1037,15 @@ function Dyn( graph) {
case DynC.eSave_Trend:
elem = new DynTrend(this);
break;
case DynC.eSave_DsTrend:
elem = new DynDsTrend(this);
break;
case DynC.eSave_DsTrendCurve:
elem = new DynDsTrendCurve(this);
break;
case DynC.eSave_SevHist:
elem = new DynSevHist(this);
break;
case DynC.eSave_FillLevel:
elem = new DynFillLevel(this);
break;
......@@ -5218,7 +5280,7 @@ function DynTrend( dyn) {
if ( this.hold_a !== null) {
var holdval = this.hold_a.get_ref_value(this.dyn);
if ( this.holdval)
if ( holdval)
return;
}
......@@ -5467,60 +5529,298 @@ function DynTrend( dyn) {
};
}
function DynXY_Curve( dyn) {
function DynDsTrend( dyn) {
this.dyn = dyn;
this.dyn_type1 = DynC.mDynType1_XY_Curve;
this.dyn_type2 = 0;
this.dyn_type1 = 0;
this.dyn_type2 = DynC.mDynType2_DsTrend;
this.action_type1 = 0;
this.action_type2 = 0;
this.prio = DynC.eDynPrio_XY_Curve;
this.prio = DynC.eDynPrio_DsTrend;
this.instance_mask = 0;
this.instance = 0;
this.firstScan = true;
this.x_a = null;
this.y_a = null;
this.y_minvalue_a = null;
this.y_maxvalue_a = null;
this.x_minvalue_a = null;
this.x_maxvalue_a = null;
this.noofpoints_a = null;
this.update_a = null;
this.x_mark1_a = null;
this.x_mark2_a = null;
this.y_mark1_a = null;
this.y_mark2_a = null;
this.x_attr = null;
this.y_attr = null;
this.y_minvalue_attr;
this.y_maxvalue_attr;
this.x_minvalue_attr;
this.x_maxvalue_attr;
this.noofpoints_attr;
this.update_attr;
this.x_mark1_attr = null;
this.x_mark2_attr = null;
this.y_mark1_attr = null;
this.y_mark2_attr = null;
this.minvalue_a1 = null;
this.maxvalue_a1 = null;
this.minvalue_a2 = null;
this.maxvalue_a2 = null;
this.hold_a = null;
this.timerange_a = null;
this.mark1_a = null;
this.mark2_a = null;
this.dstrend_object1 = null;
this.dstrend_object2 = null;
this.minvalue_attr1 = null;
this.maxvalue_attr1 = null;
this.minvalue_attr2 = null;
this.maxvalue_attr2 = null;
this.hold_attr = null;
this.mark1_attr = null;
this.mark2_attr = null;
this.mark1_color;
this.mark2_color;
this.y_min_value;
this.y_max_value;
this.x_min_value;
this.x_max_value;
this.horizontal_padding;
this.datatype;
this.curve_color;
this.fill_color;
this.noofpoints;
this.noOfPoints;
this.xAttrType;
this.yAttrType;
this.curveX = [];
this.curveY = [];
this.curve_number;
this.object;
var self = this;
this.firstScan = true;
this.scan_time;
this.acc_time;
this.no_of_points;
this.trend_hold;
this.orig_graph_scan_time;
this.orig_graph_fast_scan_time;
this.orig_graph_animation_scan_time;
this.last_idx = new Array(2);
this.last_buffer = new Array(2);
this.dstrend_cnt = 0;
this.connect = function( object) {
this.no_of_points = object.get_no_of_points();
this.scan_time = object.get_scan_time();
this.acc_time = this.scan_time;
this.trend_hold = 0;
this.last_idx[0] = -1;
this.last_idx[1] = -1;
this.last_buffer[0] = 0;
this.last_buffer[1] = 0;
if (this.dstrend_object1.trim() !== "") {
this.dstrend_cnt++;
if (this.dstrend_object2.trim() !== "")
this.dstrend_cnt++;
}
if ( this.minvalue_attr1.trim() !== "") {
this.minvalue_a1 = new DynReference( this.dyn, this.minvalue_attr1);
this.minvalue_a1.connect(this.dyn);
if ( !this.minvalue_a1.sts) {
this.minvalue_a1 = null;
console.log("Trend: " + this.minvalue_attr1);
}
}
if ( this.maxvalue_attr1.trim() !== "") {
this.maxvalue_a1 = new DynReference( this.dyn, this.maxvalue_attr1);
this.maxvalue_a1.connect(this.dyn);
if ( !this.maxvalue_a1.sts) {
this.maxvalue_a1 = null;
console.log("Trend: " + this.maxvalue_attr1);
}
}
if ( this.minvalue_attr2.trim() !== "") {
this.minvalue_a2 = new DynReference( this.dyn, this.minvalue_attr2);
this.minvalue_a2.connect(this.dyn);
if ( !this.minvalue_a2.sts) {
this.minvalue_a2 = null;
console.log("Trend: " + this.minvalue_attr2);
}
}
if ( this.maxvalue_attr2.trim() !== "") {
this.maxvalue_a2 = new DynReference( this.dyn, this.maxvalue_attr2);
this.maxvalue_a2.connect(this.dyn);
if ( !this.maxvalue_a2.sts) {
this.maxvalue_a2 = null;
console.log("Trend: " + this.maxvalue_attr2);
}
}
if ( this.hold_attr.trim() !== "") {
this.hold_a = new DynReference( this.dyn, this.hold_attr);
this.hold_a.connect(this.dyn);
if ( !this.hold_a.sts) {
this.hold_a = null;
console.log("Trend: " + this.hold_attr);
}
}
if ( this.mark1_attr !== null && this.mark1_attr.trim() !== "") {
this.mark1_a = new DynReference( this.dyn, this.mark1_attr);
this.mark1_a.connect(this.dyn);
if ( !this.mark1_a.sts) {
this.mark1_a = null;
console.log("Trend: " + this.mark1_attr);
}
}
if ( this.mark2_attr !== null && this.mark2_attr.trim() !== "") {
this.mark2_a = new DynReference( this.dyn, this.mark2_attr);
this.mark2_a.connect(this.dyn);
if ( !this.mark2_a.sts) {
this.mark2_a = null;
console.log("Trend: " + this.mark2_attr);
}
}
if ( this.mark1_color != Glow.eDrawType_Inherit || this.mark2_color != Glow.eDrawType_Inherit)
object.set_mark_color( this.mark1_color, this.mark2_color);
return 1;
};
this.disconnect = function() {
if ( this.minvalue_a1 != null)
this.minvalue_a1.disconnect(this.dyn);
if ( this.maxvalue_a1 != null)
this.maxvalue_a1.disconnect(this.dyn);
if ( this.minvalue_a2 != null)
this.minvalue_a2.disconnect(this.dyn);
if ( this.maxvalue_a2 != null)
this.maxvalue_a2.disconnect(this.dyn);
if ( this.hold_a != null)
this.hold_a.disconnect(this.dyn);
if ( this.mark1_a != null)
this.mark1_a.disconnect(this.dyn);
if ( this.mark2_a != null)
this.mark2_a.disconnect(this.dyn);
};
this.scan = function( object) {
var new_curve = 0;
var i;
if ( this.hold_a !== null && !this.firstScan) {
var holdval = this.hold_a.get_ref_value(this.dyn);
if ( holdval)
return;
}
var minval, maxval;
if ( this.maxvalue_a1 !== null && this.minvalue_a1 !== null) {
minval = this.minvalue_a1.get_ref_value(this.dyn);
maxval = this.maxvalue_a1.get_ref_value(this.dyn);
if ( minval != this.minvalue_a1.oldValue ||
maxval != this.maxvalue_a1.oldValue) {
if ( Math.abs( maxval - minval) > Number.MIN_VALUE)
object.set_range_y( 0, minval, maxval);
this.minvalue_a1.oldValue = minval;
this.maxvalue_a1.oldValue = maxval;
new_curve = 1;
}
}
if ( this.maxvalue_a2 !== null && this.minvalue_a2 !== null) {
minval = this.minvalue_a2.get_ref_value(this.dyn);
maxval = this.maxvalue_a2.get_ref_value(this.dyn);
if ( minval != this.minvalue_a2.oldValue ||
maxval != this.maxvalue_a2.oldValue) {
if ( Math.abs( maxval - minval) > Number.MIN_VALUE)
object.set_range_y( 1, minval, maxval);
this.minvalue_a2.oldValue = minval;
this.maxvalue_a2.oldValue = maxval;
new_curve = 1;
}
}
if ( this.mark1_a !== null) {
var mark1val = this.mark1_a.get_ref_value(this.dyn);
if ( this.firstScan || Math.abs( mark1val - this.mark1_a.oldValue) > Number.MIN_VALUE) {
object.set_y_mark1( mark1val);
this.mark1_a.oldValue = mark1val;
}
}
if ( this.mark2_a !== null) {
var mark2val = this.mark2_a.get_ref_value(this.dyn);
if ( this.firstScan || Math.abs( mark2val - this.mark2_a.oldValue) > Number.MIN_VALUE) {
object.set_y_mark2( mark2val);
this.mark2_a.oldValue = mark2val;
}
}
if ( this.firstScan) {
this.firstScan = false;
new_curve = 1;
}
if (new_curve) {
this.last_idx[0] = -1;
this.last_idx[1] = -1;
}
if ( this.cycle == Glow.eCycle_Slow)
this.acc_time += this.dyn.graph.getScanTime();
else
this.acc_time += this.dyn.graph.getFastScanTime();
if ( new_curve || this.acc_time + Number.MIN_VALUE >= this.scan_time) {
this.acc_time = 0;
var data = new Array(4);
data[0] = this;
data[1] = object;
data[2] = 0;
data[3] = new_curve;
this.dyn.graph.getGdh().getDsTrend(this.dstrend_object1,
this.last_idx[0], this.last_buffer[0], this.no_of_points, this.scan2, data);
}
};
this.scan2 = function( id, data, sts, result) {
if ( sts & 1 != 0) {
var i, j;
var self = data[0];
var object = data[1];
var curve_idx = data[2]
var new_curve = data[3];
self.last_idx[0] = result[0];
self.last_buffer[0] = result[1];
var size = result[2];
var values = result[3];
if (new_curve) {
var vdata = new Array(self.no_of_points);
var tdata = new Array(self.no_of_points);
for (j = 0; j < self.no_of_points; j++) {
// tdata[self.no_of_points-j-1] = j / self.no_of_points * 100;
tdata[j] = j / self.no_of_points * 100;
if (j < size)
vdata[self.no_of_points-j-1] = values[j];
}
object.set_data(tdata, vdata, curve_idx, self.no_of_points);
}
else {
for (i = 0; i < size; i++)
object.add_value( values[i], 0);
}
if (self.dstrend_cnt > 1) {
var data = new Array(4);
data[0] = self;
data[1] = object;
data[2] = 1;
data[3] = new_curve;
self.dyn.graph.getGdh().getDsTrend(self.dstrend_object2,
self.last_idx[1], self.last_buffer[1], self.no_of_points, self.scan3, data);
}
}
};
this.scan3 = function( id, data, sts, result) {
if ( sts & 1 != 0) {
var i, j;
var self = data[0];
var object = data[1];
var curve_idx = data[2]
var new_curve = data[3];
self.last_idx[1] = result[0];
self.last_buffer[1] = result[1];
var size = result[2];
var values = result[3];
if (new_curve) {
var vdata = new Array(self.no_of_points);
var tdata = new Array(self.no_of_points);
for (j = 0; j < self.no_of_points; j++) {
// tdata[self.no_of_points-j-1] = j / self.no_of_points * 100;
tdata[j] = j / self.no_of_points * 100;
if (j < size)
vdata[self.no_of_points-j-1] = values[j];
}
object.set_data(tdata, vdata, curve_idx, self.no_of_points);
}
else {
for (i = 0; i < size; i++)
object.add_value( values[i], 1);
}
}
};
this.action = function( object, e) {
return 1;
};
this.open = function( lines, row) {
var end = false;
......@@ -5531,416 +5831,896 @@ function DynXY_Curve( dyn) {
var tokens = lines[i].split(' ');
var key = parseInt(tokens[0], 10);
if ( this.dyn.debug) console.log( "DynXYCurve : " + lines[i]);
if ( this.dyn.debug) console.log( "DynDsTrend : " + lines[i]);
elem = null;
switch ( key) {
case DynC.eSave_XY_Curve:
case DynC.eSave_DsTrend:
break;
case DynC.eSave_XY_Curve_x_attr:
case DynC.eSave_DsTrend_dstrend_object1:
if ( tokens.length > 1)
this.x_attr = tokens[1];
this.dstrend_object1 = tokens[1];
break;
case DynC.eSave_XY_Curve_y_attr:
case DynC.eSave_DsTrend_dstrend_object2:
if ( tokens.length > 1)
this.y_attr = tokens[1];
this.dstrend_object2 = tokens[1];
break;
case DynC.eSave_XY_Curve_y_minvalue_attr:
case DynC.eSave_DsTrend_minvalue_attr1:
if ( tokens.length > 1)
this.y_minvalue_attr = tokens[1];
break;
case DynC.eSave_XY_Curve_y_maxvalue_attr:
if ( tokens.length > 1)
this.y_maxvalue_attr = tokens[1];
break;
case DynC.eSave_XY_Curve_x_minvalue_attr:
if ( tokens.length > 1)
this.x_minvalue_attr = tokens[1];
break;
case DynC.eSave_XY_Curve_x_maxvalue_attr:
if ( tokens.length > 1)
this.x_maxvalue_attr = tokens[1];
this.minvalue_attr1 = tokens[1];
break;
case DynC.eSave_XY_Curve_noofpoints_attr:
case DynC.eSave_DsTrend_maxvalue_attr1:
if ( tokens.length > 1)
this.noofpoints_attr = tokens[1];
this.maxvalue_attr1 = tokens[1];
break;
case DynC.eSave_XY_Curve_update_attr:
case DynC.eSave_DsTrend_minvalue_attr2:
if ( tokens.length > 1)
this.update_attr = tokens[1];
break;
case DynC.eSave_XY_Curve_y_min_value:
this.y_min_value = parseFloat( tokens[1]);;
break;
case DynC.eSave_XY_Curve_y_max_value:
this.y_max_value = parseFloat( tokens[1]);;
break;
case DynC.eSave_XY_Curve_x_min_value:
this.x_min_value = parseFloat( tokens[1]);;
break;
case DynC.eSave_XY_Curve_x_max_value:
this.x_max_value = parseFloat( tokens[1]);;
break;
case DynC.eSave_XY_Curve_datatype:
this.datatype = parseInt( tokens[1], 10);
break;
case DynC.eSave_XY_Curve_instance:
this.instance = parseInt(tokens[1], 10);
break;
case DynC.eSave_XY_Curve_instance_mask:
this.instance_mask = parseInt( tokens[1], 10);
break;
case DynC.eSave_XY_Curve_curve_color:
this.curve_color = parseInt( tokens[1], 10);
break;
case DynC.eSave_XY_Curve_fill_color:
this.fill_color = parseInt( tokens[1], 10);
break;
case DynC.eSave_XY_Curve_horizontal_padding:
this.horizontal_padding = parseInt( tokens[1], 10);
this.minvalue_attr2 = tokens[1];
break;
case DynC.eSave_XY_Curve_x_mark1_attr:
case DynC.eSave_DsTrend_maxvalue_attr2:
if ( tokens.length > 1)
this.x_mark1_attr = tokens[1];
this.maxvalue_attr2 = tokens[1];
break;
case DynC.eSave_XY_Curve_x_mark2_attr:
case DynC.eSave_DsTrend_hold_attr:
if ( tokens.length > 1)
this.x_mark2_attr = tokens[1];
this.hold_attr = tokens[1];
break;
case DynC.eSave_XY_Curve_y_mark1_attr:
case DynC.eSave_DsTrend_mark1_attr:
if ( tokens.length > 1)
this.y_mark1_attr = tokens[1];
this.mark1_attr = tokens[1];
break;
case DynC.eSave_XY_Curve_y_mark2_attr:
case DynC.eSave_DsTrend_mark2_attr:
if ( tokens.length > 1)
this.y_mark2_attr = tokens[1];
this.mark2_attr = tokens[1];
break;
case DynC.eSave_XY_Curve_mark1_color:
this.mark1_color = parseInt( tokens[1], 10);
case DynC.eSave_DsTrend_mark1_color:
this.mark1_color = parseInt(tokens[1], 10);
break;
case DynC.eSave_XY_Curve_mark2_color:
this.mark2_color = parseInt( tokens[1], 10);
case DynC.eSave_DsTrend_mark2_color:
this.mark2_color = parseInt(tokens[1], 10);
break;
case DynC.eSave_End:
end = true;
break;
default:
console.log( "Syntax error in DynXYCurve");
console.log( "Syntax error in DynDsTrend", row, key);
break;
}
if ( end)
break;
}
}
return i;
};
}
function DynDsTrendCurve( dyn) {
this.dyn = dyn;
this.dyn_type1 = 0;
this.dyn_type2 = DynC.mDynType2_DsTrendCurve;
this.action_type1 = 0;
this.action_type2 = 0;
this.prio = DynC.eDynPrio_DsTrendCurve;
this.instance_mask = 0;
this.instance = 0;
this.connect = function( object) {
if ( this.x_attr == null || this.y_attr == null)
return 1;
this.minvalue_a1 = null;
this.maxvalue_a1 = null;
this.minvalue_a2 = null;
this.maxvalue_a2 = null;
this.hold_a = null;
this.timerange_a = null;
this.mark1_a = null;
this.mark2_a = null;
this.dstrend_object = null;
this.minvalue_attr1 = null;
this.maxvalue_attr1 = null;
this.minvalue_attr2 = null;
this.maxvalue_attr2 = null;
this.hold_attr = null;
this.mark1_attr = null;
this.mark2_attr = null;
this.mark1_color;
this.mark2_color;
this.firstScan = true;
this.scan_time;
this.acc_time;
this.no_of_points;
this.trend_hold;
this.orig_graph_scan_time;
this.orig_graph_fast_scan_time;
this.orig_graph_animation_scan_time;
this.buff_cnt = 0;
this.initialized = 0;
this.no_of_points;
if ( this.update_attr.trim() !== "") {
this.update_a = new DynReference( this.dyn, this.update_attr);
this.update_a.connect(this.dyn);
if ( !this.update_a.sts) {
console.log( "XYCurve: " + this.update_attr);
this.update_a = null;
}
}
this.cbid;
this.displaytime;
this.displayupdatetime;
this.samples;
this.resolution;
this.elementtype1;
this.elementtype2;
this.scantime;
this.connect = function( object) {
if ( this.noofpoints_attr.trim() !== "") {
this.noofpoints_a = new DynReference( this.dyn, this.noofpoints_attr);
this.noofpoints_a.connect(this.dyn);
if ( !this.noofpoints_a.sts) {
console.log( "XYCurve: " + this.noofpoints_attr);
this.noofpoints_a = null;
}
}
this.no_of_points = object.get_no_of_points();
this.scan_time = object.get_scan_time();
this.acc_time = this.scan_time;
this.trend_hold = 0;
if ( this.y_minvalue_attr.trim() !== "") {
this.y_minvalue_a = new DynReference( this.dyn, this.y_minvalue_attr);
this.y_minvalue_a.connect(this.dyn);
if ( !this.y_minvalue_a.sts) {
console.log( "XYCurve: " + this.y_minvalue_attr);
this.y_minvalue_a = null;
if ( this.minvalue_attr1.trim() !== "") {
this.minvalue_a1 = new DynReference( this.dyn, this.minvalue_attr1);
this.minvalue_a1.connect(this.dyn);
if ( !this.minvalue_a1.sts) {
this.minvalue_a1 = null;
console.log("Trend: " + this.minvalue_attr1);
}
}
if ( this.y_maxvalue_attr.trim() !== "") {
this.y_maxvalue_a = new DynReference( this.dyn, this.y_maxvalue_attr);
this.y_maxvalue_a.connect(this.dyn);
if ( !this.y_maxvalue_a.sts) {
console.log( "XYCurve: " + this.y_maxvalue_attr);
this.y_maxvalue_a = null;
if ( this.maxvalue_attr1.trim() !== "") {
this.maxvalue_a1 = new DynReference( this.dyn, this.maxvalue_attr1);
this.maxvalue_a1.connect(this.dyn);
if ( !this.maxvalue_a1.sts) {
this.maxvalue_a1 = null;
console.log("Trend: " + this.maxvalue_attr1);
}
}
if ( this.x_minvalue_attr.trim() !== "") {
this.x_minvalue_a = new DynReference( this.dyn, this.x_minvalue_attr);
this.x_minvalue_a.connect(this.dyn);
if ( !this.x_minvalue_a.sts) {
console.log( "XYCurve: " + this.x_minvalue_attr);
this.x_minvalue_a = null;
if ( this.minvalue_attr2.trim() !== "") {
this.minvalue_a2 = new DynReference( this.dyn, this.minvalue_attr2);
this.minvalue_a2.connect(this.dyn);
if ( !this.minvalue_a2.sts) {
this.minvalue_a2 = null;
console.log("Trend: " + this.minvalue_attr2);
}
}
if ( this.x_maxvalue_attr.trim() !== "") {
this.x_maxvalue_a = new DynReference( this.dyn, this.x_maxvalue_attr);
this.x_maxvalue_a.connect(this.dyn);
if ( !this.x_maxvalue_a.sts) {
console.log( "XYCurve: " + this.x_maxvalue_attr);
this.x_maxvalue_a = null;
if ( this.maxvalue_attr2.trim() !== "") {
this.maxvalue_a2 = new DynReference( this.dyn, this.maxvalue_attr2);
this.maxvalue_a2.connect(this.dyn);
if ( !this.maxvalue_a2.sts) {
this.maxvalue_a2 = null;
console.log("Trend: " + this.maxvalue_attr2);
}
}
if ( this.y_mark1_attr.trim() !== "") {
this.y_mark1_a = new DynReference( this.dyn, this.y_mark1_attr);
this.y_mark1_a.connect(this.dyn);
if ( !this.y_mark1_a.sts) {
console.log( "XYCurve: " + this.y_mark1_attr);
this.y_mark1_a = null;
if ( this.hold_attr.trim() !== "") {
this.hold_a = new DynReference( this.dyn, this.hold_attr);
this.hold_a.connect(this.dyn);
if ( !this.hold_a.sts) {
this.hold_a = null;
console.log("Trend: " + this.hold_attr);
}
}
if ( this.y_mark2_attr.trim() !== "") {
this.y_mark2_a = new DynReference( this.dyn, this.y_mark2_attr);
this.y_mark2_a.connect(this.dyn);
if ( !this.y_mark2_a.sts) {
console.log( "XYCurve: " + this.y_mark2_attr);
this.y_mark2_a = null;
if ( this.mark1_attr !== null && this.mark1_attr.trim() !== "") {
this.mark1_a = new DynReference( this.dyn, this.mark1_attr);
this.mark1_a.connect(this.dyn);
if ( !this.mark1_a.sts) {
this.mark1_a = null;
console.log("Trend: " + this.mark1_attr);
}
}
// Get curve number
this.curve_number = 0;
var m = this.instance;
while( m != 0) {
m = m >> 1;
this.curve_number++;
}
// Get number of curves
if ( this.instance == DynC.mInstance_1) {
m = this.instance_mask;
var noofcurves = 0;
while( m != 0) {
m = m >> 1;
noofcurves++;
if ( this.mark2_attr !== null && this.mark2_attr.trim() !== "") {
this.mark2_a = new DynReference( this.dyn, this.mark2_attr);
this.mark2_a.connect(this.dyn);
if ( !this.mark2_a.sts) {
this.mark2_a = null;
console.log("Trend: " + this.mark2_attr);
}
object.set_xy_noofcurves( noofcurves);
}
this.noofpoints = object.get_no_of_points();
if ( Math.abs(this.y_max_value - this.y_min_value) > Number.MIN_VALUE)
object.set_xy_range_y( this.curve_number - 1, this.y_min_value, this.y_max_value);
if ( Math.abs(this.x_max_value - this.x_min_value) > Number.MIN_VALUE)
object.set_xy_range_x( this.curve_number - 1, this.x_min_value, this.x_max_value);
object.set_xy_curve_color( this.curve_number - 1, this.curve_color, this.fill_color);
this.no_of_points = object.get_no_of_points();
if ( this.mark1_color != Glow.eDrawType_Inherit || this.mark2_color != Glow.eDrawType_Inherit)
object.set_mark_color( this.mark1_color, this.mark2_color);
return 1;
this.dyn.graph.getGdh().getDsTrendCurveInfo(this.dstrend_object,
this.connect2, this);
};
this.disconnect = function() {
if ( this.update_a !== null)
this.update_a.disconnect(this.dyn);
if ( this.noofpoints_a !== null)
this.noofpoints_a.disconnect(this.dyn);
if ( this.y_minvalue_a !== null)
this.y_minvalue_a.disconnect(this.dyn);
if ( this.y_maxvalue_a !== null)
this.y_maxvalue_a.disconnect(this.dyn);
if ( this.x_minvalue_a !== null)
this.x_minvalue_a.disconnect(this.dyn);
if ( this.x_maxvalue_a !== null)
this.x_maxvalue_a.disconnect(this.dyn);
if ( this.x_mark1_a !== null)
this.x_mark1_a.disconnect(this.dyn);
if ( this.x_mark2_a !== null)
this.x_mark2_a.disconnect(this.dyn);
if ( this.y_mark1_a !== null)
this.y_mark1_a.disconnect(this.dyn);
if ( this.y_mark2_a !== null)
this.y_mark2_a.disconnect(this.dyn);
this.connect2 = function( id, data, sts, result) {
if ( sts & 1 != 0) {
var self = data;
self.cbid = result[0];
self.resolution = result[1];
self.samples = result[2];
if (self.samples > self.no_of_points)
self.samples = self.no_of_points;
self.displayupdatetime = result[3];
self.displaytime = result[4];
self.scantime = result[5];
self.buff_cnt = result[6];
self.elementtype1 = result[7];
if (self.buff_cnt > 1)
self.elementtype2 = result[8];
self.initialized = 1;
}
return 1;
};
this.scan = function( object) {
var pname;
var attrSize;
var update = false;
var size = 1;
this.object = object;
this.noOfPoints = this.noofpoints;
this.disconnect = function() {
if ( this.minvalue_a1 != null)
this.minvalue_a1.disconnect(this.dyn);
if ( this.maxvalue_a1 != null)
this.maxvalue_a1.disconnect(this.dyn);
if ( this.minvalue_a2 != null)
this.minvalue_a2.disconnect(this.dyn);
if ( this.maxvalue_a2 != null)
this.maxvalue_a2.disconnect(this.dyn);
if ( this.hold_a != null)
this.hold_a.disconnect(this.dyn);
if ( this.mark1_a != null)
this.mark1_a.disconnect(this.dyn);
if ( this.mark2_a != null)
this.mark2_a.disconnect(this.dyn);
};
if ( this.x_attr == null || this.y_attr == null)
this.scan = function( object) {
var new_curve = 0;
var i;
if ( !this.initialized)
return;
if ( this.firstScan)
update = true;
if ( this.update_a !== null) {
var value = this.update_a.get_ref_value(this.dyn);
if ( value && !this.update_a.oldValue)
update = true;
this.update_a.oldValue = value;
if ( this.hold_a !== null && !this.firstScan) {
var holdval = this.hold_a.get_ref_value(this.dyn);
if ( holdval)
return;
}
if ( this.noofpoints_a !== null) {
var value = this.noofpoints_a.get_ref_value(this.dyn);
if ( value != this.noofpoints_a.oldValue) {
update = true;
this.noofpoints = this.noOfPoints = value;
this.noofpoints_a.oldValue = value;
var minval, maxval;
if ( this.maxvalue_a1 !== null && this.minvalue_a1 !== null) {
minval = this.minvalue_a1.get_ref_value(this.dyn);
maxval = this.maxvalue_a1.get_ref_value(this.dyn);
if ( minval != this.minvalue_a1.oldValue ||
maxval != this.maxvalue_a1.oldValue) {
if ( Math.abs( maxval - minval) > Number.MIN_VALUE)
object.set_range_y( 0, minval, maxval);
this.minvalue_a1.oldValue = minval;
this.maxvalue_a1.oldValue = maxval;
new_curve = 1;
}
}
if ( this.y_minvalue_a !== null) {
var value = this.y_minvalue_a.get_ref_value(this.dyn);
if ( value != this.y_min_value) {
this.y_min_value = value;
if ( Math.abs(this.y_max_value - this.y_min_value) > Number.MIN_VALUE)
object.set_xy_range_y( this.curve_number - 1, this.y_min_value, this.y_max_value);
update = true;
}
}
if ( this.y_maxvalue_a !== null) {
var value = this.y_maxvalue_a.get_ref_value(this.dyn);
if ( value != this.y_max_value) {
this.y_max_value = value;
if ( Math.abs(this.y_max_value - this.y_min_value) > Number.MIN_VALUE)
object.set_xy_range_y( this.curve_number - 1, this.y_min_value, this.y_max_value);
update = true;
if ( this.maxvalue_a2 !== null && this.minvalue_a2 !== null) {
minval = this.minvalue_a2.get_ref_value(this.dyn);
maxval = this.maxvalue_a2.get_ref_value(this.dyn);
if ( minval != this.minvalue_a2.oldValue ||
maxval != this.maxvalue_a2.oldValue) {
if ( Math.abs( maxval - minval) > Number.MIN_VALUE)
object.set_range_y( 1, minval, maxval);
this.minvalue_a2.oldValue = minval;
this.maxvalue_a2.oldValue = maxval;
new_curve = 1;
}
}
if ( this.x_minvalue_a !== null) {
var value = this.x_minvalue_a.get_ref_value(this.dyn);
if ( value != this.x_min_value) {
this.x_min_value = value;
if ( Math.abs(x_max_value - this.x_min_value) > Number.MIN_VALUE)
object.set_xy_range_x( this.curve_number - 1, this.x_min_value, this.x_max_value);
update = true;
if ( this.mark1_a !== null) {
var mark1val = this.mark1_a.get_ref_value(this.dyn);
if ( this.firstScan || Math.abs( mark1val - this.mark1_a.oldValue) > Number.MIN_VALUE) {
object.set_y_mark1( mark1val);
this.mark1_a.oldValue = mark1val;
}
}
if ( this.x_maxvalue_a !== null) {
var value = this.x_maxvalue_a.get_ref_value(this.dyn);
if ( value != this.x_max_value) {
this.x_max_value = value;
if ( Math.abs(x_max_value - this.x_min_value) > Number.MIN_VALUE)
object.set_xy_range_x( this.curve_number - 1, this.x_min_value, this.x_max_value);
update = true;
if ( this.mark2_a !== null) {
var mark2val = this.mark2_a.get_ref_value(this.dyn);
if ( this.firstScan || Math.abs( mark2val - this.mark2_a.oldValue) > Number.MIN_VALUE) {
object.set_y_mark2( mark2val);
this.mark2_a.oldValue = mark2val;
}
}
if ( this.x_mark1_a !== null) {
var mark1val = this.x_mark1_a.get_ref_value(this.dyn);
if ( this.firstScan || Math.abs( mark1val - this.x_mark1_a.oldValue) > Number.MIN_VALUE) {
object.set_x_mark1( mark1val);
this.x_mark1_a.oldValue = mark1val;
}
}
if ( this.x_mark2_a !== null) {
var mark2val = this.x_mark2_a.get_ref_value(this.dyn);
if ( this.firstScan || Math.abs( mark2val - this.x_mark2_a.oldValue) > Number.MIN_VALUE) {
object.set_x_mark2( mark2val);
this.x_mark2_a.oldValue = mark2val;
}
if ( this.firstScan) {
this.firstScan = false;
new_curve = 1;
}
if ( this.y_mark1_a !== null) {
var mark1val = this.y_mark1_a.get_ref_value(this.dyn);
if ( this.firstScan || Math.abs( mark1val - this.y_mark1_a.oldValue) > Number.MIN_VALUE) {
object.set_y_mark1( mark1val);
this.y_mark1_a.oldValue = mark1val;
}
if ( this.cycle == Glow.eCycle_Slow)
this.acc_time += this.dyn.graph.getScanTime();
else
this.acc_time += this.dyn.graph.getFastScanTime();
if ( new_curve || this.acc_time + Number.MIN_VALUE >= this.scan_time) {
this.acc_time = 0;
var data = new Array(4);
data[0] = this;
data[1] = object;
data[2] = 0;
data[3] = new_curve;
this.dyn.graph.getGdh().getDsTrendCurveBuffer(this.cbid,
this.samples, !new_curve, this.scan2, data);
}
if ( this.y_mark2_a !== null) {
var mark2val = this.y_mark2_a.get_ref_value(this.dyn);
if ( this.firstScan || Math.abs( mark2val - this.y_mark2_a.oldValue) > Number.MIN_VALUE) {
object.set_y_mark2( mark2val);
this.y_mark2_a.oldValue = mark2val;
};
this.scan2 = function( id, data, sts, result) {
if ( sts & 1 != 0) {
var i, j, k;
var size;
var value;
var values;
var elementtype;
var self = data[0];
var object = data[1];
var curve_idx = data[2];
var new_curve = data[3];
for (k = 0; k < self.buff_cnt; k++) {
size = result[k * 3 + 1];
elementtype = result[k * 3 + 2];
values = result[k * 3 + 3];
if (size > self.no_of_points)
size = self.no_of_points;
if (new_curve) {
var vdata = new Array(size);
var tdata = new Array(size);
for (j = 0; j < size; j++) {
tdata[j] = j / size * 100;
vdata[size-j-1] = values[j];
}
object.set_data(tdata, vdata, k, size);
}
else {
for (i = 0; i < size; i++)
object.add_value( values[i], k);
}
}
}
};
if ( update) {
pname = this.dyn.parseAttrName( this.x_attr);
attrSize = pname.elements;
this.xAttrType = pname.type;
this.action = function( object, e) {
return 1;
};
switch ( this.datatype) {
case DynC.eCurveDataType_XYArrays:
if ( attrSize < this.noOfPoints)
this.noOfPoints = attrSize;
size = this.noOfPoints;
this.open = function( lines, row) {
var end = false;
var i;
var elem;
for ( i = row; i < lines.length; i++) {
var tokens = lines[i].split(' ');
var key = parseInt(tokens[0], 10);
if ( this.dyn.debug) console.log( "DynDsTrendCurve : " + lines[i]);
elem = null;
switch ( key) {
case DynC.eSave_DsTrendCurve:
break;
case DynC.eCurveDataType_PointArray:
if ( attrSize/2 < this.noOfPoints)
this.noOfPoints = attrSize/2;
size = this.noOfPoints * 2;
case DynC.eSave_DsTrendCurve_dstrend_object:
if ( tokens.length > 1)
this.dstrend_object = tokens[1];
break;
case DynC.eCurveDataType_TableObject:
if ( (attrSize-1)/2 < this.noOfPoints)
this.noOfPoints = (attrSize-1)/2;
size = this.noOfPoints * 2 + 1;
case DynC.eSave_DsTrendCurve_minvalue_attr1:
if ( tokens.length > 1)
this.minvalue_attr1 = tokens[1];
break;
}
// Read x-array
switch ( this.xAttrType) {
case Pwr.eType_Float32:
this.dyn.graph.getGdh().getObjectInfoFloatArray( pname.name, size,
this.scan2, this);
case DynC.eSave_DsTrendCurve_maxvalue_attr1:
if ( tokens.length > 1)
this.maxvalue_attr1 = tokens[1];
break;
case Pwr.eType_Int32:
case Pwr.eType_Int16:
case Pwr.eType_Int8:
case Pwr.eType_UInt32:
case Pwr.eType_UInt16:
case Pwr.eType_UInt8:
this.dyn.graph.getGdh().getObjectInfoIntArray( pname.name, size,
this.scan2, this);
case DynC.eSave_DsTrendCurve_minvalue_attr2:
if ( tokens.length > 1)
this.minvalue_attr2 = tokens[1];
break;
case DynC.eSave_DsTrendCurve_maxvalue_attr2:
if ( tokens.length > 1)
this.maxvalue_attr2 = tokens[1];
break;
case DynC.eSave_DsTrendCurve_hold_attr:
if ( tokens.length > 1)
this.hold_attr = tokens[1];
break;
case DynC.eSave_DsTrendCurve_mark1_attr:
if ( tokens.length > 1)
this.mark1_attr = tokens[1];
break;
case DynC.eSave_DsTrendCurve_mark2_attr:
if ( tokens.length > 1)
this.mark2_attr = tokens[1];
break;
case DynC.eSave_DsTrendCurve_mark1_color:
this.mark1_color = parseInt(tokens[1], 10);
break;
case DynC.eSave_DsTrendCurve_mark2_color:
this.mark2_color = parseInt(tokens[1], 10);
break;
case DynC.eSave_End:
end = true;
break;
default:
return;
console.log( "Syntax error in DynDsTrendCurve", row, key);
break;
}
}
this.firstScan = false;
};
this.scan2 = function( id, self, sts, value) {
switch ( self.xAttrType) {
case Pwr.eType_Float32:
if ( !(sts & 1))
return;
switch ( self.datatype) {
case DynC.eCurveDataType_XYArrays:
self.curveX = new Array(self.noOfPoints);
for ( var i = 0; i < self.noOfPoints; i++)
self.curveX[i] = value[i];
break;
case DynC.eCurveDataType_PointArray:
curveX = new Array(self.noOfPoints);
curveY = new Array(self.noOfPoints);
for ( var i = 0; i < self.noOfPoints; i++) {
self.curveX[i] = value[2*i];
self.curveY[i] = value[2*i+1];
}
self.dyn.repaintNow = true;
if ( end)
break;
case DynC.eCurveDataType_TableObject:
self.noOfPoints = Math.floor(value[0]);
if ( self.noOfPoints > self.noofpoints)
self.noOfPoints = self.noofpoints;
if ( attrSize < self.noOfPoints)
self.noOfPoints = attrSize;
self.curveY = new Array(self.noOfPoints);
self.curveX = new Array(self.noOfPoints);
for ( var i = 0; i < self.noOfPoints; i++) {
self.curveX[i] = value[2*i+1];
self.curveY[i] = value[2*i+2];
}
return i;
};
}
function DynXY_Curve( dyn) {
this.dyn = dyn;
this.dyn_type1 = DynC.mDynType1_XY_Curve;
this.dyn_type2 = 0;
this.action_type1 = 0;
this.action_type2 = 0;
this.prio = DynC.eDynPrio_XY_Curve;
this.instance_mask = 0;
this.instance = 0;
this.firstScan = true;
this.x_a = null;
this.y_a = null;
this.y_minvalue_a = null;
this.y_maxvalue_a = null;
this.x_minvalue_a = null;
this.x_maxvalue_a = null;
this.noofpoints_a = null;
this.update_a = null;
this.x_mark1_a = null;
this.x_mark2_a = null;
this.y_mark1_a = null;
this.y_mark2_a = null;
this.dstrend_object1 = null;
this.dstrend_object2 = null;
this.y_minvalue_attr;
this.y_maxvalue_attr;
this.x_minvalue_attr;
this.x_maxvalue_attr;
this.noofpoints_attr;
this.update_attr;
this.hold_attr;
this.x_mark1_attr = null;
this.x_mark2_attr = null;
this.y_mark1_attr = null;
this.y_mark2_attr = null;
this.mark1_color = Glow.eDrawType_Inherit;
this.mark2_color = Glow.eDrawType_Inherit;
this.y_min_value;
this.y_max_value;
this.x_min_value;
this.x_max_value;
this.horizontal_padding;
this.datatype;
this.curve_color = Glow.eDrawType_Inherit;
this.fill_color = Glow.eDrawType_Inherit;
this.noofpoints;
this.noOfPoints;
this.xAttrType;
this.yAttrType;
this.curveX = [];
this.curveY = [];
this.curve_number;
this.object;
var self = this;
this.open = function( lines, row) {
var end = false;
var i;
var elem;
for ( i = row; i < lines.length; i++) {
var tokens = lines[i].split(' ');
var key = parseInt(tokens[0], 10);
if ( this.dyn.debug) console.log( "DynXYCurve : " + lines[i]);
elem = null;
switch ( key) {
case DynC.eSave_XY_Curve:
break;
case DynC.eSave_XY_Curve_x_attr:
if ( tokens.length > 1)
this.x_attr = tokens[1];
break;
case DynC.eSave_XY_Curve_y_attr:
if ( tokens.length > 1)
this.y_attr = tokens[1];
break;
case DynC.eSave_XY_Curve_y_minvalue_attr:
if ( tokens.length > 1)
this.y_minvalue_attr = tokens[1];
break;
case DynC.eSave_XY_Curve_y_maxvalue_attr:
if ( tokens.length > 1)
this.y_maxvalue_attr = tokens[1];
break;
case DynC.eSave_XY_Curve_x_minvalue_attr:
if ( tokens.length > 1)
this.x_minvalue_attr = tokens[1];
break;
case DynC.eSave_XY_Curve_x_maxvalue_attr:
if ( tokens.length > 1)
this.x_maxvalue_attr = tokens[1];
break;
case DynC.eSave_XY_Curve_noofpoints_attr:
if ( tokens.length > 1)
this.noofpoints_attr = tokens[1];
break;
case DynC.eSave_XY_Curve_update_attr:
if ( tokens.length > 1)
this.update_attr = tokens[1];
break;
case DynC.eSave_XY_Curve_hold_attr:
if ( tokens.length > 1)
this.hold_attr = tokens[1];
break;
case DynC.eSave_XY_Curve_y_min_value:
this.y_min_value = parseFloat( tokens[1]);;
break;
case DynC.eSave_XY_Curve_y_max_value:
this.y_max_value = parseFloat( tokens[1]);;
break;
case DynC.eSave_XY_Curve_x_min_value:
this.x_min_value = parseFloat( tokens[1]);;
break;
case DynC.eSave_XY_Curve_x_max_value:
this.x_max_value = parseFloat( tokens[1]);;
break;
case DynC.eSave_XY_Curve_datatype:
this.datatype = parseInt( tokens[1], 10);
break;
case DynC.eSave_XY_Curve_instance:
this.instance = parseInt(tokens[1], 10);
break;
case DynC.eSave_XY_Curve_instance_mask:
this.instance_mask = parseInt( tokens[1], 10);
break;
case DynC.eSave_XY_Curve_curve_color:
this.curve_color = parseInt( tokens[1], 10);
break;
case DynC.eSave_XY_Curve_fill_color:
this.fill_color = parseInt( tokens[1], 10);
break;
case DynC.eSave_XY_Curve_horizontal_padding:
this.horizontal_padding = parseInt( tokens[1], 10);
break;
case DynC.eSave_XY_Curve_x_mark1_attr:
if ( tokens.length > 1)
this.x_mark1_attr = tokens[1];
break;
case DynC.eSave_XY_Curve_x_mark2_attr:
if ( tokens.length > 1)
this.x_mark2_attr = tokens[1];
break;
case DynC.eSave_XY_Curve_y_mark1_attr:
if ( tokens.length > 1)
this.y_mark1_attr = tokens[1];
break;
case DynC.eSave_XY_Curve_y_mark2_attr:
if ( tokens.length > 1)
this.y_mark2_attr = tokens[1];
break;
case DynC.eSave_XY_Curve_mark1_color:
this.mark1_color = parseInt( tokens[1], 10);
break;
case DynC.eSave_XY_Curve_mark2_color:
this.mark2_color = parseInt( tokens[1], 10);
break;
case DynC.eSave_End:
end = true;
break;
default:
console.log( "Syntax error in DynXYCurve");
break;
}
if ( end)
break;
}
return i;
};
this.connect = function( object) {
if ( this.x_attr == null || this.y_attr == null)
return 1;
if ( this.update_attr.trim() !== "") {
this.update_a = new DynReference( this.dyn, this.update_attr);
this.update_a.connect(this.dyn);
if ( !this.update_a.sts) {
console.log( "XYCurve: " + this.update_attr);
this.update_a = null;
}
}
if ( this.noofpoints_attr.trim() !== "") {
this.noofpoints_a = new DynReference( this.dyn, this.noofpoints_attr);
this.noofpoints_a.connect(this.dyn);
if ( !this.noofpoints_a.sts) {
console.log( "XYCurve: " + this.noofpoints_attr);
this.noofpoints_a = null;
}
}
if ( this.y_minvalue_attr.trim() !== "") {
this.y_minvalue_a = new DynReference( this.dyn, this.y_minvalue_attr);
this.y_minvalue_a.connect(this.dyn);
if ( !this.y_minvalue_a.sts) {
console.log( "XYCurve: " + this.y_minvalue_attr);
this.y_minvalue_a = null;
}
}
if ( this.y_maxvalue_attr.trim() !== "") {
this.y_maxvalue_a = new DynReference( this.dyn, this.y_maxvalue_attr);
this.y_maxvalue_a.connect(this.dyn);
if ( !this.y_maxvalue_a.sts) {
console.log( "XYCurve: " + this.y_maxvalue_attr);
this.y_maxvalue_a = null;
}
}
if ( this.x_minvalue_attr.trim() !== "") {
this.x_minvalue_a = new DynReference( this.dyn, this.x_minvalue_attr);
this.x_minvalue_a.connect(this.dyn);
if ( !this.x_minvalue_a.sts) {
console.log( "XYCurve: " + this.x_minvalue_attr);
this.x_minvalue_a = null;
}
}
if ( this.x_maxvalue_attr.trim() !== "") {
this.x_maxvalue_a = new DynReference( this.dyn, this.x_maxvalue_attr);
this.x_maxvalue_a.connect(this.dyn);
if ( !this.x_maxvalue_a.sts) {
console.log( "XYCurve: " + this.x_maxvalue_attr);
this.x_maxvalue_a = null;
}
}
if ( this.y_mark1_attr.trim() !== "") {
this.y_mark1_a = new DynReference( this.dyn, this.y_mark1_attr);
this.y_mark1_a.connect(this.dyn);
if ( !this.y_mark1_a.sts) {
console.log( "XYCurve: " + this.y_mark1_attr);
this.y_mark1_a = null;
}
}
if ( this.y_mark2_attr.trim() !== "") {
this.y_mark2_a = new DynReference( this.dyn, this.y_mark2_attr);
this.y_mark2_a.connect(this.dyn);
if ( !this.y_mark2_a.sts) {
console.log( "XYCurve: " + this.y_mark2_attr);
this.y_mark2_a = null;
}
}
// Get curve number
this.curve_number = 0;
var m = this.instance;
while( m != 0) {
m = m >> 1;
this.curve_number++;
}
// Get number of curves
if ( this.instance == DynC.mInstance_1) {
m = this.instance_mask;
var noofcurves = 0;
while( m != 0) {
m = m >> 1;
noofcurves++;
}
object.set_xy_noofcurves( noofcurves);
}
this.noofpoints = object.get_no_of_points();
if ( Math.abs(this.y_max_value - this.y_min_value) > Number.MIN_VALUE)
object.set_xy_range_y( this.curve_number - 1, this.y_min_value, this.y_max_value);
if ( Math.abs(this.x_max_value - this.x_min_value) > Number.MIN_VALUE)
object.set_xy_range_x( this.curve_number - 1, this.x_min_value, this.x_max_value);
//object.set_xy_curve_color( this.curve_number - 1, this.curve_color, this.fill_color);
if ( this.mark1_color != Glow.eDrawType_Inherit || this.mark2_color != Glow.eDrawType_Inherit)
object.set_mark_color( this.mark1_color, this.mark2_color);
return 1;
};
this.disconnect = function() {
if ( this.update_a !== null)
this.update_a.disconnect(this.dyn);
if ( this.noofpoints_a !== null)
this.noofpoints_a.disconnect(this.dyn);
if ( this.y_minvalue_a !== null)
this.y_minvalue_a.disconnect(this.dyn);
if ( this.y_maxvalue_a !== null)
this.y_maxvalue_a.disconnect(this.dyn);
if ( this.x_minvalue_a !== null)
this.x_minvalue_a.disconnect(this.dyn);
if ( this.x_maxvalue_a !== null)
this.x_maxvalue_a.disconnect(this.dyn);
if ( this.x_mark1_a !== null)
this.x_mark1_a.disconnect(this.dyn);
if ( this.x_mark2_a !== null)
this.x_mark2_a.disconnect(this.dyn);
if ( this.y_mark1_a !== null)
this.y_mark1_a.disconnect(this.dyn);
if ( this.y_mark2_a !== null)
this.y_mark2_a.disconnect(this.dyn);
};
this.scan = function( object) {
var pname;
var attrSize;
var update = false;
var size = 1;
this.object = object;
this.noOfPoints = this.noofpoints;
if ( this.x_attr == null || this.y_attr == null)
return;
if ( this.firstScan)
update = true;
if ( this.update_a !== null) {
var value = this.update_a.get_ref_value(this.dyn);
if ( value && !this.update_a.oldValue)
update = true;
this.update_a.oldValue = value;
}
if ( this.noofpoints_a !== null) {
var value = this.noofpoints_a.get_ref_value(this.dyn);
if ( value != this.noofpoints_a.oldValue) {
update = true;
this.noofpoints = this.noOfPoints = value;
this.noofpoints_a.oldValue = value;
}
}
if ( this.y_minvalue_a !== null) {
var value = this.y_minvalue_a.get_ref_value(this.dyn);
if ( value != this.y_min_value) {
this.y_min_value = value;
if ( Math.abs(this.y_max_value - this.y_min_value) > Number.MIN_VALUE)
object.set_xy_range_y( this.curve_number - 1, this.y_min_value, this.y_max_value);
update = true;
}
}
if ( this.y_maxvalue_a !== null) {
var value = this.y_maxvalue_a.get_ref_value(this.dyn);
if ( value != this.y_max_value) {
this.y_max_value = value;
if ( Math.abs(this.y_max_value - this.y_min_value) > Number.MIN_VALUE)
object.set_xy_range_y( this.curve_number - 1, this.y_min_value, this.y_max_value);
update = true;
}
}
if ( this.x_minvalue_a !== null) {
var value = this.x_minvalue_a.get_ref_value(this.dyn);
if ( value != this.x_min_value) {
this.x_min_value = value;
if ( Math.abs(x_max_value - this.x_min_value) > Number.MIN_VALUE)
object.set_xy_range_x( this.curve_number - 1, this.x_min_value, this.x_max_value);
update = true;
}
}
if ( this.x_maxvalue_a !== null) {
var value = this.x_maxvalue_a.get_ref_value(this.dyn);
if ( value != this.x_max_value) {
this.x_max_value = value;
if ( Math.abs(x_max_value - this.x_min_value) > Number.MIN_VALUE)
object.set_xy_range_x( this.curve_number - 1, this.x_min_value, this.x_max_value);
update = true;
}
}
if ( this.x_mark1_a !== null) {
var mark1val = this.x_mark1_a.get_ref_value(this.dyn);
if ( this.firstScan || Math.abs( mark1val - this.x_mark1_a.oldValue) > Number.MIN_VALUE) {
object.set_x_mark1( mark1val);
this.x_mark1_a.oldValue = mark1val;
}
}
if ( this.x_mark2_a !== null) {
var mark2val = this.x_mark2_a.get_ref_value(this.dyn);
if ( this.firstScan || Math.abs( mark2val - this.x_mark2_a.oldValue) > Number.MIN_VALUE) {
object.set_x_mark2( mark2val);
this.x_mark2_a.oldValue = mark2val;
}
}
if ( this.y_mark1_a !== null) {
var mark1val = this.y_mark1_a.get_ref_value(this.dyn);
if ( this.firstScan || Math.abs( mark1val - this.y_mark1_a.oldValue) > Number.MIN_VALUE) {
object.set_y_mark1( mark1val);
this.y_mark1_a.oldValue = mark1val;
}
}
if ( this.y_mark2_a !== null) {
var mark2val = this.y_mark2_a.get_ref_value(this.dyn);
if ( this.firstScan || Math.abs( mark2val - this.y_mark2_a.oldValue) > Number.MIN_VALUE) {
object.set_y_mark2( mark2val);
this.y_mark2_a.oldValue = mark2val;
}
}
if ( update) {
pname = this.dyn.parseAttrName( this.x_attr);
attrSize = pname.elements;
this.xAttrType = pname.type;
switch ( this.datatype) {
case DynC.eCurveDataType_XYArrays:
if ( attrSize < this.noOfPoints)
this.noOfPoints = attrSize;
size = this.noOfPoints;
break;
case DynC.eCurveDataType_PointArray:
if ( attrSize/2 < this.noOfPoints)
this.noOfPoints = attrSize/2;
size = this.noOfPoints * 2;
break;
case DynC.eCurveDataType_TableObject:
if ( (attrSize-1)/2 < this.noOfPoints)
this.noOfPoints = (attrSize-1)/2;
size = this.noOfPoints * 2 + 1;
break;
}
// Read x-array
switch ( this.xAttrType) {
case Pwr.eType_Float32:
this.dyn.graph.getGdh().getObjectInfoFloatArray( pname.name, size,
this.scan2, this);
break;
case Pwr.eType_Int32:
case Pwr.eType_Int16:
case Pwr.eType_Int8:
case Pwr.eType_UInt32:
case Pwr.eType_UInt16:
case Pwr.eType_UInt8:
this.dyn.graph.getGdh().getObjectInfoIntArray( pname.name, size,
this.scan2, this);
break;
default:
return;
}
}
this.firstScan = false;
};
this.scan2 = function( id, self, sts, value) {
switch ( self.xAttrType) {
case Pwr.eType_Float32:
if ( !(sts & 1))
return;
switch ( self.datatype) {
case DynC.eCurveDataType_XYArrays:
self.curveX = new Array(self.noOfPoints);
for ( var i = 0; i < self.noOfPoints; i++)
self.curveX[i] = value[i];
break;
case DynC.eCurveDataType_PointArray:
curveX = new Array(self.noOfPoints);
curveY = new Array(self.noOfPoints);
for ( var i = 0; i < self.noOfPoints; i++) {
self.curveX[i] = value[2*i];
self.curveY[i] = value[2*i+1];
}
self.dyn.repaintNow = true;
break;
case DynC.eCurveDataType_TableObject:
self.noOfPoints = Math.floor(value[0]);
if ( self.noOfPoints > self.noofpoints)
self.noOfPoints = self.noofpoints;
if ( attrSize < self.noOfPoints)
self.noOfPoints = attrSize;
self.curveY = new Array(self.noOfPoints);
self.curveX = new Array(self.noOfPoints);
for ( var i = 0; i < self.noOfPoints; i++) {
self.curveX[i] = value[2*i+1];
self.curveY[i] = value[2*i+2];
}
self.dyn.repaintNow = true;
break;
......@@ -5984,75 +6764,592 @@ function DynXY_Curve( dyn) {
self.dyn.repaintNow = true;
break;
}
break;
default:
break;
default:
return;
}
// Read y-array
switch ( self.datatype) {
case DynC.eCurveDataType_XYArrays:
var pname = self.dyn.parseAttrName( self.y_attr);
if ( pname.elements < self.noOfPoints)
self.noOfPoints = pname.elements;
self.yAttrType = pname.type;
self.curveY = new Array(self.noOfPoints);
switch ( self.yAttrType) {
case Pwr.eType_Float32:
self.dyn.graph.getGdh().getObjectInfoFloatArray( pname.name, self.noOfPoints,
self.scan3, self);
break;
case Pwr.eType_Int32:
case Pwr.eType_Int16:
case Pwr.eType_Int8:
case Pwr.eType_UInt32:
case Pwr.eType_UInt16:
case Pwr.eType_UInt8:
self.dyn.graph.getGdh().getObjectInfoIntArray( pname.name, self.noOfPoints,
self.scan3, self);
break;
default:
return;
}
break;
}
};
this.scan3 = function( id, self, sts, value) {
if ( !(sts & 1))
return;
switch ( self.datatype) {
case DynC.eCurveDataType_XYArrays:
switch ( self.yAttrType) {
case Pwr.eType_Float32:
for ( var i = 0; i < self.noOfPoints; i++)
self.curveY[i] = value[i];
self.dyn.repaintNow = true;
break;
case Pwr.eType_Int32:
case Pwr.eType_Int16:
case Pwr.eType_Int8:
case Pwr.eType_UInt32:
case Pwr.eType_UInt16:
case Pwr.eType_UInt8:
for ( var i = 0; i < self.noOfPoints; i++)
self.curveY[i] = value[i];
self.dyn.repaintNow = true;
break;
default:
return;
}
break;
}
self.object.set_xy_data( self.curveY, self.curveX, self.curve_number - 1, self.noOfPoints);
};
};
function DynSevHist( dyn) {
this.dyn = dyn;
this.dyn_type1 = 0;
this.dyn_type2 = DynC.mDynType2_SevHist;
this.action_type1 = 0;
this.action_type2 = 0;
this.prio = DynC.eDynPrio_SevHist;
this.instance_mask = 0;
this.instance = 0;
this.direction;
this.timerange = 0;
this.updatetime = 1;
this.timerange_a = null;
this.minvalue_a1 = null;
this.maxvalue_a1 = null;
this.minvalue_a2 = null;
this.maxvalue_a2 = null;
this.hold_a = null;
this.update_a = null;
this.mark1_a = null;
this.mark2_a = null;
this.sevhist_object1 = null;
this.sevhist_object2 = null;
this.attribute1 = null;
this.attribute2 = null;
this.timerange_attr = null;
this.minvalue_attr1 = null;
this.maxvalue_attr1 = null;
this.minvalue_attr2 = null;
this.maxvalue_attr2 = null;
this.hold_attr = null;
this.update_attr = null;
this.mark1_attr = null;
this.mark2_attr = null;
this.mark1_color;
this.mark2_color;
this.firstScan = true;
this.scan_time;
this.acc_time;
this.no_of_points;
this.trend_hold;
this.orig_graph_scan_time;
this.orig_graph_fast_scan_time;
this.orig_graph_animation_scan_time;
this.buff_cnt = 0;
this.initialized = 0;
this.has_sevhist_object = 0;
this.no_of_points;
this.oid1 = new PwrtObjid(0,0);
this.oid2 = new PwrtObjid(0,0);
this.curve_cnt = 0;
this.vtype1;
this.vtype2;
this.connect = function( object) {
this.no_of_points = object.get_no_of_points();
this.direction = object.get_direction();
this.scan_time = object.get_scan_time();
this.acc_time = this.scan_time;
this.trend_hold = 0;
if ( this.minvalue_attr1.trim() !== "") {
this.minvalue_a1 = new DynReference( this.dyn, this.minvalue_attr1);
this.minvalue_a1.connect(this.dyn);
if ( !this.minvalue_a1.sts) {
this.minvalue_a1 = null;
console.log("SevHist: " + this.minvalue_attr1);
}
}
if ( this.maxvalue_attr1.trim() !== "") {
this.maxvalue_a1 = new DynReference( this.dyn, this.maxvalue_attr1);
this.maxvalue_a1.connect(this.dyn);
if ( !this.maxvalue_a1.sts) {
this.maxvalue_a1 = null;
console.log("SevHist: " + this.maxvalue_attr1);
}
}
if ( this.minvalue_attr2.trim() !== "") {
this.minvalue_a2 = new DynReference( this.dyn, this.minvalue_attr2);
this.minvalue_a2.connect(this.dyn);
if ( !this.minvalue_a2.sts) {
this.minvalue_a2 = null;
console.log("SevHist: " + this.minvalue_attr2);
}
}
if ( this.maxvalue_attr2.trim() !== "") {
this.maxvalue_a2 = new DynReference( this.dyn, this.maxvalue_attr2);
this.maxvalue_a2.connect(this.dyn);
if ( !this.maxvalue_a2.sts) {
this.maxvalue_a2 = null;
console.log("SevHist: " + this.maxvalue_attr2);
}
}
if ( this.hold_attr.trim() !== "") {
this.hold_a = new DynReference( this.dyn, this.hold_attr);
this.hold_a.connect(this.dyn);
if ( !this.hold_a.sts) {
this.hold_a = null;
console.log("SevHist: " + this.hold_attr);
}
}
if ( this.update_attr.trim() !== "") {
this.update_a = new DynReference( this.dyn, this.update_attr);
this.update_a.connect(this.dyn);
if ( !this.update_a.sts) {
this.update_a = null;
console.log("SevHist: " + this.update_attr);
}
}
if ( this.mark1_attr !== null && this.mark1_attr.trim() !== "") {
this.mark1_a = new DynReference( this.dyn, this.mark1_attr);
this.mark1_a.connect(this.dyn);
if ( !this.mark1_a.sts) {
this.mark1_a = null;
console.log("SevHist: " + this.mark1_attr);
}
}
if ( this.mark2_attr !== null && this.mark2_attr.trim() !== "") {
this.mark2_a = new DynReference( this.dyn, this.mark2_attr);
this.mark2_a.connect(this.dyn);
if ( !this.mark2_a.sts) {
this.mark2_a = null;
console.log("SevHist: " + this.mark2_attr);
}
}
if ( this.timerange_attr !== null && this.timerange_attr.trim() !== "") {
this.timerange_a = new DynReference( this.dyn, this.timerange_attr);
this.timerange_a.connect(this.dyn);
if ( !this.timerange_a.sts) {
this.timerange_a = null;
console.log("SevHist: " + this.timerange_attr);
}
}
this.no_of_points = object.get_no_of_points();
if ( this.mark1_color != Glow.eDrawType_Inherit || this.mark2_color != Glow.eDrawType_Inherit)
object.set_mark_color( this.mark1_color, this.mark2_color);
if (this.timerange > Number.MIN_VALUE) {
object.set_xy_range_x(0, this.timerange, 0);
object.set_xy_range_x(1, this.timerange, 0);
}
if (this.sevhist_object1 !== "")
this.dyn.graph.getGdh().getSevHistInfo(this.sevhist_object1,
this.connect2, this);
else if (this.attribute1 !== "") {
this.curve_cnt++;
if (this.attribute2 !== "")
this.curve_cnt++;
this.initialized = 1;
}
};
this.connect2 = function( id, data, sts, result) {
console.log("connect2", sts);
if ( sts & 1 != 0) {
var self = data;
self.oid1 = result[0];
self.attribute1 = result[1];
self.server = result[2];
self.has_sevhist_object;
self.curve_cnt++;
if (self.sevhist_object2 !== "")
self.dyn.graph.getGdh().getSevHistInfo(self.sevhist_object2,
self.connect3, self);
else
self.initialized = 1;
}
return 1;
};
this.connect3 = function( id, data, sts, result) {
console.log("connect3", sts);
if ( sts & 1 != 0) {
var self = data;
self.oid2 = result[0];
self.attribute2 = result[1];
self.server = result[2];
self.curve_cnt++;
self.initialized = 1;
}
return 1;
};
this.disconnect = function() {
if ( this.timerange_a != null)
this.timerange_a.disconnect(this.dyn);
if ( this.minvalue_a1 != null)
this.minvalue_a1.disconnect(this.dyn);
if ( this.maxvalue_a1 != null)
this.maxvalue_a1.disconnect(this.dyn);
if ( this.minvalue_a2 != null)
this.minvalue_a2.disconnect(this.dyn);
if ( this.maxvalue_a2 != null)
this.maxvalue_a2.disconnect(this.dyn);
if ( this.hold_a != null)
this.hold_a.disconnect(this.dyn);
if ( this.update_a != null)
this.update_a.disconnect(this.dyn);
if ( this.mark1_a != null)
this.mark1_a.disconnect(this.dyn);
if ( this.mark2_a != null)
this.mark2_a.disconnect(this.dyn);
};
this.scan = function( object) {
var new_curve = 0;
var i;
if ( !this.initialized)
return;
if ( this.hold_a !== null && !this.firstScan) {
var holdval = this.hold_a.get_ref_value(this.dyn);
if ( holdval)
return;
}
// Read y-array
switch ( self.datatype) {
case DynC.eCurveDataType_XYArrays:
var pname = self.dyn.parseAttrName( self.y_attr);
if ( pname.elements < self.noOfPoints)
self.noOfPoints = pname.elements;
self.yAttrType = pname.type;
self.curveY = new Array(self.noOfPoints);
if ( this.update_a !== null) {
var value = this.update_a.get_ref_value(this.dyn);
if ( value && !this.update_a.oldValue)
new_curve = 1;
this.update_a.oldValue = value;
}
switch ( self.yAttrType) {
case Pwr.eType_Float32:
self.dyn.graph.getGdh().getObjectInfoFloatArray( pname.name, self.noOfPoints,
self.scan3, self);
break;
case Pwr.eType_Int32:
case Pwr.eType_Int16:
case Pwr.eType_Int8:
case Pwr.eType_UInt32:
case Pwr.eType_UInt16:
case Pwr.eType_UInt8:
self.dyn.graph.getGdh().getObjectInfoIntArray( pname.name, self.noOfPoints,
self.scan3, self);
if ( this.timerange_a !== null) {
this.timerange = this.timerange_a.get_ref_value(this.dyn);
if ( this.timerange != this.timerange_a.oldValue) {
object.set_xy_range_x(0, this.timerange, 0);
if (this.curve_cnt > 1)
object.set_xy_range_x(1, this.timerange, 0);
this.timerange_a.oldValue = this.timerange;
new_curve = 1;
}
}
var minval, maxval;
if ( this.maxvalue_a1 !== null && this.minvalue_a1 !== null) {
minval = this.minvalue_a1.get_ref_value(this.dyn);
maxval = this.maxvalue_a1.get_ref_value(this.dyn);
if ( minval != this.minvalue_a1.oldValue ||
maxval != this.maxvalue_a1.oldValue) {
if ( Math.abs( maxval - minval) > Number.MIN_VALUE)
object.set_range_y( 0, minval, maxval);
this.minvalue_a1.oldValue = minval;
this.maxvalue_a1.oldValue = maxval;
new_curve = 1;
}
}
if ( this.maxvalue_a2 !== null && this.minvalue_a2 !== null) {
minval = this.minvalue_a2.get_ref_value(this.dyn);
maxval = this.maxvalue_a2.get_ref_value(this.dyn);
if ( minval != this.minvalue_a2.oldValue ||
maxval != this.maxvalue_a2.oldValue) {
if ( Math.abs( maxval - minval) > Number.MIN_VALUE)
object.set_range_y( 1, minval, maxval);
this.minvalue_a2.oldValue = minval;
this.maxvalue_a2.oldValue = maxval;
new_curve = 1;
}
}
if ( this.mark1_a !== null) {
var mark1val = this.mark1_a.get_ref_value(this.dyn);
if ( this.firstScan || Math.abs( mark1val - this.mark1_a.oldValue) > Number.MIN_VALUE) {
object.set_y_mark1( mark1val);
this.mark1_a.oldValue = mark1val;
}
}
if ( this.mark2_a !== null) {
var mark2val = this.mark2_a.get_ref_value(this.dyn);
if ( this.firstScan || Math.abs( mark2val - this.mark2_a.oldValue) > Number.MIN_VALUE) {
object.set_y_mark2( mark2val);
this.mark2_a.oldValue = mark2val;
}
}
if ( this.firstScan) {
this.firstScan = false;
new_curve = 1;
}
if ( this.cycle == Glow.eCycle_Slow)
this.acc_time += this.dyn.graph.getScanTime();
else
this.acc_time += this.dyn.graph.getFastScanTime();
if ( new_curve || this.acc_time + Number.MIN_VALUE >= this.updatetime) {
//if (new_curve) {
this.acc_time = 0;
var data = new Array(2);
data[0] = this;
data[1] = object;
this.dyn.graph.getGdh().getSevHistData(this.timerange, this.no_of_points,
this.server, this.oid1, this.attribute1, this.scan2, data);
}
};
this.scan2 = function( id, data, sts, result) {
if ( sts & 1 != 0) {
var self = data[0];
var object = data[1];
self.vtype1 = result[0];
var size = result[1];
var tbuf = result[2];
var vbuf = result[3];
if (self.direction == Glow.eHorizDirection_Right) {
for (var k = 0; k < tbuf.length; k++)
tbuf[k] = self.timerange - tbuf[k];
}
var tdata;
var vdata;
var points;
switch (self.vtype1) {
case Pwr.eType_Boolean:
points = 0;
size = 2*tbuf.length;
tdata = new Array(size);
vdata = new Array(size);
for (var k = 0; k < tbuf.length; k++) {
if (k == 0) {
vdata[points] = vbuf[k];
tdata[points++] = tbuf[k];
}
else if (vbuf[k] != vbuf[k-1]) {
vdata[points] = vbuf[k-1];
tdata[points++] = tbuf[k];
vdata[points] = vbuf[k];
tdata[points++] = tbuf[k];
}
else if (k == tbuf.lenght - 1) {
vdata[points] = vbuf[k];
tdata[points++] = tbuf[k];
}
}
break;
default:
return;
points = size;
tdata = tbuf;
vdata = vbuf;
}
break;
object.set_xy_data(vdata, tdata, 0, points);
}
if (self.curve_cnt > 1) {
var data2 = new Array(2);
data2[0] = self;
data2[1] = object;
self.dyn.graph.getGdh().getSevHistData(self.timerange, self.no_of_points,
self.server, self.oid2, self.attribute2, self.scan3, data2);
}
};
this.scan3 = function( id, data, sts, result) {
if ( sts & 1 != 0) {
var self = data[0];
var object = data[1];
self.vtype2 = result[0];
var size = result[1];
var tbuf = result[2];
var vbuf = result[3];
//console.log("scan3", self.curve_cnt, size, self.vtype2);
if (self.direction == Glow.eHorizDirection_Right) {
for (var k = 0; k < tbuf.length; k++)
tbuf[k] = self.timerange - tbuf[k];
}
var tdata;
var vdata;
var points;
switch (self.vtype1) {
case Pwr.eType_Boolean:
points = 0;
size = 2*tbuf.length;
tdata = new Array(size);
vdata = new Array(size);
for (var k = 0; k < tbuf.length; k++) {
if (k == 0) {
vdata[points] = vbuf[k];
tdata[points++] = tbuf[k];
}
else if (vbuf[k] != vbuf[k-1]) {
vdata[points] = vbuf[k-1];
tdata[points++] = tbuf[k];
vdata[points] = vbuf[k];
tdata[points++] = tbuf[k];
}
else if (k == tbuf.lenght - 1) {
vdata[points] = vbuf[k];
tdata[points++] = tbuf[k];
}
}
break;
default:
points = size;
tdata = tbuf;
vdata = vbuf;
}
object.set_xy_data(vdata, tdata, 1, points);
}
};
this.scan3 = function( id, self, sts, value) {
if ( !(sts & 1))
return;
this.action = function( object, e) {
return 1;
};
switch ( self.datatype) {
case DynC.eCurveDataType_XYArrays:
switch ( self.yAttrType) {
case Pwr.eType_Float32:
for ( var i = 0; i < self.noOfPoints; i++)
self.curveY[i] = value[i];
self.dyn.repaintNow = true;
this.open = function( lines, row) {
var end = false;
var i;
var elem;
for ( i = row; i < lines.length; i++) {
var tokens = lines[i].split(' ');
var key = parseInt(tokens[0], 10);
if ( this.dyn.debug) console.log( "DynSevHist : " + lines[i]);
elem = null;
switch ( key) {
case DynC.eSave_SevHist:
break;
case Pwr.eType_Int32:
case Pwr.eType_Int16:
case Pwr.eType_Int8:
case Pwr.eType_UInt32:
case Pwr.eType_UInt16:
case Pwr.eType_UInt8:
for ( var i = 0; i < self.noOfPoints; i++)
self.curveY[i] = value[i];
self.dyn.repaintNow = true;
case DynC.eSave_SevHist_sevhist_object1:
if ( tokens.length > 1)
this.sevhist_object1 = tokens[1];
break;
case DynC.eSave_SevHist_sevhist_object2:
if ( tokens.length > 1)
this.sevhist_object2 = tokens[1];
break;
case DynC.eSave_SevHist_attribute1:
if ( tokens.length > 1)
this.attribute1 = tokens[1];
break;
case DynC.eSave_SevHist_attribute2:
if ( tokens.length > 1)
this.attribute2 = tokens[1];
break;
case DynC.eSave_SevHist_server:
if ( tokens.length > 1)
this.server = tokens[1];
break;
case DynC.eSave_SevHist_timerange:
this.timerange = parseFloat( tokens[1]);
break;
case DynC.eSave_SevHist_updatetime:
this.updatetime = parseFloat( tokens[1]);
break;
case DynC.eSave_SevHist_timerange_attr:
if ( tokens.length > 1)
this.timerange_attr = tokens[1];
break;
case DynC.eSave_SevHist_minvalue_attr1:
if ( tokens.length > 1)
this.minvalue_attr1 = tokens[1];
break;
case DynC.eSave_SevHist_maxvalue_attr1:
if ( tokens.length > 1)
this.maxvalue_attr1 = tokens[1];
break;
case DynC.eSave_SevHist_minvalue_attr2:
if ( tokens.length > 1)
this.minvalue_attr2 = tokens[1];
break;
case DynC.eSave_SevHist_maxvalue_attr2:
if ( tokens.length > 1)
this.maxvalue_attr2 = tokens[1];
break;
case DynC.eSave_SevHist_hold_attr:
if ( tokens.length > 1)
this.hold_attr = tokens[1];
break;
case DynC.eSave_SevHist_update_attr:
if ( tokens.length > 1)
this.update_attr = tokens[1];
break;
case DynC.eSave_SevHist_mark1_attr:
if ( tokens.length > 1)
this.mark1_attr = tokens[1];
break;
case DynC.eSave_SevHist_mark2_attr:
if ( tokens.length > 1)
this.mark2_attr = tokens[1];
break;
case DynC.eSave_SevHist_mark1_color:
this.mark1_color = parseInt(tokens[1], 10);
break;
case DynC.eSave_SevHist_mark2_color:
this.mark2_color = parseInt(tokens[1], 10);
break;
case DynC.eSave_End:
end = true;
break;
default:
return;
console.log( "Syntax error in DynSevHist", row, key);
break;
}
break;
}
self.object.set_xy_data( self.curveY, self.curveX, self.curve_number - 1, self.noOfPoints);
if ( end)
break;
}
return i;
};
};
}
function DynPie( dyn) {
this.dyn = dyn;
......
......@@ -1417,7 +1417,6 @@ int sev_dbms::write_value(pwr_tStatus* sts, int item_idx, int attr_idx,
}
break;
case pwr_eType_UInt32:
case pwr_eType_Boolean:
if ((feqf(m_items[item_idx].deadband, 0.0f)
&& !memcmp(
buf, m_items[item_idx].old_value, sizeof(pwr_tUInt32)))
......@@ -1430,6 +1429,14 @@ int sev_dbms::write_value(pwr_tStatus* sts, int item_idx, int attr_idx,
*(pwr_tUInt32*)m_items[item_idx].old_value = *(pwr_tUInt32*)buf;
}
break;
case pwr_eType_Boolean:
if (*(pwr_tBoolean*)buf == *(pwr_tBoolean*)m_items[item_idx].old_value) {
return 1;
} else {
m_items[item_idx].deadband_active = 0;
*(pwr_tBoolean*)m_items[item_idx].old_value = *(pwr_tBoolean*)buf;
}
break;
case pwr_eType_UInt16:
if ((feqf(m_items[item_idx].deadband, 0.0f)
&& !memcmp(
......
......@@ -440,7 +440,14 @@ pwr_tStatus cbuf_UpdateCircBuffInfo(cbuf_sCircBuffInfo* info, int infosize)
first_index = info[j].last_idx;
last_index = hp->LastIndex;
start_idx = last_index - info[j].samples;
if (first_index < last_index) {
if (first_index == last_index) {
info[j].last_idx = last_index;
info[j].first_idx = first_index;
info[j].offset = 0;
info[j].size = 0;
break;
}
else if (first_index < last_index) {
if (first_index > start_idx)
start_idx = first_index;
} else {
......
......@@ -287,6 +287,7 @@ palette NavigatorPalette
class SysMonConfig
class WebHandler
class WebBrowserConfig
class WebSocketServer
}
menu IO
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment