What software design pattern is best for the following scenario (C#)
Posted
by askjdh
on Stack Overflow
See other posts from Stack Overflow
or by askjdh
Published on 2010-05-13T15:03:51Z
Indexed on
2010/05/13
15:14 UTC
Read the original article
Hit count: 258
I have a gps device that records data e.g. datetime, latitude, longitude
I have an sdk that reads the data from the device. The way the data is read:
A command packet (basically a combination of int values in a struct) is sent to the device. The device responds with the data in fixed size chunks e.g. 64bytes
Depending on the command issued I will get back differect data structs e.g. sending command 1 to the device returns a struct like
struct x
{
id int,
name char[20]
}
command 2 returns a collection of the following structs (basically it boils down to an array of the structs - y[12])
struct y
{
date datetime,
lat decimal,
lon decimal
}
I would then want to convert the struct to a class and save the data to a database.
What would be the best way to encapsulate the entire process, preferably using some established design pattern?
Many thanks M
© Stack Overflow or respective owner