I am TCP-IP communication over TCP. I have specific packets to query and then I receive a response based on that. My packet is basically a character array that i convert to string like this:
unsigned char array1 []={0,132,0,0,0,6,84,5,0,1,255,0};
std::string load_seqInit ( array1, array1 + sizeof array1 / sizeof array1[0] );
However, I want to store these arrays separately as enum values. So that I can just call the enumtype and it will map to my respective array.
enum packets{
LOAD,
READ,
RESET,
UNLOAD
}
So maybe when I call enum type LOAD it will point to the packet:
unsigned char array1 []={0,132,0,0,0,6,84,5,0,1,255,0};
then I can just convert the enum to string and proceed with my query and response.
Aucun commentaire:
Enregistrer un commentaire