Hi All.
I have got an app. that gets data from devices via the comport.
60% if not more of the data from these devices is similar or easy to
deal with, like dates and times, but other info can be specific to a
device, and i have to normalize it into a format that I want.
Could you somehow specify all your known interfaces, then determine whether you can detect the device based on that?
So in a data file you'd have :
devicetype=thingy char1=X dataformat: char2-11=date char12-16=currenttemp char17-19=unused ... devicetype=widget char1=Y ... devicetype=acme widget char2=0
Then you could do:
if Str[1] = 'X' then // this is a thingy // so we know : // first 10 chars are date // next 5 chars are current temperature // next 3 chars are meaningless // .... if Str[1] = 'Y' then // this is a widget if Str[2] = '0' then // this is an ACME brand widget
In effect, building up your own language for defining comport interfaces? Then upgrading your app would mean only updating the definition file.
Actually, you could even go further in that file include what happens to each segment of the string ie:
devicetype=thingy char1=X dataformat char2-11=date dataformat: char2-11=insert into device_table.date_of_access char12-16=insert into device_table.current_temp
Or have I gone way off track?
Cheers, Kurt.
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
