Commit 61dbf96a authored by Claes Sjofors's avatar Claes Sjofors

Merge branch 'master' of newton:/data1/x0-0-0/pwr

parents 2888c112 1d40dca2
......@@ -66,6 +66,14 @@ void GsdmlAttrGtk::message( char severity, const char *message)
gtk_label_set_text( GTK_LABEL(msg_label), message);
}
void GsdmlAttrGtk::attr_help_text(const char *help_text)
{
GtkTextBuffer *buffer;
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(this->help_text));
gtk_text_buffer_set_text(buffer, help_text, -1);
}
void GsdmlAttrGtk::set_prompt( const char *prompt)
{
if ( strcmp(prompt, "") == 0) {
......@@ -486,6 +494,24 @@ GsdmlAttrGtk::GsdmlAttrGtk( GtkWidget *a_parent_wid,
attrnav->message_cb = &GsdmlAttr::gsdmlattr_message;
attrnav->change_value_cb = &GsdmlAttr::gsdmlattr_change_value_cb;
// Attribute Help Text
GtkWidget *help_area = gtk_hbox_new( FALSE, 0);
//We want scrollbars to the right in case the help text is very long
GtkWidget *scroll_window = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll_window), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
// Set up the text view
help_text = gtk_text_view_new();
gtk_text_view_set_editable(GTK_TEXT_VIEW(help_text), FALSE);
gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(help_text), GTK_WRAP_WORD);
gtk_widget_set_can_focus(help_text, FALSE);
gtk_widget_set_size_request(help_text, -1, 100);
//Add the text view to the container and pack it in the layout
gtk_container_add(GTK_CONTAINER(scroll_window), help_text);
gtk_box_pack_start( GTK_BOX(help_area), scroll_window, TRUE, TRUE, 0);
// Status bar and value input
GtkWidget *statusbar = gtk_hbox_new( FALSE, 0);
msg_label = gtk_label_new( "");
......@@ -523,6 +549,7 @@ GsdmlAttrGtk::GsdmlAttrGtk( GtkWidget *a_parent_wid,
gtk_box_pack_start( GTK_BOX(vbox), GTK_WIDGET(menu_bar), FALSE, FALSE, 0);
gtk_box_pack_start( GTK_BOX(vbox), brow_widget, TRUE, TRUE, 0);
gtk_box_pack_start( GTK_BOX(vbox), help_area, FALSE, FALSE, 3);
gtk_box_pack_start( GTK_BOX(vbox), statusbar, FALSE, FALSE, 3);
gtk_box_pack_start( GTK_BOX(vbox), gtk_hseparator_new(), FALSE, FALSE, 0);
gtk_box_pack_start( GTK_BOX(vbox), hboxbuttons, FALSE, FALSE, 5);
......@@ -545,4 +572,4 @@ GsdmlAttrGtk::GsdmlAttrGtk( GtkWidget *a_parent_wid,
wow = new CoWowGtk( toplevel);
*a_sts = attrnav->open( data_filename);
}
\ No newline at end of file
}
......@@ -49,9 +49,9 @@ class GsdmlAttrGtk : public GsdmlAttr {
GtkWidget *form_widget;
GtkWidget *toplevel;
GtkWidget *msg_label;
GtkWidget *help_text;
GtkWidget *cmd_prompt;
GtkWidget *cmd_input;
GtkWidget *attrnav_form;
GtkWidget *cmd_ok;
GtkWidget *cmd_apply;
GtkWidget *cmd_cancel;
......@@ -74,6 +74,12 @@ class GsdmlAttrGtk : public GsdmlAttr {
~GsdmlAttrGtk();
void message( char severity, const char *message);
/**
* @brief attr_help_text Set the help text area to display a help text
* @param help_text Help text to display
*/
void attr_help_text(const char *help_text);
void set_prompt( const char *prompt);
void change_value();
......@@ -105,4 +111,4 @@ class GsdmlAttrGtk : public GsdmlAttr {
//static void valchanged_cmd_input( GtkWidget *w, gpointer data);
};
#endif
\ No newline at end of file
#endif
......@@ -99,4 +99,48 @@ GsdmlAttrNavGtk::~GsdmlAttrNavGtk()
void GsdmlAttrNavGtk::set_inputfocus()
{
gtk_widget_grab_focus( brow_widget);
}
\ No newline at end of file
}
void GsdmlAttrNavGtk::display_attr_help_text()
{
brow_tNode *node_list;
int node_count;
ItemPn *base_item;
brow_GetSelectedNodes( brow->ctx, &node_list, &node_count);
if ( !node_count)
return;
brow_GetUserData( node_list[0], (void **)&base_item);
free( node_list);
switch( base_item->type) {
/*
* The following two item types could make use of the same info_text that the the base class does,
* but since they already contained references they were used instead...
*/
case attrnav_eItemType_PnParValue:
case attrnav_eItemType_PnParEnum: {
ItemPnParEnum *item = (ItemPnParEnum *)base_item;
gsdml_ValueItem *vi = 0;
if (item->value_ref)
vi = (gsdml_ValueItem *)item->value_ref->Body.ValueItemTarget.p;
//If we do have help available show it
if (vi && vi->Body.Help.p)
((GsdmlAttrGtk*)parent_ctx)->attr_help_text((char*)vi->Body.Help.p);
else
((GsdmlAttrGtk*)parent_ctx)->attr_help_text("");
break;
}
default: {
// Do we have an associated info text string to show the user some more info?
if (base_item->info_text)
((GsdmlAttrGtk*)parent_ctx)->attr_help_text(base_item->info_text);
else
((GsdmlAttrGtk*)parent_ctx)->attr_help_text("");
}
}
}
......@@ -56,6 +56,7 @@ class GsdmlAttrNavGtk : public GsdmlAttrNav {
pwr_tStatus *status);
~GsdmlAttrNavGtk();
void set_inputfocus();
void display_attr_help_text();
GtkWidget *parent_wid;
GtkWidget *brow_widget;
......@@ -64,4 +65,4 @@ class GsdmlAttrNavGtk : public GsdmlAttrNav {
};
#endif
\ No newline at end of file
#endif
......@@ -154,6 +154,8 @@ static gsdml_sTag taglist[] = {
{ "RT_Class3TimingProperties", gsdml_eTag_RT_Class3TimingProperties, gsdml_eType_, 0, 0, 1},
{ "MediaRedundancy", gsdml_eTag_MediaRedundancy, gsdml_eType_, 0, 0, 1},
{ "PortSubmoduleItem", gsdml_eTag_PortSubmoduleItem, gsdml_eType_, 0, 0, 1},
{ "MAUTypeList", gsdml_eTag_MAUTypeList, gsdml_eType_, 0, 0, 1},
{ "MAUTypeItem", gsdml_eTag_MAUTypeItem, gsdml_eType_, 0, 0, 1},
{ "UseableSubmodules", gsdml_eTag_UseableSubmodules, gsdml_eType_, 0, 0, 1},
{ "SubmoduleItemRef", gsdml_eTag_SubmoduleItemRef, gsdml_eType_, 0, 0, 1},
{ "SlotList", gsdml_eTag_SlotList, gsdml_eType_, 0, 0, 1},
......@@ -242,6 +244,7 @@ static gsdml_sAttribute attrlist[] = {
{ "LLDP_NoD_Supported", gsdml_eTag_DeviceAccessPointItem, gsdml_eTag_, gsdml_eType_Boolean, sizeof(gsdml_tBoolean), offsetof(gsdml_sDeviceAccessPointItem,LLDP_NoD_Supported), 0, "false"},
{ "ResetToFactoryModes", gsdml_eTag_DeviceAccessPointItem, gsdml_eTag_, gsdml_eType_Unsigned32, sizeof(gsdml_tUnsigned32), offsetof(gsdml_sDeviceAccessPointItem,ResetToFactoryModes), 0, "0"},
{ "SharedInputSupported", gsdml_eTag_DeviceAccessPointItem, gsdml_eTag_, gsdml_eType_Boolean, sizeof(gsdml_tBoolean), offsetof(gsdml_sDeviceAccessPointItem,SharedInputSupported), 0, "false"},
{ "NumberOfDeviceAccessAR", gsdml_eTag_DeviceAccessPointItem, gsdml_eTag_, gsdml_eType_Unsigned16, sizeof(gsdml_tUnsigned16), offsetof(gsdml_sDeviceAccessPointItem,ObjectUUID_LocalIndex), 0, "1"},
//
// ModuleInfo
//
......@@ -254,7 +257,7 @@ static gsdml_sAttribute attrlist[] = {
{ "Value", gsdml_eTag_HardwareRelease, gsdml_eTag_ModuleInfo, gsdml_eType_Token, sizeof(gsdml_tToken), offsetof(gsdml_sModuleInfo,HardwareRelease), 0, ""},
{ "Value", gsdml_eTag_SoftwareRelease, gsdml_eTag_ModuleInfo, gsdml_eType_Token, sizeof(gsdml_tToken), offsetof(gsdml_sModuleInfo,SoftwareRelease), 0, ""},
{ "MainFamily", gsdml_eTag_Family, gsdml_eTag_ModuleInfo, gsdml_eType_String, sizeof(gsdml_tString80), offsetof(gsdml_sModuleInfo,MainFamily), 0, ""},
{ "ProductFamily", gsdml_eTag_Family, gsdml_eTag_ModuleInfo, gsdml_eType_String, sizeof(gsdml_tString80), offsetof(gsdml_sModuleInfo,ProductFamily), 0, ""},
{ "ProductFamily", gsdml_eTag_Family, gsdml_eTag_ModuleInfo, gsdml_eType_String, sizeof(gsdml_tString80), offsetof(gsdml_sModuleInfo,ProductFamily), 0, ""},
//
// CertificationInfo
//
......@@ -291,6 +294,8 @@ static gsdml_sAttribute attrlist[] = {
{ "Writeable_IM_Records", gsdml_eTag_VirtualSubmoduleItem, gsdml_eTag_, gsdml_eType_ValueList, sizeof(gsdml_tValueList), offsetof(gsdml_sVirtualSubmoduleItem,Writeable_IM_Records), 0, "0"},
{ "Max_iParameterSize", gsdml_eTag_VirtualSubmoduleItem, gsdml_eTag_, gsdml_eType_Unsigned32, sizeof(gsdml_tUnsigned32), offsetof(gsdml_sVirtualSubmoduleItem,Max_iParameterSize), 0, "0"},
{ "SubsysModuleDirIndex", gsdml_eTag_VirtualSubmoduleItem, gsdml_eTag_, gsdml_eType_Unsigned16, sizeof(gsdml_tUnsigned16), offsetof(gsdml_sVirtualSubmoduleItem,SubsysModuleDirIndex), 0, ""},
//Added without doc, check type and default value
{ "MayIssueProcessAlarm", gsdml_eTag_VirtualSubmoduleItem, gsdml_eTag_, gsdml_eType_Unsigned16, sizeof(gsdml_tUnsigned16), offsetof(gsdml_sVirtualSubmoduleItem,MayIssueProcessAlarm), 0, "0"},
//
// IOData
//
......@@ -458,6 +463,7 @@ static gsdml_sAttribute attrlist[] = {
{ "DCP_HelloSupported", gsdml_eTag_InterfaceSubmoduleItem, gsdml_eTag_, gsdml_eType_Boolean, sizeof(gsdml_tBoolean), offsetof(gsdml_sInterfaceSubmoduleItem,DCP_HelloSupported), 0, "false"},
{ "PTP_BoundarySupported", gsdml_eTag_InterfaceSubmoduleItem, gsdml_eTag_, gsdml_eType_Boolean, sizeof(gsdml_tBoolean), offsetof(gsdml_sInterfaceSubmoduleItem,PTP_BoundarySupported), 0, "false"},
{ "DCP_BoundarySupported", gsdml_eTag_InterfaceSubmoduleItem, gsdml_eTag_, gsdml_eType_Boolean, sizeof(gsdml_tBoolean), offsetof(gsdml_sInterfaceSubmoduleItem,DCP_BoundarySupported), 0, "false"},
{ "DelayMeasurementSupported", gsdml_eTag_InterfaceSubmoduleItem, gsdml_eTag_, gsdml_eType_Boolean, sizeof(gsdml_tBoolean), offsetof(gsdml_sInterfaceSubmoduleItem,DelayMeasurementSupported), 0, "false"},
//
// DCP_FlashOnceSignalUnit
//
......@@ -535,6 +541,14 @@ static gsdml_sAttribute attrlist[] = {
{ "IsDefaultRingport", gsdml_eTag_PortSubmoduleItem, gsdml_eTag_, gsdml_eType_Boolean, sizeof(gsdml_tBoolean), offsetof(gsdml_sPortSubmoduleItem,IsDefaultRingport), 0, "false"},
// Added without doc, TODO check type and default value
{ "CheckMAUTypeSupported", gsdml_eTag_PortSubmoduleItem, gsdml_eTag_, gsdml_eType_Boolean, sizeof(gsdml_tBoolean), offsetof(gsdml_sPortSubmoduleItem,CheckMAUTypeSupported), 0, "false"},
{ "CheckMAUTypeDifferenceSupported", gsdml_eTag_PortSubmoduleItem, gsdml_eTag_, gsdml_eType_Boolean, sizeof(gsdml_tBoolean), offsetof(gsdml_sPortSubmoduleItem,CheckMAUTypeDifferenceSupported), 0, "false"},
//
// MAUTypeList
//
{ "Value", gsdml_eTag_MAUTypeItem, gsdml_eTag_MAUTypeList, gsdml_eType_Unsigned16, sizeof(gsdml_tUnsigned16), offsetof(gsdml_sMAUTypeItem,Value), 0, ""},
{ "AdjustSupported", gsdml_eTag_MAUTypeItem, gsdml_eTag_MAUTypeList, gsdml_eType_Boolean, sizeof(gsdml_tBoolean), offsetof(gsdml_sMAUTypeItem,AdjustSupported), 0, "false"},
//
// DeviceAccessPointItem-ApplicationRelations
//
......@@ -3387,7 +3401,8 @@ void gsdml_DeviceAccessPointItem::print( int ind)
"%s MaxSupportedRecordSize=\"%u\"\n"
"%s PowerOnToCommReady=\"%u\"\n"
"%s ParameterizationSpeedSupported=\"%d\"\n"
"%s NameOfStationNotTransferable=\"%d\"/>\n",
"%s NameOfStationNotTransferable=\"%d\"\n"
"%s NumberOfDeviceAccessAR=\"%d\"/>\n",
is,
is, Body.ID,
is, Body.PhysicalSlots.str,
......@@ -3408,7 +3423,8 @@ void gsdml_DeviceAccessPointItem::print( int ind)
is, Body.MaxSupportedRecordSize,
is, Body.PowerOnToCommReady,
is, Body.ParameterizationSpeedSupported,
is, Body.NameOfStationNotTransferable);
is, Body.NameOfStationNotTransferable,
is, Body.NumberOfDeviceAccessAR);
if ( ModuleInfo)
ModuleInfo->print( ind + 2);
......@@ -3456,7 +3472,7 @@ void gsdml_ModuleInfo::build()
Body.SubCategory1Ref.p = gsdml->find_category_ref( Body.SubCategory1Ref.ref);
if ( !Body.SubCategory1Ref.p)
gsdml->error_message("SubCategory1Ref not found: \"%s\"", Body.SubCategory1Ref.ref);
}
}
}
void gsdml_ModuleInfo::print( int ind)
......@@ -3906,7 +3922,8 @@ void gsdml_VirtualSubmoduleItem::print( int ind)
"%s PROFISafeSupported=\"%u\"\n"
"%s Writeable_IM_Records=\"%s\"\n"
"%s Max_iParameterSize=\"%u\"\n"
"%s SubsysModuleDirIndex=\"%hu\">\n",
"%s SubsysModuleDirIndex=\"%hu\"\n"
"%s MayIssueProcessAlarm=\"%hu\">\n",
is,
is, Body.ID,
is, Body.SubmoduleIdentNumber,
......@@ -3915,7 +3932,8 @@ void gsdml_VirtualSubmoduleItem::print( int ind)
is, Body.PROFIsafeSupported,
is, Body.Writeable_IM_Records.str,
is, Body.Max_iParameterSize,
is, Body.SubsysModuleDirIndex);
is, Body.SubsysModuleDirIndex,
is, Body.MayIssueProcessAlarm);
if ( IOData)
IOData->print( ind + 2);
......@@ -4086,7 +4104,8 @@ void gsdml_InterfaceSubmoduleItem::print( int ind)
"%s NetworkComponentDiagnosisSupported=\"%u\"\n"
"%s DCP_HelloSupported=\"%u\"\n"
"%s PTP_BoundarySupported=\"%u\"\n"
"%s DCP_BoundarySupported=\"%u\">\n",
"%s DCP_BoundarySupported=\"%u\"\n"
"%s DelayMeasurementSupported=\"%u\">\n",
is,
is, Body.SubslotNumber,
is, Body.TextId.ref,
......@@ -4100,7 +4119,8 @@ void gsdml_InterfaceSubmoduleItem::print( int ind)
is, Body.NetworkComponentDiagnosisSupported,
is, Body.DCP_HelloSupported,
is, Body.PTP_BoundarySupported,
is, Body.DCP_BoundarySupported);
is, Body.DCP_BoundarySupported,
is, Body.DelayMeasurementSupported);
if ( General)
General->print( ind + 2);
......@@ -4136,7 +4156,9 @@ void gsdml_PortSubmoduleItem::print( int ind)
"%s LinkStateDianosisCapability=\"%s\"\n"
"%s PowerBudgetControlSupported=\"%u\"\n"
"%s SupportsRingportConfig=\"%u\"\n"
"%s IsDefauleRingport=\"%u\">\n",
"%s IsDefauleRingport=\"%u\"\n"
"%s CheckMAUTTypeSupported=\"%u\"\n"
"%s CheckMAUTTypeDifferenceSupported=\"%u\">\n",
is,
is, Body.SubslotNumber,
is, Body.TextId.ref,
......@@ -4150,7 +4172,9 @@ void gsdml_PortSubmoduleItem::print( int ind)
is, Body.LinkStateDiagnosisCapability,
is, Body.PowerBudgetControlSupported,
is, Body.SupportsRingportConfig,
is, Body.IsDefaultRingport);
is, Body.IsDefaultRingport,
is, Body.CheckMAUTypeSupported,
is, Body.CheckMAUTypeDifferenceSupported);
if ( RecordDataList)
RecordDataList->print( ind + 2);
......@@ -5068,6 +5092,11 @@ void gsdml_ValueItem::build()
for ( unsigned int i = 0; i < Assignments->Assign.size(); i++)
Assignments->Assign[i]->build();
}
if ( strcmp( Body.Help.ref, "") != 0) {
Body.Help.p = gsdml->find_text_ref( Body.Help.ref);
if ( Body.Help.p == noref)
gsdml->error_message("Help not found: \"%s\"", Body.Help.ref);
}
}
gsdml_ValueItem::~gsdml_ValueItem()
......
......@@ -202,6 +202,8 @@ typedef enum {
gsdml_eTag_RT_Class3TimingProperties,
gsdml_eTag_MediaRedundancy,
gsdml_eTag_PortSubmoduleItem,
gsdml_eTag_MAUTypeList,
gsdml_eTag_MAUTypeItem,
gsdml_eTag_UseableSubmodules,
gsdml_eTag_SubmoduleItemRef,
gsdml_eTag_SlotList,
......@@ -414,6 +416,11 @@ class gsdml_ModuleInfo {
void print( int ind);
};
typedef struct {
gsdml_tUnsigned16 Value;
gsdml_tBoolean AdjustSupported;
} gsdml_sMAUTypeItem;
typedef struct {
gsdml_tString ConformanceClass;
gsdml_tString ApplicationClass;
......@@ -746,6 +753,7 @@ typedef struct {
gsdml_tValueList Writeable_IM_Records;
gsdml_tUnsigned32 Max_iParameterSize;
gsdml_tUnsigned16 SubsysModuleDirIndex;
gsdml_tUnsigned16 MayIssueProcessAlarm;
} gsdml_sVirtualSubmoduleItem;
class gsdml_VirtualSubmoduleItem {
......@@ -914,6 +922,7 @@ typedef struct {
gsdml_tBoolean DCP_HelloSupported;
gsdml_tBoolean PTP_BoundarySupported;
gsdml_tBoolean DCP_BoundarySupported;
gsdml_tBoolean DelayMeasurementSupported;
} gsdml_sInterfaceSubmoduleItem;
class gsdml_InterfaceSubmoduleItem {
......@@ -950,6 +959,7 @@ typedef struct {
gsdml_tBoolean SupportsRingportConfig;
gsdml_tBoolean IsDefaultRingport;
gsdml_tBoolean CheckMAUTypeSupported;
gsdml_tBoolean CheckMAUTypeDifferenceSupported;
} gsdml_sPortSubmoduleItem;
class gsdml_PortSubmoduleItem {
......@@ -979,7 +989,7 @@ typedef struct {
gsdml_tUnsigned16 AR_BlockVersion;
gsdml_tUnsigned16 IOCR_BlockVersion;
gsdml_tUnsigned16 AlarmCR_BlockVersion;
gsdml_tUnsigned16 SubmoduleDataBlockVersion;;
gsdml_tUnsigned16 SubmoduleDataBlockVersion;
} gsdml_sDeviceAccessPointItem_ApplicationRelations;
class gsdml_DeviceAccessPointItem_ApplicationRelations {
......@@ -1096,6 +1106,7 @@ typedef struct {
gsdml_tBoolean LLDP_NoD_Supported;
gsdml_tUnsigned32 ResetToFactoryModes;
gsdml_tBoolean SharedInputSupported;
gsdml_tUnsigned16 NumberOfDeviceAccessAR;
} gsdml_sDeviceAccessPointItem;
class gsdml_DeviceAccessPointItem {
......
......@@ -90,6 +90,7 @@ class GsdmlAttr {
virtual ~GsdmlAttr();
virtual void message( char severity, const char *message) {}
virtual void attr_help_text(const char *help_text) {}
virtual void set_prompt( const char *prompt) {}
virtual void change_value() {}
......@@ -117,4 +118,4 @@ class GsdmlAttr {
};
#endif
\ No newline at end of file
#endif
......@@ -706,9 +706,11 @@ int GsdmlAttrNav::brow_cb( FlowCtx *ctx, flow_tEvent event)
}
}
}
brow_SelectClear( attrnav->brow->ctx);
brow_SetInverse( object, 1);
brow_SelectInsert( attrnav->brow->ctx, object);
attrnav->display_attr_help_text();
if ( !brow_IsVisible( attrnav->brow->ctx, object, flow_eVisible_Full))
brow_CenterObject( attrnav->brow->ctx, object, 0.25);
if ( node_count)
......@@ -743,6 +745,7 @@ int GsdmlAttrNav::brow_cb( FlowCtx *ctx, flow_tEvent event)
brow_SelectClear( attrnav->brow->ctx);
brow_SetInverse( object, 1);
brow_SelectInsert( attrnav->brow->ctx, object);
attrnav->display_attr_help_text();
if ( !brow_IsVisible( attrnav->brow->ctx, object, flow_eVisible_Full))
brow_CenterObject( attrnav->brow->ctx, object, 0.75);
if ( node_count)
......@@ -780,6 +783,7 @@ int GsdmlAttrNav::brow_cb( FlowCtx *ctx, flow_tEvent event)
brow_SelectClear( attrnav->brow->ctx);
brow_SetInverse( event->object.object, 1);
brow_SelectInsert( attrnav->brow->ctx, event->object.object);
attrnav->display_attr_help_text();
}
break;
default:
......@@ -859,6 +863,7 @@ int GsdmlAttrNav::brow_cb( FlowCtx *ctx, flow_tEvent event)
brow_SelectClear( attrnav->brow->ctx);
brow_SetInverse( object, 1);
brow_SelectInsert( attrnav->brow->ctx, object);
attrnav->display_attr_help_text();
if ( !brow_IsVisible( attrnav->brow->ctx, object, flow_eVisible_Full))
brow_CenterObject( attrnav->brow->ctx, object, 0.25);
free( node_list);
......@@ -2047,8 +2052,8 @@ int ItemPn::close( GsdmlAttrNav *attrnav, double x, double y)
}
ItemPnEnumValue::ItemPnEnumValue( GsdmlAttrNav *attrnav, const char *item_name, int item_num,
int item_type_id, void *attr_value_p,
brow_tNode dest, flow_eDest dest_code) :
int item_type_id, void *attr_value_p,
brow_tNode dest, flow_eDest dest_code, const char *info_text) : ItemPn(info_text),
num(item_num), type_id(item_type_id), value_p(attr_value_p), first_scan(1)
{
......@@ -2090,8 +2095,7 @@ int ItemPnEnumValue::scan( GsdmlAttrNav *attrnav, void *p)
ItemPnEnumValueMType::ItemPnEnumValueMType( GsdmlAttrNav *attrnav, const char *item_name,
const char *item_number, int item_num,
int item_type_id, void *attr_value_p,
brow_tNode dest, flow_eDest dest_code) :
num(item_num), type_id(item_type_id), value_p(attr_value_p), first_scan(1)
brow_tNode dest, flow_eDest dest_code, const char *info_text) : ItemPn(info_text), num(item_num), type_id(item_type_id), value_p(attr_value_p), first_scan(1)
{
type = attrnav_eItemType_PnEnumValueMType;
......@@ -2175,10 +2179,11 @@ int ItemPnDevice::open_children( GsdmlAttrNav *attrnav, double x, double y)
&attrnav->device_num, node, flow_eDest_IntoLast);
for ( unsigned int i = 0; i < attrnav->gsdml->ApplicationProcess->DeviceAccessPointList->DeviceAccessPointItem.size(); i++) {
gsdml_DeviceAccessPointItem *item = attrnav->gsdml->ApplicationProcess->DeviceAccessPointList->DeviceAccessPointItem[i];
char name[80];
strncpy( name, (char *)attrnav->gsdml->ApplicationProcess->DeviceAccessPointList->DeviceAccessPointItem[i]->ModuleInfo->Body.Name.p, sizeof(name));
new ItemPnEnumValue( attrnav, name, idx++, pwr_eType_UInt32,
&attrnav->device_num, node, flow_eDest_IntoLast);
snprintf(name, sizeof(name), "%s (%s)", (char*)item->ModuleInfo->Body.Name.p, item->ModuleInfo->Body.OrderNumber);
new ItemPnEnumValue( attrnav, name, idx++, pwr_eType_UInt32,
&attrnav->device_num, node, flow_eDest_IntoLast, (char *)item->ModuleInfo->Body.InfoText.p);
}
brow_SetOpen( node, attrnav_mOpen_Children);
......@@ -2232,9 +2237,8 @@ int ItemPnDevice::scan( GsdmlAttrNav *attrnav, void *p)
if ( attrnav->device_num == 0)
strcpy( buf, "No");
else {
strncpy( buf, (char *)attrnav->gsdml->ApplicationProcess->DeviceAccessPointList->
DeviceAccessPointItem[attrnav->device_num-1]->ModuleInfo->Body.Name.p,
sizeof(buf));
gsdml_DeviceAccessPointItem *item = attrnav->gsdml->ApplicationProcess->DeviceAccessPointList->DeviceAccessPointItem[attrnav->device_num-1];
snprintf(buf, sizeof(buf), "%s (%s)", (char*)item->ModuleInfo->Body.Name.p, item->ModuleInfo->Body.OrderNumber);
}
}
brow_SetAnnotation( node, 1, buf, strlen(buf));
......@@ -2534,7 +2538,8 @@ int ItemPnSlot::scan( GsdmlAttrNav *attrnav, void *p)
ModuleItemRef[slotdata->module_enum_number-1]->Body.ModuleItemTarget.p;
if ( !mi || !mi->ModuleInfo->Body.Name.p)
return 1;
strncpy( buf, (char *) mi->ModuleInfo->Body.Name.p, sizeof(buf));
snprintf(buf, sizeof(buf), "%s (%s)", (char *)mi->ModuleInfo->Body.Name.p, mi->ModuleInfo->Body.OrderNumber);
}
brow_SetAnnotation( node, 1, buf, strlen(buf));
old_value = *(int *)p;
......@@ -3179,6 +3184,11 @@ int ItemPnInterfaceSubmodule::open_children( GsdmlAttrNav *attrnav, double x, do
pwr_eType_Boolean, sizeof(pwr_tBoolean), 0, 0,
p, 1, node, flow_eDest_IntoLast);
p = (char *) &ii->Body.DelayMeasurementSupported;
new ItemPnBase( attrnav, "DelayMeasurementSupported", "LocalGsdmlAttr",
pwr_eType_Boolean, sizeof(pwr_tBoolean), 0, 0,
p, 1, node, flow_eDest_IntoLast);
gsdml_RecordDataList *rl = ii->RecordDataList;
if ( rl) {
unsigned int record_index = 0;
......@@ -3294,6 +3304,16 @@ int ItemPnPortSubmodule::open_children( GsdmlAttrNav *attrnav, double x, double
pwr_eType_Boolean, sizeof(pwr_tBoolean), 0, 0,
p, 1, node, flow_eDest_IntoLast);
p = (char *) &pi->Body.CheckMAUTypeSupported;
new ItemPnBase( attrnav, "CheckMAUTypeSupported", "LocalGsdmlAttr",
pwr_eType_Boolean, sizeof(pwr_tBoolean), 0, 0,
p, 1, node, flow_eDest_IntoLast);
p = (char *) &pi->Body.CheckMAUTypeDifferenceSupported;
new ItemPnBase( attrnav, "CheckMAUTypeDifferenceSupported", "LocalGsdmlAttr",
pwr_eType_Boolean, sizeof(pwr_tBoolean), 0, 0,
p, 1, node, flow_eDest_IntoLast);
gsdml_RecordDataList *rl = pi->RecordDataList;
if ( rl) {
GsdmlDataRecord *dr;
......@@ -3474,7 +3494,7 @@ int ItemPnModuleType::open_children( GsdmlAttrNav *attrnav, double x, double y)
new ItemPnEnumValueMType( attrnav, mname, mi->ModuleInfo->Body.OrderNumber, idx,
pwr_eType_UInt32,
&attrnav->dev_data.slot_data[slot_idx]->module_enum_number,
node, flow_eDest_IntoLast);
node, flow_eDest_IntoLast, (char *)mi->ModuleInfo->Body.InfoText.p);
}
else if ( um->ModuleItemRef[i]->Body.FixedInSlots.list &&
um->ModuleItemRef[i]->Body.FixedInSlots.list->in_list(slot_number)) {
......@@ -4142,7 +4162,7 @@ ItemPnParEnum::ItemPnParEnum( GsdmlAttrNav *attrnav, const char *item_name,
// Get the values and corresponding texts
gsdml_ValueItem *vi = (gsdml_ValueItem *)value_ref->Body.ValueItemTarget.p;
gsdml_Valuelist *allowed_values = 0;
if ( strcmp( value_ref->Body.AllowedValues, "") != 0)
allowed_values = new gsdml_Valuelist( value_ref->Body.AllowedValues);
......@@ -4151,9 +4171,12 @@ ItemPnParEnum::ItemPnParEnum( GsdmlAttrNav *attrnav, const char *item_name,
for ( unsigned int i = 0; i < vi->Assignments->Assign.size(); i++) {
ParEnumValue eval;
int num;
num = sscanf( vi->Assignments->Assign[i]->Body.Content, "%u", &eval.value);
if ( num != 1)
continue;
if ( allowed_values && !allowed_values->in_list( eval.value))
continue;
......@@ -4163,6 +4186,20 @@ ItemPnParEnum::ItemPnParEnum( GsdmlAttrNav *attrnav, const char *item_name,
values.push_back( eval);
}
}
else if (datatype == gsdml_eValueDataType_Bit)
{
ParEnumValue eval;
eval.value = 1;
strncpy( eval.text, "On", sizeof(eval.text));
eval.value <<= bit_offset;
values.push_back( eval);
eval.value = 0;
strncpy( eval.text, "Off", sizeof(eval.text));
values.push_back( eval);
}
if ( allowed_values)
delete allowed_values;
......@@ -4218,15 +4255,12 @@ int ItemPnParEnum::open_children( GsdmlAttrNav *attrnav, double x, double y)
else {
brow_SetNodraw( attrnav->brow->ctx);
gsdml_ValueItem *vi = (gsdml_ValueItem *)value_ref->Body.ValueItemTarget.p;
if ( vi && vi->Assignments) {
for ( unsigned int i = 0; i < values.size(); i++) {
new ItemPnParEnumBit( attrnav, values[i].text, datatype, data,
byte_offset, values[i].value, mask, noedit,
node, flow_eDest_IntoLast);
}
for ( unsigned int i = 0; i < values.size(); i++) {
new ItemPnParEnumBit( attrnav, values[i].text, datatype, data,
byte_offset, values[i].value, mask, noedit,
node, flow_eDest_IntoLast);
}
brow_SetOpen( node, attrnav_mOpen_Children);
brow_SetAnnotPixmap( node, 0, attrnav->brow->pixmap_openmap);
brow_ResetNodraw( attrnav->brow->ctx);
......@@ -4973,4 +5007,4 @@ int ItemPnEnumSendClock::scan( GsdmlAttrNav *attrnav, void *p)
old_value = *(int *)p;
return 1;
}
\ No newline at end of file
}
......@@ -120,7 +120,7 @@ class ItemPn;
//! Class for handling of brow.
class GsdmlAttrNavBrow {
public:
GsdmlAttrNavBrow( BrowCtx *brow_ctx, void *xn) : ctx(brow_ctx), attrnav(xn) {};
GsdmlAttrNavBrow( BrowCtx *brow_ctx, void *xn) : ctx(brow_ctx), attrnav(xn) {}
~GsdmlAttrNavBrow();
BrowCtx *ctx;
......@@ -184,6 +184,7 @@ class GsdmlAttrNav {
pwr_tStatus *status);
virtual ~GsdmlAttrNav();
virtual void display_attr_help_text() {}
virtual void set_inputfocus() {}
void start_trace( pwr_tObjid Objid, char *object_str);
......@@ -229,11 +230,13 @@ class GsdmlAttrNav {
class ItemPn {
public:
ItemPn() : parent(0) {}
ItemPn() : parent(0), info_text(0) {}
ItemPn(const char *info_text) : parent(0), info_text(info_text) {}
attrnav_eItemType type;
brow_tNode node;
char name[120];
int parent;
const char *info_text;
virtual ~ItemPn() {}
......@@ -269,8 +272,7 @@ class ItemPnBase : public ItemPn {
class ItemPnEnumValue : public ItemPn {
public:
ItemPnEnumValue( GsdmlAttrNav *attrnav, const char *item_name, int item_num,
int item_type_id,
void *attr_value_p, brow_tNode dest, flow_eDest dest_code);
int item_type_id, void *attr_value_p, brow_tNode dest, flow_eDest dest_code, const char *info_text = 0);
int num;
int type_id;
void *value_p;
......@@ -284,9 +286,7 @@ class ItemPnEnumValue : public ItemPn {
class ItemPnEnumValueMType : public ItemPn {
public:
ItemPnEnumValueMType( GsdmlAttrNav *attrnav, const char *item_name, const char *item_number,
int item_num,
int item_type_id,
void *attr_value_p, brow_tNode dest, flow_eDest dest_code);
int item_num, int item_type_id, void *attr_value_p, brow_tNode dest, flow_eDest dest_code, const char *info_text = 0);
int num;
int type_id;
void *value_p;
......@@ -686,4 +686,4 @@ class ItemPnEnumSendClock : public ItemPn {
#if defined __cplusplus
}
#endif
#endif
\ No newline at end of file
#endif
......@@ -140,7 +140,7 @@ int rmq_connect()
if ( !ctx->conn) {
ctx->conn = amqp_new_connection();
printf( "Connection : %u\n", (unsigned int)ctx->conn);
// printf( "Connection : %u\n", (unsigned int)ctx->conn);
}
if ( !ctx->socket) {
......@@ -320,7 +320,7 @@ unsigned int rmq_receive()
printf( "Unknown Reply type: %d\n", ret.reply_type);
}
if (debug) printf("Received message %d\n", envelope.message.body.len);
if (debug) printf("Received message %d\n", (int) envelope.message.body.len);
if ( envelope.message.body.len > 0 && rn_rmq->DisableHeader) {
......
......@@ -250,7 +250,7 @@ void sev_repair::clean_item( int idx, int print_idx)
printf( "-- Processing %d (%u) %s\n", idx, (unsigned int)m_db->m_items.size(), m_db->m_items[idx].tablename);
else
printf( "-- Processing %s\n", m_db->m_items[idx].tablename);
m_db->delete_old_objectdata( &m_sts, m_db->m_items[idx].tablename,
m_db->delete_old_objectdata( &m_sts, 0, m_db->m_items[idx].tablename,
m_db->m_items[idx].options, limit, m_db->m_items[idx].scantime, (float)0xEFFFFFFF);
}
else {
......@@ -258,7 +258,7 @@ void sev_repair::clean_item( int idx, int print_idx)
printf( "-- Processing %d (%u) %s\n", idx, (unsigned int)m_db->m_items.size(), m_db->m_items[idx].tablename);
else
printf( "-- Processing %s\n", m_db->m_items[idx].tablename);
m_db->delete_old_data( &m_sts, m_db->m_items[idx].tablename,
m_db->delete_old_data( &m_sts, 0, m_db->m_items[idx].tablename,
m_db->m_items[idx].options, limit, m_db->m_items[idx].scantime, (float)0xEFFFFFFF);
}
}
......@@ -428,4 +428,4 @@ int main (int argc, char *argv[])
}
#else
int main(){}
#endif
\ No newline at end of file
#endif
......@@ -216,6 +216,7 @@ int sev_server::init( int noneth)
m_db->get_objectitems(&m_sts);
m_refid = tree_CreateTable(&sts, sizeof(pwr_tRefId), offsetof(sev_sRefid, id), sizeof(sev_sRefid), 100, sev_comp_refid);
sts = thread_MutexInit(&m_refid_mutex);
// Create a queue to server
qcom_sQattr attr;
......@@ -643,14 +644,16 @@ int sev_server::check_histitems( sev_sMsgHistItems *msg, unsigned int size)
// Remove all refid's for this node
pwr_tNid nid = msg->Items[0].sevid.nid;
pwr_tStatus sts;
sev_sRefid *rp = (sev_sRefid *)tree_Minimum(&sts, m_refid);
sev_sRefid *succ_rp;
thread_MutexLock(&m_refid_mutex);
sev_sRefid *rp = (sev_sRefid *)tree_Minimum(&sts, m_refid);
while ( rp) {
succ_rp = (sev_sRefid *)tree_Successor(&sts, m_refid, rp);
if ( rp->id.nid == nid)
tree_Remove( &sts, m_refid, &rp->id);
rp = succ_rp;
}
thread_MutexUnlock(&m_refid_mutex);
for ( int i = 0; i < item_cnt; i++) {
if ( msg->Items[i].attrnum > 0) {
......@@ -778,8 +781,10 @@ int sev_server::check_histitems( sev_sMsgHistItems *msg, unsigned int size)
sev_sRefid *rp;
rk = buffP->sevid;
thread_MutexLock(&m_refid_mutex);
rp = (sev_sRefid *) tree_Insert(&sts, m_refid, &rk);
rp->idx = idx;
thread_MutexUnlock(&m_refid_mutex);
}
int numberOfAttributes = buffP->attrnum;
......@@ -821,8 +826,10 @@ int sev_server::check_histitems( sev_sMsgHistItems *msg, unsigned int size)
sev_sRefid *rp;
rk = msg->Items[i].sevid;
thread_MutexLock(&m_refid_mutex);
rp = (sev_sRefid *) tree_Insert(&sts, m_refid, &rk);
rp->idx = idx;
thread_MutexUnlock(&m_refid_mutex);
}
}
else {
......@@ -874,7 +881,10 @@ int sev_server::receive_histdata( sev_sMsgHistDataStore *msg, unsigned int size,
sev_sRefid *rp;
pwr_tRefId rk = dp->sevid;
thread_MutexLock(&m_refid_mutex);
rp = (sev_sRefid *) tree_Find(&sts, m_refid, &rk);
thread_MutexUnlock(&m_refid_mutex);
if ( !rp) {
dp = (sev_sHistData *)((char *)dp + sizeof( *dp) - sizeof(dp->data) + dp->size);
continue;
......@@ -1449,7 +1459,9 @@ void *sev_server::receive_histdata_thread( void *arg)
sev_sRefid *rp;
pwr_tRefId rk = dp->sevid;
thread_MutexLock(&sev->m_refid_mutex);
rp = (sev_sRefid *) tree_Find(&sts, sev->m_refid, &rk);
thread_MutexUnlock(&sev->m_refid_mutex);
if ( !rp) {
dp = (sev_sHistData *)((char *)dp + sizeof( *dp) - sizeof(dp->data) + dp->size);
continue;
......
......@@ -123,6 +123,7 @@ class sev_server {
pwr_tStatus m_server_status;
vector<sev_node> m_nodes;
tree_sTable *m_refid;
thread_sMutex m_refid_mutex;
unsigned int m_msg_id;
sev_db *m_db;
int m_noneth;
......
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