Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 786621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:04:18+00:00 2026-05-14T21:04:18+00:00

I have a gps device that records data e.g. datetime, latitude, longitude I have

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T21:04:18+00:00Added an answer on May 14, 2026 at 9:04 pm

    I would start with base classes for commands and responses and each specific command or response derives from those.

    Then a class for sending and receiving – either the command knows how to serialize itself or another paired object can do that if you want to really decouple things.

    Some factory object would create the proper response type object based on parsing the response (perhaps along with knowledge of the last sent request/command)

    The response object ctor takes the struct response as a parameter.

    You then make a database/persistence object that knows how to tell the objects to save themselves (or you have a pairing of response objects to persistence objects for more decoupling)

    There are probably better ways to do it, but the above seems reasonable to me and a lot of this I did for writing an rs232 application that talked to a medical lab device.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a device that records GPS data. A reading is taken every 2-10
I have looked at many open source GPS programs that can parse GPS data
I have a problem with the boost::asio::serial_port class reading from a GPS device (USB-Serial).
Say you have a Windows Mobile 6.0 phone that also has a GPS receiver.
I have a task to store large amount of gps data and some extra
I'm trying to boot Linux on a GPS device from a SD card. I
My gps device writes its data to a text file in my server. Now
In my app, I have a service that gets the location of the device
I have the following problem: I have a Wintec WBT-202 GPS device which has
Have an app that can use tts to read text messages. It can also

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.