0

First off, I am new into this kind of development in C++ Builder, so I am looking for the best way to accomplish a task in C++ Builder XE8. Basically, I am going to have one firemonkey GUI application pushing updates to a sqlite database (please advise if there is a better alternative) and another firemonkey application (basically a background service) that is going to be interfacing between it and some custom made hardware. So, my question is, what is the fastest, most "live action" way to communicate that the database has been updated. Event handlers? I don't want to use a timer that just refreshes the livebindings every 100ms as that seems to be expensive. Keep in mind, this is going to be running on Android, iOS and Windows devices. Some of them may be underpowered. There is really no need for security or encryption for the communication.

My ideas are now is the original application will push updates as needed to the sqlite database, which is just a file on the disk. The interfacing firemonkey application will need to know when these updates have happened either by an event listener, or from what I have read, these RTL messages that are multiplatform. The idea is to have the fastest communication with the lowest amount of memory footprint. I am not sure how we are handling the hardware yet, but for right now, I just need to get point A to point B and I will worry about Point C (the hardware) later. So any advice on making the interfacing application listen for database updates from the original GUI application would be great. I have also read their is a file listener that you can check to see if the file is updated?

Steven Carlson
  • 925
  • 1
  • 10
  • 25

1 Answers1

1

I'm not sure that I completely understand what you are trying to accomplish, but I'll answer the best that I can.

Since you control both ends of the system, I would not try to figure out when the database changes, but instead just notify all the apps when a change is written. Let me explain.

You have a main app that handles all the writes to the database. When it goes to write to the database, have it also send a notification to all other connected apps. Since it is the one updating the database that is the best way to do it.

The easiest and also very light way to handle the communication is App Tethering: Overview video and Documentation. Here is a CodeRage session on using App Tethering with connecting hardware (IoT) and another session on App Tethering in general.

There is a Skill Sprint on App Tethering with Encryption next week too (I know you don't need Encryption, but still might be a good place to ask questions).

Also, InterBase XE7 introduced change change views which makes it really easy for an app to see what changed in the database since last time.

Jim McKeeth
  • 38,225
  • 23
  • 120
  • 194