Commit daa37cf3 authored by claes's avatar claes

UserPrmData used if no ExtUserPrmData found

parent 6adc59e4
/* /*
* Proview $Id: rt_pb_gsd.cpp,v 1.7 2007-02-21 14:08:57 claes Exp $ * Proview $Id: rt_pb_gsd.cpp,v 1.8 2007-08-21 15:12:40 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -562,7 +562,7 @@ int pb_gsd::read( char *filename) ...@@ -562,7 +562,7 @@ int pb_gsd::read( char *filename)
case gsd_UserPrmData: case gsd_UserPrmData:
case gsd_OString: { case gsd_OString: {
char *s = strchr( line, '='); char *s = strchr( line, '=');
str_to_ostring( (unsigned char **)&datap->data, s+1, 256, 0); str_to_ostring( (unsigned char **)&datap->data, s+1, 256, &datap->len);
datap->found = 1; datap->found = 1;
break; break;
} }
...@@ -1520,6 +1520,11 @@ int pb_gsd::get_svalue( char *key, char *value, int size) ...@@ -1520,6 +1520,11 @@ int pb_gsd::get_svalue( char *key, char *value, int size)
case gsd_SlaveFamily: case gsd_SlaveFamily:
strncpy( value, (char *)datap->data, size); strncpy( value, (char *)datap->data, size);
return 1; return 1;
case gsd_UserPrmData: {
int len = size < datap->len ? size : datap->len;
memcpy( value, (char *)datap->data, len);
return 1;
}
default: default:
return 0; return 0;
} }
...@@ -2077,6 +2082,25 @@ void pb_gsd::pack_ext_user_prm_data( char *data, int *len) ...@@ -2077,6 +2082,25 @@ void pb_gsd::pack_ext_user_prm_data( char *data, int *len)
*len = data_idx; *len = data_idx;
} }
int pb_gsd::get_user_prm_data( char *data, int *len, int size)
{
int sts;
sts = get_ivalue( "User_Prm_Data_Len", len);
if ( EVEN(sts)) {
*len = 0;
return 0;
}
sts = get_svalue( "User_Prm_Data", data, size);
if ( EVEN(sts)) {
*len = 0;
return 0;
}
return 1;
}
int pb_gsd::unpack_ext_user_prm_data( char *data, int len) int pb_gsd::unpack_ext_user_prm_data( char *data, int len)
{ {
int i; int i;
......
/* /*
* Proview $Id: rt_pb_gsd.h,v 1.5 2007-02-21 14:09:02 claes Exp $ * Proview $Id: rt_pb_gsd.h,v 1.6 2007-08-21 15:12:40 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -86,6 +86,7 @@ typedef struct { ...@@ -86,6 +86,7 @@ typedef struct {
unsigned int value; unsigned int value;
void *data; void *data;
int found; int found;
int len;
} gsd_sData; } gsd_sData;
typedef struct sArea { typedef struct sArea {
...@@ -232,6 +233,7 @@ class pb_gsd { ...@@ -232,6 +233,7 @@ class pb_gsd {
int cut_module_conf( gsd_sModuleConf *m); int cut_module_conf( gsd_sModuleConf *m);
int paste_module_conf( gsd_sModuleConf *m); int paste_module_conf( gsd_sModuleConf *m);
void pack_config( char *config, int *len); void pack_config( char *config, int *len);
int get_user_prm_data( char *data, int *len, int size);
int unpack_ext_user_prm_data( char *data, int len); int unpack_ext_user_prm_data( char *data, int len);
void pack_ext_user_prm_data( char *data, int *len); void pack_ext_user_prm_data( char *data, int *len);
void compress( char *line); void compress( char *line);
......
/* /*
* Proview $Id: wb_c_pb_dp_slave.cpp,v 1.9 2007-06-01 12:53:51 claes Exp $ * Proview $Id: wb_c_pb_dp_slave.cpp,v 1.10 2007-08-21 15:12:40 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -190,8 +190,15 @@ int pb_dp_slave_save_cb( void *sctx) ...@@ -190,8 +190,15 @@ int pb_dp_slave_save_cb( void *sctx)
int len; int len;
memset( user_prm_data, 0, sizeof(user_prm_data)); memset( user_prm_data, 0, sizeof(user_prm_data));
// Get ExtUserPrmData
ctx->gsd->pack_ext_user_prm_data( (char *)user_prm_data, &len); ctx->gsd->pack_ext_user_prm_data( (char *)user_prm_data, &len);
if ( !len) {
// Get UserPrmData instead
ctx->gsd->get_user_prm_data( (char *)user_prm_data, &len,
sizeof(user_prm_data));
}
sts = ldh_ArefANameToAref( ctx->ldhses, &ctx->aref, "PrmUserData", &aaref); sts = ldh_ArefANameToAref( ctx->ldhses, &ctx->aref, "PrmUserData", &aaref);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return 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