G
GMM50
Hello:
I am working on a design that has a large number of messages. These
messages are saved in the system and used by the system. I need to
convert from message names to internal storage location.
I will force a naming convention something like names from SM1001 to
SM1999. Not all SMxxxx numbers are used. And as the design changes
old SMxxxx will be deleted and new ones added.
In the code I use these messages as constants as:
PlayMsg(SM1023, OutputChannel, Volume);
So I'm planning to use a define to convert SM1023 to the internal
storage number (= location).
#define SM1023 19 // Hello Message
But then when the user downloads a message I need to programatically
determine it's internal storage number (= location).
So a table of structures
struct MSG_CVRT {
int msg;
int loc;
}
struct MSG_CVRG MsgTbl[] = {
1023, 19; // Hello Message
0, 0;
}
And I can look for MsgTbl.msg and then extract the location.
My problem is I now have data in two places and they will get out of
sync. Anyone come across this issue and have advice.
This is an embedded system so memory usage and speed of operation are
considered.
Thanks in advance
george
I am working on a design that has a large number of messages. These
messages are saved in the system and used by the system. I need to
convert from message names to internal storage location.
I will force a naming convention something like names from SM1001 to
SM1999. Not all SMxxxx numbers are used. And as the design changes
old SMxxxx will be deleted and new ones added.
In the code I use these messages as constants as:
PlayMsg(SM1023, OutputChannel, Volume);
So I'm planning to use a define to convert SM1023 to the internal
storage number (= location).
#define SM1023 19 // Hello Message
But then when the user downloads a message I need to programatically
determine it's internal storage number (= location).
So a table of structures
struct MSG_CVRT {
int msg;
int loc;
}
struct MSG_CVRG MsgTbl[] = {
1023, 19; // Hello Message
0, 0;
}
And I can look for MsgTbl.msg and then extract the location.
My problem is I now have data in two places and they will get out of
sync. Anyone come across this issue and have advice.
This is an embedded system so memory usage and speed of operation are
considered.
Thanks in advance
george