Commit 1cf27b3c authored by Claes's avatar Claes Committed by Esteban Blanc

Ge dynamics for DsTrend, DsTrendCurve and SevHist added

parent 164ea502
......@@ -1105,28 +1105,33 @@ void* sev_server::send_histdata_thread(void* arg)
starttime = net_NetTimeToTime(&rmsg->StartTime);
endtime = net_NetTimeToTime(&rmsg->EndTime);
sev->m_db->get_item_idx(&sts, &item_idx, rmsg->Oid, rmsg->AName);
if (EVEN(sts)) {
qcom_Free(&lsts, rmsg);
return (void*)1;
}
if (cdh_ObjidIsNull(rmsg->Oid))
sev->m_db->get_item_idx_by_name(&sts, &item_idx, rmsg->AName);
else
sev->m_db->get_item_idx(&sts, &item_idx, rmsg->Oid, rmsg->AName);
if (sev->m_read_threads)
thread = sev->m_db->new_thread();
if (ODD(sts)) {
if (sev->m_read_threads)
thread = sev->m_db->new_thread();
sev->m_db->get_values(&sts, thread, rmsg->Oid,
sev->m_db->m_items[item_idx].options,
sev->m_db->m_items[item_idx].deadband, rmsg->AName,
sev->m_db->m_items[item_idx].attr[0].type,
sev->m_db->m_items[item_idx].attr[0].size,
sev->m_db->m_items[item_idx].scantime,
&sev->m_db->m_items[item_idx].creatime, &starttime, &endtime,
rmsg->NumPoints, &tbuf, &vbuf, &rows);
if (ODD(sts) && rows != 0)
msize
= rows * (sizeof(pwr_tTime) + sev->m_db->m_items[item_idx].attr[0].size)
+ sizeof(*msg) - sizeof(msg->Data);
else
sev->m_db->get_values(&sts, thread,
sev->m_db->m_items[item_idx].oid,
sev->m_db->m_items[item_idx].options,
sev->m_db->m_items[item_idx].deadband,
sev->m_db->m_items[item_idx].attr[0].aname,
sev->m_db->m_items[item_idx].attr[0].type,
sev->m_db->m_items[item_idx].attr[0].size,
sev->m_db->m_items[item_idx].scantime,
&sev->m_db->m_items[item_idx].creatime, &starttime, &endtime,
rmsg->NumPoints, &tbuf, &vbuf, &rows);
if (ODD(sts) && rows != 0)
msize
= rows * (sizeof(pwr_tTime) + sev->m_db->m_items[item_idx].attr[0].size)
+ sizeof(*msg) - sizeof(msg->Data);
else
msize = sizeof(*msg);
}
else
msize = sizeof(*msg);
put.reply.nid = sev->m_nodes[0].nid;
......
......@@ -383,3 +383,29 @@ void sev_db::get_item_idx(
}
*sts = SEV__NOSUCHITEM;
}
void sev_db::get_item_idx_by_name(
pwr_tStatus* sts, unsigned int* item_idx, char* name)
{
pwr_tAName aname;
char *s;
strncpy(aname, name, sizeof(aname));
s = strchr(aname, '.');
if (s == 0) {
*sts = SEV__NOSUCHITEM;
return;
}
*s = 0;
s++;
for (unsigned int i = 0; i < m_items.size(); i++) {
if ((str_NoCaseStrcmp(aname, m_items[i].oname) == 0)
&& (str_NoCaseStrcmp(s, m_items[i].attr[0].aname) == 0)) {
*item_idx = i;
*sts = SEV__SUCCESS;
return;
}
}
*sts = SEV__NOSUCHITEM;
}
......@@ -175,6 +175,7 @@ public:
pwr_tStatus tree_update_value(int item_idx, int attr_idx, pwr_tTime time, void* buf);
void get_item_idx(pwr_tStatus* sts, unsigned int* item_idx, pwr_tOid oid,
char* attributename);
void get_item_idx_by_name(pwr_tStatus* sts, unsigned int* item_idx, char* name);
static void set_orignode(char *node) {strncpy(m_orignode, node, sizeof(m_orignode));}
static void get_orignode(char *node) {strcpy(node, m_orignode);}
......
......@@ -44,6 +44,8 @@
#include "rt_sevcli.h"
#include "rt_sev_net.h"
static sevcli_tCtx stored_ctx = 0;
/**
* @brief Initialization of the client. Creates a context and opens a Qcom queue
* for
......@@ -83,6 +85,8 @@ int sevcli_close(pwr_tStatus* sts, sevcli_tCtx ctx)
if (!qcom_DeleteQ(sts, &ctx->qid)) {
return 0;
}
if (ctx == stored_ctx)
stored_ctx = 0;
free(ctx);
*sts = SEV__SUCCESS;
return 1;
......@@ -865,3 +869,19 @@ int sevcli_get_events(pwr_tStatus* sts, sevcli_tCtx ctx, pwr_tOid oid,
return 1;
}
/**
* @brief Store context.
*/
void sevcli_store_ctx(sevcli_tCtx ctx)
{
stored_ctx = ctx;
}
/**
* @brief Get stored context.
*/
sevcli_tCtx sevcli_get_stored_ctx()
{
return stored_ctx;
}
......@@ -130,7 +130,8 @@ int sevcli_get_events(pwr_tStatus* sts, sevcli_tCtx ctx, pwr_tOid oid,
pwr_tTime starttime, pwr_tTime endtime, pwr_tUInt32 eventtypemask,
pwr_tUInt32 eventpriomask, pwr_tString80 eventtext, pwr_tOName eventname,
unsigned int maxevents, sevcli_sEvents **list, unsigned int* cnt);
void sevcli_store_ctx(sevcli_tCtx ctx);
sevcli_tCtx sevcli_get_stored_ctx();
/** @} */
#ifdef __cplusplus
......
......@@ -990,6 +990,10 @@ static attrnav_sEnumElement elem_direction[]
{ (unsigned int)glow_eDirection_Up, "Down" },
{ (unsigned int)glow_eDirection_Down, "Up" }, { 0, "" } };
static attrnav_sEnumElement elem_horizdirection[]
= { { (unsigned int)glow_eHorizDirection_Left, "Left" },
{ (unsigned int)glow_eHorizDirection_Right, "Right" }, { 0, "" } };
static attrnav_sEnumElement elem_adjustment[]
= { { (unsigned int)glow_eAdjustment_Center, "Center" },
{ (unsigned int)glow_eAdjustment_Right, "Right" },
......@@ -1146,6 +1150,8 @@ static attrnav_sEnumElement elem_keyboard_type[] = {
static attrnav_sEnum enum_types[] = {
{ (unsigned int)glow_eType_Direction,
(attrnav_sEnumElement*)&elem_direction },
{ (unsigned int)glow_eType_HorizDirection,
(attrnav_sEnumElement*)&elem_horizdirection },
{ (unsigned int)glow_eType_Color, (attrnav_sEnumElement*)&elem_color },
{ (unsigned int)glow_eType_Tone, (attrnav_sEnumElement*)&elem_tone },
{ (unsigned int)glow_eType_ToneOrColor,
......@@ -1330,6 +1336,7 @@ int attrnav_attr_string_to_value(int type_id, char* value_str, void* buffer_ptr,
}
case glow_eType_Int:
case glow_eType_Direction:
case glow_eType_HorizDirection:
case glow_eType_Adjustment:
case glow_eType_AnnotType:
case glow_eType_Font:
......@@ -1420,6 +1427,7 @@ void attrnav_attrvalue_to_string(
break;
}
case glow_eType_Direction:
case glow_eType_HorizDirection:
case glow_eType_Adjustment:
case glow_eType_AnnotType:
case glow_eType_Font:
......@@ -3268,6 +3276,7 @@ AItemLocal::AItemLocal(AttrNav* attrnav, const char* item_name,
&node);
switch (type_id) {
case glow_eType_Direction:
case glow_eType_HorizDirection:
case glow_eType_Adjustment:
case glow_eType_AnnotType:
case glow_eType_Font:
......
This diff is collapsed.
......@@ -40,7 +40,8 @@
/* ge_dyn.h -- Ge predefined dynamics and actions */
#include "glow_keyboardapi.h"
#include "rt_cbuf.h"
#include "rt_sevcli.h"
#include "ge_graph.h"
/*! \file ge_dyn.h
......@@ -152,6 +153,9 @@ typedef enum {
ge_eDynPrio_Trend,
ge_eDynPrio_FastCurve,
ge_eDynPrio_XY_Curve,
ge_eDynPrio_DsTrend,
ge_eDynPrio_DsTrendCurve,
ge_eDynPrio_SevHist,
ge_eDynPrio_AnalogText,
ge_eDynPrio_Table,
ge_eDynPrio_SliderBackground,
......@@ -242,7 +246,10 @@ typedef enum {
ge_mDynType2_DigBackgroundColor = 1 << 6,
ge_mDynType2_DigSwap = 1 << 7,
ge_mDynType2_DigScript = 1 << 8,
ge_mDynType2_RefUpdate = 1 << 9
ge_mDynType2_RefUpdate = 1 << 9,
ge_mDynType2_DsTrend = 1 << 10,
ge_mDynType2_DsTrendCurve = 1 << 11,
ge_mDynType2_SevHist = 1 << 12
} ge_mDynType2;
//! Action types.
......@@ -361,6 +368,8 @@ typedef enum {
ge_eSave_DigSwap = 45,
ge_eSave_DigScript = 46,
ge_eSave_RefUpdate = 47,
ge_eSave_DsTrend = 48,
ge_eSave_DsTrendCurve = 49,
ge_eSave_PopupMenu = 50,
ge_eSave_SetDig = 51,
ge_eSave_ResetDig = 52,
......@@ -387,6 +396,7 @@ typedef enum {
ge_eSave_Script = 73,
ge_eSave_CatchSignal = 74,
ge_eSave_EmitSignal = 75,
ge_eSave_SevHist = 76,
ge_eSave_End = 99,
ge_eSave_Dyn_dyn_type1 = 100,
ge_eSave_Dyn_action_type1 = 101,
......@@ -611,6 +621,27 @@ typedef enum {
ge_eSave_DigScript_level = 4603,
ge_eSave_RefUpdate_attribute = 4700,
ge_eSave_RefUpdate_whole_graph = 4701,
ge_eSave_DsTrend_dstrend_object1 = 4800,
ge_eSave_DsTrend_dstrend_object2 = 4801,
ge_eSave_DsTrend_mark1_attr = 4802,
ge_eSave_DsTrend_mark2_attr = 4803,
ge_eSave_DsTrend_mark1_color = 4804,
ge_eSave_DsTrend_mark2_color = 4805,
ge_eSave_DsTrend_hold_attr = 4806,
ge_eSave_DsTrend_minvalue_attr1 = 4807,
ge_eSave_DsTrend_maxvalue_attr1 = 4808,
ge_eSave_DsTrend_minvalue_attr2 = 4809,
ge_eSave_DsTrend_maxvalue_attr2 = 4810,
ge_eSave_DsTrendCurve_dstrend_object = 4900,
ge_eSave_DsTrendCurve_mark1_attr = 4902,
ge_eSave_DsTrendCurve_mark2_attr = 4903,
ge_eSave_DsTrendCurve_mark1_color = 4904,
ge_eSave_DsTrendCurve_mark2_color = 4905,
ge_eSave_DsTrendCurve_hold_attr = 4906,
ge_eSave_DsTrendCurve_minvalue_attr1 = 4907,
ge_eSave_DsTrendCurve_maxvalue_attr1 = 4908,
ge_eSave_DsTrendCurve_minvalue_attr2 = 4909,
ge_eSave_DsTrendCurve_maxvalue_attr2 = 4910,
ge_eSave_PopupMenu_ref_object = 5000,
ge_eSave_SetDig_attribute = 5100,
ge_eSave_SetDig_instance = 5101,
......@@ -799,7 +830,25 @@ typedef enum {
ge_eSave_Script_script = 7301,
ge_eSave_CatchSignal_signal_name = 7400,
ge_eSave_EmitSignal_signal_name = 7500,
ge_eSave_EmitSignal_global = 7501
ge_eSave_EmitSignal_global = 7501,
ge_eSave_SevHist_sevhist_object1 = 7600,
ge_eSave_SevHist_sevhist_object2 = 7601,
ge_eSave_SevHist_attribute1 = 7602,
ge_eSave_SevHist_attribute2 = 7603,
ge_eSave_SevHist_server = 7604,
ge_eSave_SevHist_mark1_attr = 7605,
ge_eSave_SevHist_mark2_attr = 7606,
ge_eSave_SevHist_mark1_color = 7607,
ge_eSave_SevHist_mark2_color = 7608,
ge_eSave_SevHist_hold_attr = 7609,
ge_eSave_SevHist_minvalue_attr1 = 7610,
ge_eSave_SevHist_maxvalue_attr1 = 7611,
ge_eSave_SevHist_minvalue_attr2 = 7612,
ge_eSave_SevHist_maxvalue_attr2 = 7613,
ge_eSave_SevHist_timerange = 7614,
ge_eSave_SevHist_timerange_attr = 7615,
ge_eSave_SevHist_update_attr = 7616,
ge_eSave_SevHist_updatetime = 7617
} ge_eSave;
class GeDynElem;
......@@ -2603,6 +2652,211 @@ public:
int syntax_check(grow_tObject object, int* error_cnt, int* warning_cnt);
};
//! Dynamics for a DsTrend object.
class GeDsTrend : public GeDynElem {
public:
pwr_tOName dstrend_object1;
pwr_tOName dstrend_object2;
pwr_tAName minvalue_attr1;
pwr_tAName maxvalue_attr1;
pwr_tAName minvalue_attr2;
pwr_tAName maxvalue_attr2;
pwr_tAName hold_attr;
pwr_tAName mark1_attr;
pwr_tAName mark2_attr;
int max_points; //!< Max number of points in curves.
bool first_scan; //!< Indicates that this is the first scan.
int dstrend_cnt;
pwr_tAttrRef dstrend_aref[2];
int interval[2];
int last_buffer[2];
int last_next_index[2];
int max_time;
int min_interval;
int min_interval_idx;
pwr_tFloat32* min_value1_p;
pwr_tFloat32* max_value1_p;
pwr_tFloat32 old_min_value1;
pwr_tFloat32 old_max_value1;
pwr_tSubid min_value_subid1;
pwr_tSubid max_value_subid1;
pwr_tFloat32* min_value2_p;
pwr_tFloat32* max_value2_p;
graph_eDatabase min_value1_db;
graph_eDatabase max_value1_db;
pwr_tFloat32 old_min_value2;
pwr_tFloat32 old_max_value2;
pwr_tSubid min_value_subid2;
pwr_tSubid max_value_subid2;
int trend_hold;
pwr_tBoolean* hold_p;
pwr_tSubid hold_subid;
graph_eDatabase hold_db;
pwr_tFloat32* mark1_p;
pwr_tFloat32* mark2_p;
pwr_tFloat32 old_mark1;
pwr_tFloat32 old_mark2;
pwr_tSubid mark1_subid;
pwr_tSubid mark2_subid;
glow_eDrawType mark1_color;
glow_eDrawType mark2_color;
GeDsTrend(GeDyn* e_dyn);
GeDsTrend(const GeDsTrend& x);
void get_attributes(attr_sItem* attrinfo, int* item_count);
void save(std::ofstream& fp);
void open(std::ifstream& fp);
int connect(grow_tObject object, glow_sTraceData* trace_data, bool now);
int disconnect(grow_tObject object);
int scan(grow_tObject object);
void set_attribute(grow_tObject object, const char* attr_name, int* cnt);
void replace_attribute(char* from, char* to, int* cnt, int strict);
int syntax_check(grow_tObject object, int* error_cnt, int* warning_cnt);
};
//! Dynamics for a DsTrendCurve object.
class GeDsTrendCurve : public GeDynElem {
public:
pwr_tOName dstrend_object;
pwr_tAName minvalue_attr1;
pwr_tAName maxvalue_attr1;
pwr_tAName minvalue_attr2;
pwr_tAName maxvalue_attr2;
pwr_tAName hold_attr;
pwr_tAName mark1_attr;
pwr_tAName mark2_attr;
int max_points; //!< Max number of points in curves.
bool first_scan; //!< Indicates that this is the first scan.
int dstrend_cnt;
cbuf_sCircBuffInfo cb_info[2];
int element_size[2];
pwr_eType element_type[2];
pwr_tAttrRef dstrend_aref;
int interval[2];
int last_buffer[2];
int last_next_index[2];
int max_time;
int min_interval;
int min_interval_idx;
pwr_tFloat32* min_value1_p;
pwr_tFloat32* max_value1_p;
pwr_tFloat32 old_min_value1;
pwr_tFloat32 old_max_value1;
pwr_tSubid min_value_subid1;
pwr_tSubid max_value_subid1;
pwr_tFloat32* min_value2_p;
pwr_tFloat32* max_value2_p;
graph_eDatabase min_value1_db;
graph_eDatabase max_value1_db;
pwr_tFloat32 old_min_value2;
pwr_tFloat32 old_max_value2;
pwr_tSubid min_value_subid2;
pwr_tSubid max_value_subid2;
int trend_hold;
pwr_tBoolean* hold_p;
pwr_tSubid hold_subid;
graph_eDatabase hold_db;
pwr_tFloat32* mark1_p;
pwr_tFloat32* mark2_p;
pwr_tFloat32 old_mark1;
pwr_tFloat32 old_mark2;
pwr_tSubid mark1_subid;
pwr_tSubid mark2_subid;
glow_eDrawType mark1_color;
glow_eDrawType mark2_color;
GeDsTrendCurve(GeDyn* e_dyn);
GeDsTrendCurve(const GeDsTrendCurve& x);
void get_attributes(attr_sItem* attrinfo, int* item_count);
void save(std::ofstream& fp);
void open(std::ifstream& fp);
int connect(grow_tObject object, glow_sTraceData* trace_data, bool now);
int disconnect(grow_tObject object);
int scan(grow_tObject object);
void set_attribute(grow_tObject object, const char* attr_name, int* cnt);
void replace_attribute(char* from, char* to, int* cnt, int strict);
int syntax_check(grow_tObject object, int* error_cnt, int* warning_cnt);
};
//! Dynamics for a SevHist object.
class GeSevHist : public GeDynElem {
public:
pwr_tAName sevhist_object1;
pwr_tAName sevhist_object2;
pwr_tAName attribute1;
pwr_tAName attribute2;
char server[80];
pwr_tFloat32 timerange;
pwr_tAName timerange_attr;
pwr_tAName minvalue_attr1;
pwr_tAName maxvalue_attr1;
pwr_tAName minvalue_attr2;
pwr_tAName maxvalue_attr2;
pwr_tAName hold_attr;
pwr_tAName update_attr;
pwr_tFloat32 updatetime;
pwr_tAName mark1_attr;
pwr_tAName mark2_attr;
int max_points; //!< Max number of points in curves.
bool first_scan; //!< Indicates that this is the first scan.
int sevhist_cnt;
pwr_tFloat32* min_value1_p;
pwr_tFloat32* max_value1_p;
pwr_tFloat32 old_min_value1;
pwr_tFloat32 old_max_value1;
pwr_tSubid min_value_subid1;
pwr_tSubid max_value_subid1;
pwr_tFloat32* min_value2_p;
pwr_tFloat32* max_value2_p;
graph_eDatabase min_value1_db;
graph_eDatabase max_value1_db;
pwr_tFloat32 old_min_value2;
pwr_tFloat32 old_max_value2;
pwr_tSubid min_value_subid2;
pwr_tSubid max_value_subid2;
pwr_tFloat32* timerange_p;
pwr_tSubid timerange_subid;
graph_eDatabase timerange_db;
int trend_hold;
pwr_tBoolean* hold_p;
pwr_tSubid hold_subid;
graph_eDatabase hold_db;
pwr_tBoolean* update_p;
pwr_tSubid update_subid;
graph_eDatabase update_db;
pwr_tBoolean old_update;
pwr_tFloat32* mark1_p;
pwr_tFloat32* mark2_p;
pwr_tFloat32 old_mark1;
pwr_tFloat32 old_mark2;
pwr_tSubid mark1_subid;
pwr_tSubid mark2_subid;
glow_eDrawType mark1_color;
glow_eDrawType mark2_color;
sevcli_tCtx scctx;
pwr_tOid oidv[2];
pwr_tOName anamev[2];
pwr_tDeltaTime dt_timerange;
float acc_time;
glow_eHorizDirection direction;
GeSevHist(GeDyn* e_dyn);
GeSevHist(const GeSevHist& x);
void get_attributes(attr_sItem* attrinfo, int* item_count);
void save(std::ofstream& fp);
void open(std::ifstream& fp);
int connect(grow_tObject object, glow_sTraceData* trace_data, bool now);
int disconnect(grow_tObject object);
int scan(grow_tObject object);
void set_attribute(grow_tObject object, const char* attr_name, int* cnt);
void replace_attribute(char* from, char* to, int* cnt, int strict);
int syntax_check(grow_tObject object, int* error_cnt, int* warning_cnt);
};
//! Execute the supplied command when the value gets high.
class GeDigCommand : public GeDynElem {
public:
......
......@@ -1602,7 +1602,39 @@ int Graph::get_attr_items(grow_tObject object, attr_sItem** itemlist,
"FastCurve.CurveFillColor1", "MaxValue2", "FastCurve.MaxValue2",
"MinValue2", "FastCurve.MinValue2", "CurveColor2",
"FastCurve.CurveColor2", "CurveFillColor2", "FastCurve.CurveFillColor2",
"Dynamic", "", "" };
"Direction", "", "Dynamic", "", "" };
grow_GetObjectAttrInfo(
object, (char*)transtab, &grow_info, &grow_info_cnt);
*item_cnt = 0;
dyn->get_attributes(object, items, item_cnt);
} else if (dyn->dyn_type2 & ge_mDynType2_DsTrend) {
char transtab[][32] = { "NoOfPoints", "DsTrend.NoOfPoints", "ScanTime",
"DsTrend.ScanTime", "CurveWidth", "DsTrend.CurveLineWidth", "FillCurve",
"DsTrend.FillCurve", "HorizontalLines", "DsTrend.HorizontalLines",
"VerticalLines", "DsTrend.VerticalLines", "MaxValue1",
"DsTrend.MaxValue1", "MinValue1", "DsTrend.MinValue1",
"CurveColor1", "DsTrend.CurveColor1", "CurveFillColor1",
"DsTrend.CurveFillColor1", "MaxValue2", "DsTrend.MaxValue2",
"MinValue2", "DsTrend.MinValue2", "CurveColor2",
"DsTrend.CurveColor2", "CurveFillColor2", "DsTrend.CurveFillColor2",
"Direction", "DsTrend.Direction", "Dynamic", "", "" };
grow_GetObjectAttrInfo(
object, (char*)transtab, &grow_info, &grow_info_cnt);
*item_cnt = 0;
dyn->get_attributes(object, items, item_cnt);
} else if (dyn->dyn_type2 & ge_mDynType2_DsTrendCurve) {
char transtab[][32] = { "NoOfPoints", "DsTrendCurve.NoOfPoints", "ScanTime",
"DsTrendCurve.ScanTime", "CurveWidth", "DsTrendCurve.CurveLineWidth", "FillCurve",
"DsTrendCurve.FillCurve", "HorizontalLines", "DsTrendCurve.HorizontalLines",
"VerticalLines", "DsTrendCurve.VerticalLines", "MaxValue1",
"DsTrendCurve.MaxValue1", "MinValue1", "DsTrendCurve.MinValue1",
"CurveColor1", "DsTrendCurve.CurveColor1", "CurveFillColor1",
"DsTrendCurve.CurveFillColor1", "MaxValue2", "DsTrendCurve.MaxValue2",
"MinValue2", "DsTrendCurve.MinValue2", "CurveColor2",
"DsTrendCurve.CurveColor2", "CurveFillColor2", "DsTrendCurve.CurveFillColor2",
"Direction", "DsTrendCurve.Direction", "Dynamic", "", "" };
grow_GetObjectAttrInfo(
object, (char*)transtab, &grow_info, &grow_info_cnt);
......@@ -1614,7 +1646,24 @@ int Graph::get_attr_items(grow_tObject object, attr_sItem** itemlist,
"XY_Curve.FillCurve", "HorizontalLines", "XY_Curve.HorizontalLines",
"VerticalLines", "XY_Curve.VerticalLines", "MaxValue1", "", "MinValue1",
"", "CurveColor1", "", "CurveFillColor1", "", "MaxValue2", "",
"MinValue2", "", "CurveColor2", "", "CurveFillColor2", "", "Dynamic",
"MinValue2", "", "CurveColor2", "", "CurveFillColor2", "",
"Direction", "", "Dynamic",
"", "" };
grow_GetObjectAttrInfo(
object, (char*)transtab, &grow_info, &grow_info_cnt);
*item_cnt = 0;
dyn->get_attributes(object, items, item_cnt);
} else if (dyn->dyn_type2 & ge_mDynType2_SevHist) {
char transtab[][32] = { "NoOfPoints", "SevHist.MaxPoints", "ScanTime",
"", "CurveWidth", "SevHist.CurveLineWidth", "FillCurve",
"SevHist.FillCurve", "HorizontalLines", "SevHist.HorizontalLines",
"VerticalLines", "SevHist.VerticalLines", "MaxValue1", "SevHist.MaxValue1",
"MinValue1", "SevHist.MinValue1", "CurveColor1", "SevHist.CurveColor1",
"CurveFillColor1", "SevHist.CurveFillColor1", "MaxValue2", "SevHist.MaxValue2",
"MinValue2", "SevHist.MinValue2", "CurveColor2", "SevHist.CurveColor2",
"CurveFillColor2", "SevHist.CurveFillColor2", "Direction", "SevHist.Direction",
"Dynamic",
"", "" };
grow_GetObjectAttrInfo(
object, (char*)transtab, &grow_info, &grow_info_cnt);
......@@ -1630,7 +1679,7 @@ int Graph::get_attr_items(grow_tObject object, attr_sItem** itemlist,
"CurveFillColor1", "Trend.CurveFillColor1", "MaxValue2",
"Trend.MaxValue2", "MinValue2", "Trend.MinValue2", "CurveColor2",
"Trend.CurveColor2", "CurveFillColor2", "Trend.CurveFillColor2",
"Dynamic", "", "" };
"Direction", "Trend.Direction", "Dynamic", "", "" };
grow_GetObjectAttrInfo(
object, (char*)transtab, &grow_info, &grow_info_cnt);
......@@ -2517,28 +2566,48 @@ static int graph_grow_cb(GlowCtx* ctx, glow_tEvent event)
if (streq(sub_name, "pwr_trend")) {
grow_tObject t1;
graph->create_trend(&t1, event->create_grow_object.x,
event->create_grow_object.y, (unsigned int)ge_mDynType1_Trend, 0);
event->create_grow_object.y, (unsigned int)ge_mDynType1_Trend, 0, 0);
graph->journal_store(journal_eAction_CreateObject, t1);
} else if (streq(sub_name, "pwrct_trend")) {
grow_tObject t1;
graph->create_trend(&t1, event->create_grow_object.x,
event->create_grow_object.y, (unsigned int)ge_mDynType1_Trend, 1);
event->create_grow_object.y, (unsigned int)ge_mDynType1_Trend, 0, 1);
graph->journal_store(journal_eAction_CreateObject, t1);
} else if (streq(sub_name, "pwr_fastcurve")) {
grow_tObject t1;
graph->create_trend(&t1, event->create_grow_object.x,
event->create_grow_object.y, (unsigned int)ge_mDynType1_FastCurve,
event->create_grow_object.y, (unsigned int)ge_mDynType1_FastCurve, 0,
0);
graph->journal_store(journal_eAction_CreateObject, t1);
} else if (streq(sub_name, "pwr_dstrend")) {
grow_tObject t1;
graph->create_trend(&t1, event->create_grow_object.x,
event->create_grow_object.y, 0, (unsigned int)ge_mDynType2_DsTrend,
0);
graph->journal_store(journal_eAction_CreateObject, t1);
} else if (streq(sub_name, "pwr_dstrendcurve")) {
grow_tObject t1;
graph->create_trend(&t1, event->create_grow_object.x,
event->create_grow_object.y, 0, (unsigned int)ge_mDynType2_DsTrendCurve,
0);
graph->journal_store(journal_eAction_CreateObject, t1);
} else if (streq(sub_name, "pwr_xycurve")) {
grow_tObject t1;
graph->create_xycurve(&t1, event->create_grow_object.x,
event->create_grow_object.y, (unsigned int)ge_mDynType1_XY_Curve);
event->create_grow_object.y, (unsigned int)ge_mDynType1_XY_Curve, 0);
graph->journal_store(journal_eAction_CreateObject, t1);
} else if (streq(sub_name, "pwr_sevhist")) {
grow_tObject t1;
graph->create_xycurve(&t1, event->create_grow_object.x,
event->create_grow_object.y, 0, (unsigned int)ge_mDynType2_SevHist);
graph->journal_store(journal_eAction_CreateObject, t1);
} else if (streq(sub_name, "pwr_bar")) {
......@@ -5414,7 +5483,7 @@ int Graph::ref_object_info_all()
}
void Graph::create_trend(grow_tObject* object, double x, double y,
unsigned int dyn_type1, int colortheme)
unsigned int dyn_type1, unsigned int dyn_type2, int colortheme)
{
double width = 7;
double height = 5;
......@@ -5434,6 +5503,7 @@ void Graph::create_trend(grow_tObject* object, double x, double y,
height, bcolor, 1, glow_mDisplayLevel_1, 1, 1, fcolor, NULL, object);
dyn = new GeDyn(this);
dyn->dyn_type1 = dyn->total_dyn_type1 = (ge_mDynType1)dyn_type1;
dyn->dyn_type2 = dyn->total_dyn_type2 = (ge_mDynType2)dyn_type2;
dyn->update_elements();
grow_SetUserData(*object, (void*)dyn);
......@@ -5468,7 +5538,7 @@ void Graph::create_trend(grow_tObject* object, double x, double y,
}
void Graph::create_xycurve(
grow_tObject* object, double x, double y, unsigned int dyn_type1)
grow_tObject* object, double x, double y, unsigned int dyn_type1, unsigned int dyn_type2)
{
double width = 7;
double height = 5;
......@@ -5480,6 +5550,7 @@ void Graph::create_xycurve(
glow_eDrawType_Color40, NULL, object);
dyn = new GeDyn(this);
dyn->dyn_type1 = dyn->total_dyn_type1 = (ge_mDynType1)dyn_type1;
dyn->dyn_type2 = dyn->total_dyn_type2 = (ge_mDynType2)dyn_type2;
dyn->update_elements();
grow_SetUserData(*object, (void*)dyn);
......
......@@ -1378,17 +1378,18 @@ public:
\param colortheme Use colortheme colors.
*/
void create_trend(grow_tObject* object, double x, double y,
unsigned int dyn_type, int colortheme);
unsigned int dyn_type1, unsigned int dyn_type2, int colortheme);
//! Create a xy curve object.
/*!
\param object Created xy curve object.
\param x x coordinate for object.
\param y y coordinate for object.
\param dyn_type Dyntype of the created object.
\param dyn_type1 Dyntype1 of the created object.
\param dyn_type2 Dyntype2 of the created object.
*/
void create_xycurve(
grow_tObject* object, double x, double y, unsigned int dyn_type);
grow_tObject* object, double x, double y, unsigned int dyn_type1, unsigned int dyn_type2);
//! Create a bar object.
/*!
......
......@@ -17,7 +17,10 @@ menu Images
menu Analog
{
subgraph Trend pwr_trend.component 25
subgraph DsTrend pwr_dstrend.component 25
subgraph DsTrendCurve pwr_dstrendcurve.component 25
subgraph FastCurve pwr_fastcurve.component 25
subgraph SevHist pwr_sevhist.component 25
subgraph XYCurve pwr_xycurve.component 25
subgraph Bar pwr_bar.component 26
subgraph BarArc pwr_bararc.component 253
......
......@@ -99,7 +99,8 @@ typedef enum {
glow_eType_DynType2, //!< Type of dynamics mask 2
glow_eType_ActionType2, //!< Type of action mask 2
glow_eType_AppMotion, //!< Type is glow_eAppMotion
glow_eType_Float //!< Type is a float
glow_eType_Float, //!< Type is a float
glow_eType_HorizDirection //!< Type is glow_eHorizDirection
} glow_eType;
//! Type of Ctx class
......@@ -242,6 +243,12 @@ typedef enum {
glow_eDirection_Down //!< Direction down
} glow_eDirection;
//! Horizontal direction.
typedef enum {
glow_eHorizDirection_Left,
glow_eHorizDirection_Right
} glow_eHorizDirection;
//! Adjustment of annotations
typedef enum {
glow_eAdjustment_Center, //!< Adjustment center
......@@ -441,6 +448,7 @@ typedef enum {
glow_eCurveType_DigSquare
} glow_eCurveType;
//! Color index for a color
/*! The drawtype is index in an array that contains the gc for colors in the
color palette.
......@@ -1788,6 +1796,7 @@ typedef enum {
glow_eSave_GrowTrend_x_max_value_1 = 3233,
glow_eSave_GrowTrend_x_min_value_1 = 3234,
glow_eSave_GrowTrend_mode = 3235,
glow_eSave_GrowTrend_direction = 3236,
glow_eSave_GrowSlider_grownode_part = 3300,
glow_eSave_GrowSlider_direction = 3301,
glow_eSave_GrowSlider_max_value = 3302,
......
......@@ -2111,6 +2111,13 @@ int grow_GetObjectAttrInfo(
attrinfo[i++].size = sizeof(op->curve_fill_drawtype[1]);
}
if ((name = growapi_translate(transtab, "Direction"))) {
strcpy(attrinfo[i].name, name);
attrinfo[i].value_p = &op->direction;
attrinfo[i].type = glow_eType_HorizDirection;
attrinfo[i++].size = sizeof(op->direction);
}
if ((name = growapi_translate(transtab, "Dynamic"))) {
strcpy(attrinfo[i].name, name);
op->get_dynamic(&dynamic, &dynsize);
......@@ -4805,6 +4812,11 @@ void grow_SetTrendNoOfCurves(grow_tObject object, int no_of_curves)
((GrowTrend*)object)->set_no_of_curves(no_of_curves);
}
glow_eHorizDirection grow_GetTrendDirection(grow_tObject object)
{
return ((GrowTrend*)object)->get_direction();
}
void grow_SetSliderRange(grow_tObject object, double min, double max)
{
((GrowSlider*)object)->set_range(min, max);
......@@ -4855,6 +4867,7 @@ void grow_SetTrendYMark2(grow_tObject object, double mark)
{
((GrowTrend*)object)->set_y_mark2(mark);
}
void grow_SetXYCurveRangeY(
grow_tObject object, int curve, double min, double max)
{
......@@ -4867,6 +4880,18 @@ void grow_SetXYCurveRangeX(
((GrowXYCurve*)object)->set_xy_range_x(curve, min, max);
}
void grow_GetXYCurveRangeY(
grow_tObject object, int curve, double *min, double *max)
{
((GrowXYCurve*)object)->get_xy_range_y(curve, min, max);
}
void grow_GetXYCurveRangeX(
grow_tObject object, int curve, double *min, double *max)
{
((GrowXYCurve*)object)->get_xy_range_x(curve, min, max);
}
void grow_SetXYCurveXMark1(grow_tObject object, double mark)
{
((GrowXYCurve*)object)->set_x_mark1(mark);
......@@ -4892,6 +4917,11 @@ void grow_SetXYCurveNoOfCurves(grow_tObject object, int noofcurves)
((GrowXYCurve*)object)->set_xy_noofcurves(noofcurves);
}
int grow_GetXYCurveNoOfPoints(grow_tObject object)
{
return ((GrowXYCurve*)object)->get_xy_noofpoints();
}
void grow_SetTrendFillCurve(grow_tObject object, int fill)
{
((GrowTrend*)object)->set_fill_curve(fill);
......
......@@ -2422,6 +2422,26 @@ void grow_SetXYCurveRangeY(
void grow_SetXYCurveRangeX(
grow_tObject object, int curve, double min, double max);
//! Get the range of a xy curve object.
/*!
\param object Trend object.
\param curve Curve number.
\param min Minimum value of range.
\param max Maximum value of range.
*/
void grow_GetXYCurveRangeY(
grow_tObject object, int curve, double *min, double *max);
//! Get the range of a xy curve object.
/*!
\param object Trend object.
\param curve Curve number.
\param min Minimum value of range.
\param max Maximum value of range.
*/
void grow_GetXYCurveRangeX(
grow_tObject object, int curve, double *min, double *max);
//! Set vertical mark 1.
/*!
\param mark Mark value.
......@@ -2446,13 +2466,16 @@ void grow_SetXYCurveYMark1(grow_tObject object, double mark);
*/
void grow_SetXYCurveYMark2(grow_tObject object, double mark);
//! Set number of curves a xy curve object.
//! Set number of curves of a xy curve object.
/*!
\param object Trend object.
\param noofcurves Number of curves.
*/
void grow_SetXYCurveNoOfCurves(grow_tObject object, int noofcurves);
//! Get number of points of xy curve object.
int grow_GetXYCurveNoOfPoints(grow_tObject object);
//! Get the scantime of a trend object.
/*!
\param object Trend object.
......@@ -2474,6 +2497,9 @@ void grow_SetTrendScanTime(grow_tObject object, double time);
*/
void grow_SetTrendNoOfCurves(grow_tObject object, int no_of_curves);
//! Get direction for trend object.
glow_eHorizDirection grow_GetTrendDirection(grow_tObject object);
//! Set number of vertical and horizontal lines in a trend object.
/*!
\param object Trend object.
......
......@@ -69,7 +69,8 @@ GrowTrend::GrowTrend(GrowCtx* glow_ctx, const char* name, double x, double y,
curve_width(1), curve_cnt(0), scan_time(1), user_data(0),
display_x_mark1(0), display_x_mark2(0), display_y_mark1(0),
display_y_mark2(0), x_mark1(0), x_mark2(0), y_mark1(0), y_mark2(0),
mark1_color(glow_eDrawType_Inherit), mark2_color(glow_eDrawType_Inherit)
mark1_color(glow_eDrawType_Inherit), mark2_color(glow_eDrawType_Inherit),
direction(glow_eHorizDirection_Left)
{
for (int i = 0; i < TREND_MAX_CURVES; i++) {
y_min_value[i] = 0;
......@@ -123,15 +124,28 @@ void GrowTrend::configure_curves()
for (i = 0; i < points; i++) {
if (!fill_curve) {
point_p->y = ur.y;
point_p->x = ur.x - i * (ur.x - ll.x) / (points - 1);
if (direction == glow_eHorizDirection_Right)
point_p->x = ll.x + i * (ur.x - ll.x) / (points - 1);
else
point_p->x = ur.x - i * (ur.x - ll.x) / (points - 1);
} else {
point_p->y = ur.y;
if (i == 0)
point_p->x = ur.x;
else if (i == points - 1)
point_p->x = ll.x;
else
point_p->x = ur.x - (i - 1) * (ur.x - ll.x) / (points - 3);
if (direction == glow_eHorizDirection_Right) {
if (i == 0)
point_p->x = ll.x;
else if (i == points - 1)
point_p->x = ur.x;
else
point_p->x = ll.x + (i - 1) * (ur.x - ll.x) / (points - 3);
}
else {
if (i == 0)
point_p->x = ur.x;
else if (i == points - 1)
point_p->x = ll.x;
else
point_p->x = ur.x - (i - 1) * (ur.x - ll.x) / (points - 3);
}
}
point_p++;
}
......@@ -200,6 +214,7 @@ void GrowTrend::save(std::ofstream& fp, glow_eSaveMode mode)
fp << int(glow_eSave_GrowTrend_no_of_points) << FSPACE << no_of_points
<< '\n';
fp << int(glow_eSave_GrowTrend_curve_width) << FSPACE << curve_width << '\n';
fp << int(glow_eSave_GrowTrend_direction) << FSPACE << int(direction) << '\n';
fp << int(glow_eSave_GrowTrend_trace_data1) << FSPACE << trace.data[0]
<< '\n';
fp << int(glow_eSave_GrowTrend_trace_data2) << FSPACE << trace.data[1]
......@@ -317,6 +332,10 @@ void GrowTrend::open(std::ifstream& fp)
case glow_eSave_GrowTrend_curve_width:
fp >> curve_width;
break;
case glow_eSave_GrowTrend_direction:
fp >> tmp;
direction = (glow_eHorizDirection)tmp;
break;
case glow_eSave_GrowTrend_rect_part:
GrowRect::open(fp);
break;
......@@ -1124,16 +1143,27 @@ void GrowTrend::set_data(double* data[3], int data_curves, int data_points)
/ (y_max_value[j] - y_min_value[j]) * (ur.y - ll.y);
point_p->y = MAX(ll.y, MIN(point_p->y, ur.y));
point_p->x = ll.x
if (direction == glow_eHorizDirection_Right)
point_p->x = ll.x
+ (data[0][idx] - data[0][0]) / (data[0][points - 1] - data[0][0])
* (ur.x - ll.x);
* (ur.x - ll.x);
else
point_p->x = ur.x
- (data[0][idx] - data[0][0]) / (data[0][points - 1] - data[0][0])
* (ur.x - ll.x);
} else {
if (i == 0) {
point_p->x = ll.x;
if (direction == glow_eHorizDirection_Right)
point_p->x = ll.x;
else
point_p->x = ur.x;
point_p->y = ur.y;
idx--;
} else if (i == cpoints - 1) {
point_p->x = ur.x;
if (direction == glow_eHorizDirection_Right)
point_p->x = ur.x;
else
point_p->x = ll.x;
point_p->y = ur.y;
} else {
if (!feq(y_max_value[j], y_min_value[j]))
......@@ -1142,9 +1172,14 @@ void GrowTrend::set_data(double* data[3], int data_curves, int data_points)
/ (y_max_value[j] - y_min_value[j]) * (ur.y - ll.y);
point_p->y = MAX(ll.y, MIN(point_p->y, ur.y));
point_p->x = ll.x
if (direction == glow_eHorizDirection_Right)
point_p->x = ll.x
+ (data[0][idx] - data[0][0]) / (data[0][points - 1] - data[0][0])
* (ur.x - ll.x);
* (ur.x - ll.x);
else
point_p->x = ur.x
- (data[0][idx] - data[0][0]) / (data[0][points - 1] - data[0][0])
* (ur.x - ll.x);
}
}
point_p++;
......
......@@ -135,6 +135,7 @@ public:
double y_mark2; //!< Horizontal marker line 2 position.
glow_eDrawType mark1_color; //!< Marker line 1 color.
glow_eDrawType mark2_color; //!< Marker line 2 color.
glow_eHorizDirection direction; //!< Direction, right or left
void draw(GlowWind* w, GlowTransform* t, int highlight, int hot, void* node,
void* colornode);
......@@ -218,6 +219,7 @@ public:
void set_x_mark2(double mark);
void set_y_mark1(double mark);
void set_y_mark2(double mark);
glow_eHorizDirection get_direction() {return direction;}
};
/*@}*/
......
......@@ -152,6 +152,18 @@ void GrowXYCurve::set_xy_range_y(int curve, double min, double max)
y_min_value[curve] = min;
}
void GrowXYCurve::get_xy_range_x(int curve, double *min, double *max)
{
*max = x_max_value[curve];
*min = x_min_value[curve];
}
void GrowXYCurve::get_xy_range_y(int curve, double *min, double *max)
{
*max = y_max_value[curve];
*min = y_min_value[curve];
}
void GrowXYCurve::set_xy_noofcurves(int noofcurves)
{
curve_cnt = noofcurves;
......
......@@ -89,7 +89,10 @@ public:
void set_xy_range_x(int curve, double min, double max);
void set_xy_range_y(int curve, double min, double max);
void get_xy_range_x(int curve, double *min, double *max);
void get_xy_range_y(int curve, double *min, double *max);
void set_xy_noofcurves(int noofcurves);
int get_xy_noofpoints() {return no_of_points;}
void set_xy_curve_color(
int curve, glow_eDrawType curve_color, glow_eDrawType fill_color);
void set_xy_data(
......
......@@ -1352,6 +1352,8 @@ XNav::XNav(void* xn_parent_ctx, const char* xn_name, xnav_sStartMenu* root_menu,
//
XNav::~XNav()
{
if (opplace_p)
free(opplace_p);
}
//
......
......@@ -4619,10 +4619,12 @@ static int xnav_open_func(void* client_data, void* client_flag)
return sts;
}
xnav->scctx = sevcli_get_stored_ctx();
if (!xnav->scctx) {
sevcli_init(&sts, &xnav->scctx);
if (EVEN(sts))
return sts;
sevcli_store_ctx(xnav->scctx);
}
sevcli_set_servernode(&sts, xnav->scctx, server_node);
if (EVEN(sts))
......
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