Jump to content

dan27125

Members
  • Content Count

    8
  • Joined

  • Last visited

Community Reputation

0 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Reply to Roger Cigol << Ah! an idea - assuming you are building a 32 bit app: << Are you using the Borland "Classic" (aka - very old C++ standard) compiler? << menu: Project | Options | C++ Compiler - make sure the "use classic borland compiler" is set to "false" (this will then use the clang32 compiler. It's slower to build. I just checked and in fact found use classic Borland compiler was enabled. I turned it off. But the app wont build. So something needs to be fixed/changed. That switch was left on because when turned off, I get linker errors. I'm getting tons of compiler errors with it turned off. Its time for me to fix this. I'm using C++ When the app was created 9 years ago, it borrowed some old non VCL classic win32 code that was written using Borland C++ from 1996. I had some custom templates I made in the 1990s for safe win32 threads that use shared memory. I don't use it anymore. Also, this app is a bootloader server for a number of embedded cpus. 9 years ago There was allot of "paranoia" to keep everything on a byte in order and reuse code to have less things go wrong. From below link errors I can see there are old unwanted conditionals somewhere in the project file that I cant figure how to find and delete. For example Project | Options, Shared options vs non shared. And then you have to toggle between debug and non debug mode. I can see things in there that the IDE wont wont me to edit / remove. I need to clean up the project file. I wonder if it cab be edited as a text or an XML file. So I can root out old stuff. Ha ha "_USE_OLD_RW_STL" is a container from the 1990s and the classic. I don't need that anymore but I cant see where that is in the project file. bcc32c command line for "ttywin.cpp TFIFO.CPP W_IGS1.cpp thread.cpp netdef.cpp about.cpp debug.cpp ig-ini.cpp tcomport.cpp IGS-0.cpp TCP.cpp Tconfig1.cpp StyleDialog1.cpp ig2-ini.cpp InfoDialog1.cpp Config21.cpp vclstuff.cpp Base64Console1.cpp TINIFILE.CPP InverterConsole1.cpp tinverter.cpp zpanserver2.cpp mesgbox.cpp IGS-Base64.cpp zpanserver1.cpp VidFields.cpp zpanserver3.cpp W-IGS-2.cpp timespan.cpp WIFI_Console1.cpp Xmodem1.cpp vclthread.cpp ETRXList1.cpp Pic24HexFile.cpp em250_proto_ascii2.cpp InverterConsole_P24.cpp LLC_Temp.cpp DATETIME.CPP teui64.cpp WIFI_Console_EBL1.cpp HttpDownload1.cpp Update1.cpp tfirewall.cpp WIFI_Console_EBL2.cpp InverterConsole2.cpp tzigbee.cpp zpanserver4.cpp tinverter telemtry.cpp EthTcpGateway1.cpp REALTIME.CPP" c:\program files (x86)\embarcadero\studio\22.0\bin\bcc32c.exe -cc1 -D NDEBUG -D _USE_OLD_RW_STL -D TCP_IGS -D _USE_OLD_RW_STL -D Uses_2022_NID -D FRAMEWORK_VCL -output-dir ..\IG -I "c:\program files (x86)\embarcadero\studio\22.0\Lib" -I "c:\program files (x86)\embarcadero\studio\22.0\include" -I C:\PVKEY\PVKEY-DEV-6\IGS\2024-01-30\W-IGS-V253-03 -I "c:\program files (x86)\embarcadero\studio\22.0\include\windows\vcl" -isystem "c:\program files (x86)\embarcadero\studio\22.0\include" -isystem "c:\program files (x86)\embarcadero\studio\22.0\include\dinkumware64" -isystem "c:\program files (x86)\embarcadero\studio\22.0\include\windows\crtl" -isystem "c:\program files (x86)\embarcadero\studio\22.0\include\windows\sdk" -isystem "c:\program files (x86)\embarcadero\studio\22.0\include\windows\rtl" -isystem "c:\program files (x86)\embarcadero\studio\22.0\include\windows\vcl" -isystem "c:\program files (x86)\embarcadero\studio\22.0\include\windows\fmx" -isystem C:\Users\Public\Documents\Embarcadero\Studio\22.0\hpp\Win32 -isystem C:\Users\Public\Documents\Embarcadero\Studio\22.0\hpp\Win32 -fcxx-exceptions -fborland-extensions -nobuiltininc -nostdsysteminc -triple i686-pc-windows-omf -fpack-struct=1 -emit-obj -mrelocation-model static -masm-verbose -ffunction-sections -fexceptions -fseh -mstack-alignment=16 -fno-spell-checking -fno-use-cxa-atexit -fno-threadsafe-statics -x c++ -std=c++17 -O2 -O2 -fmath-errno -tM -tW --auto-dependency-output -tWM -wdef -wstl -wamp -wuse -Q -6 -wcln -Vx -a1 -wnod -wamb -wstu -wasm -r- -xp -k -Ve -r ttywin.cpp TFIFO.CPP W_IGS1.cpp thread.cpp netdef.cpp about.cpp debug.cpp ig-ini.cpp tcomport.cpp IGS-0.cpp TCP.cpp Tconfig1.cpp StyleDialog1.cpp ig2-ini.cpp InfoDialog1.cpp Config21.cpp vclstuff.cpp Base64Console1.cpp TINIFILE.CPP InverterConsole1.cpp tinverter.cpp zpanserver2.cpp mesgbox.cpp IGS-Base64.cpp zpanserver1.cpp VidFields.cpp zpanserver3.cpp W-IGS-2.cpp timespan.cpp WIFI_Console1.cpp Xmodem1.cpp vclthread.cpp ETRXList1.cpp Pic24HexFile.cpp em250_proto_ascii2.cpp InverterConsole_P24.cpp LLC_Temp.cpp DATETIME.CPP teui64.cpp WIFI_Console_EBL1.cpp HttpDownload1.cpp Update1.cpp tfirewall.cpp WIFI_Console_EBL2.cpp InverterConsole2.cpp tzigbee.cpp zpanserver4.cpp "tinverter telemtry.cpp" EthTcpGateway1.cpp REALTIME.CPP
  2. Good news. Thanks to your help I have it working. I also found a few other older posts from other people, including xml api syntax. This is a worker thread on a sleep timer using TIdHTTP and _di_IXMLDocument. This HTTP XML polling app "seems" to be working fine. But now I'd like to ask a few follow up questions. 1) I found some old indy documentation. IndyDocs_10.1.5.0_HtmlHelp Is that the latest Indy DOCS ? 2) Indy TIdHTTP class operator new and delete i.e Worker child thread construction and destruction. Is it OK use the new and delete operators with the TIdHTTP class ? Is new and delete operator like below OK ? void scope_use_example_TIdHTTP() { TIdHTTP *http = new TIdHTTP(NULL); delete http; } 3) XML API usage, scope. For TXMLDocument it looks like you can't / don't use C++ new/delete operators with TXMLDocument. Embarcadero is/was recently having some Radstudio web documentation problems being down or slow. I found some posts on this forum. It looks like for dynamic TXMLDocument such as a worker thread you use interface_cast like "_di_IXMLDocument xml = interface_cast<Xmlintf::IXMLDocument> (new TXMLDocument(NULL))" Trying to post a reply with code I'm getting *** Forbidden. Message seems to be spam. ***. So I'm going to put the code in a separate attachment as example1.cpp example1.cpp
  3. Indy TIdHTTP->Get UnicodeString trouble Can you teach me how to format an acceptable string to pass to TIdHTTP->Get() ? I'm working with Embarcadero C++Builder 11 trying to learn how to use Indy TIdHTTP->Get(). Attached are two examples. goodClick works but the URL is hard coded. badClick doesnt work. Looks maybe like I'm not properly formatting the URL string passed to TIdHTTP->Get(). The ip address is comming from a classic 8 bit ascii null terminated string like this "192.168.1.123". sprintf(urlAscii, "http://%s//ajax.xml",iniCfg.ethTcp_ip); I need to take the ip address from iniCfg.ethTcp_ip which is an (8 bit asci null terminated string) How can I fix the badClick example ? here is example code... Thanks for your time !! void __fastcall TEthTcpGateway::Button_goodClick(TObject *Sender) { try { // This example works fine String s = "http://192.168.1.123/ajax.xml"; //Use hard coded string UnicodeString url,us; url = "http://192.168.1.123/ajax.xml"; us = IdHTTP1->Get(url); AnsiString as = us; Memo1->Lines->Text = us; } catch (Exception &ex) { out << "Exception " << endl; } } //--------------------------------------------------------------------------- void __fastcall TEthTcpGateway::Button_badClick(TObject *Sender) { extern char ethTcp_ip[64]; // Null terminated 8 bit character buffer "192.168.1.123"; try { // This example does not work. char urlAscii[1000]; // ethTcp_ip has classic 8 bit ascii null terminated string like this "192.168.1.123"; sprintf(urlAscii, "http://%s/ajax.xml",ethTcp_ip); String s = urlAscii; UnicodeString url,us; url = s; // Copy from String us = IdHTTP1->Get(url); AnsiString as = us; out << "Response" << endl << as.c_str() << endl; Memo1->Lines->Text = us; } catch (Exception &ex) { out << "Exception " << endl; } }
  4. Remy ...Good news ... I made a test function on a button to pole once that works. It uses IdHTTP and XMLDocument. Ok now can you direct me on the "VCL thread safe" way to create a child thread that always runs in the background? Puts the results in thread safe container class (stdlist ?) for the apps main thread to pole and process? I know how to write non VCL classic win32 thread safe code so one thread waits for event then puts the results in a shared buffer. I have my own derived stdlist template that adds a windows critical section semaphore to block during the moment of insert and delete However that was how things were done 20 years ago. What I don't know is how to be "thread safe" from within the VCL. Furthermore I want to learn to write C++ Builder code style that might be portable to other platforms. What is the proper way for a VCL main thread to create a child thread and then later on if necessary how does the main thread terminate the child thread if it is still running? Any links or tips to help me learn would be appreciated. I'd like to follow these learning examples but I'm getting an error when trying to include thread and mutex as follows #include <thread> #include <mutex> I'm using Embarcadero® C++Builder 11 Version 28.0.48361.3236. I have a subscription and can update it if necessary... What silly thing am I doing wrong that I cant include thread or mutex in these examples ? https://learncplusplus.org/what-is-a-data-race-in-multi-threading-c-apps-and-how-to-avoid-it/ https://blogs.embarcadero.com/learn-powerful-multi-threading-operations-with-c-builder/I Also... below is a paste of the sample working code that collects the data from the zigbee gateway. void __fastcall TForm1::Button1Click(TObject *Sender) { String s = "http://192.168.1.123/ajax.xml"; UnicodeString us = IdHTTP1->Get(s); XMLDocument1->LoadFromXML(us); const _di_IXMLNode resp = XMLDocument1->ChildNodes->FindNode("response"); if (resp == NULL) { Memo1->Lines->Text = "Response Null"; return; } const _di_IXMLNode zigbeeData = resp->ChildNodes->FindNode("zigbeeData"); if (zigbeeData!=NULL) { String s; s = zigbeeData->Text; s += "SUCCESS\n"; Memo1->Lines->Text = s; } }
  5. Update: I'm the person that posted this. I'm not sure how to update my post so I'm replying to myself for now.... I just initially learned about the existence of the Rest API and Rest Debugger. I tried using the Rad Studio Rest Debugger. I put in the local URL (the same you plug into a browser to view the data). I ran execute and gets back some information. It doesn't display the data. It doesn't seem to be in json format. Obviously I'm new to using Rest and this Rest Debugger. Maybe I'm not using the right way? Maybe someone with more experience could look at the two files I uploaded ajax.xml and debug.htm? Tell me what format the data is? From a web browser It appears as a scrolling window. I wonder if the web browser as a debug or information window that will tell me about the format being sent and displayed?
  6. Greetings from St Louis, Missouri USA I'm using and learning C++ Builder 11 professional. I want to make a windows app that displays telemetry data from a zigbee gateway on the local internal subnet. It sends periodic telemetry base64 data via (I'm guessing...) jason/ajax. The zigbee gateway has a web page "http://" + ip + "/debug.html" that displayes the zigbeeData in a scrolling window. That scrolling windows is the only data that I want to to capture. I'm wondering if there are a few drop in components I can use to setup / collect json/ajax pairs from a web server on the local subnet ? What is the easiest way to setup a pipe to collect this (presumably JSON) zigbeeData ? What Rad Studio components should I look for ? I know how to process the base64 data. I wrote the embedded zigbee code which does that part. This "zigbee gateway" I have all the source code for it. Its a microchip ethernet gateway with a mini TCP stack. Its handing it off to a mini web server that I did not write. Attached is ajax.xml, debug.html (what I did not write) and a picture of a web browser displaying the base64 strings in a scrolling window. I just need help with how to use C++ Builder 11 professional to it collect it from "http://" + ip + "/debug.html" I'm a C/C++ software engineer with many years experience doing low level C/C++ programing. I've been using Borland,Inprise,Radstudio C++ for high level programming and then lots of embedded compilers for embdedded apps. I'm very familar with TCP and berkley sockets. I don't know much about Web gets, puts, json or java. I presume some sort of layer uses a TCP port to send/receive packets. I know how to find the local IP address of the gateway using Dns GetHostName API. I presume the IP will be "pluged" in to something. Hopefully a RAD Studio component that I drop on a form, define the json fields/pairs and then set the ip address. Do you have any suggestions, tips recommendations ? Best regards Dan ajax.xml debug.htm
  7. dan27125

    sort project files in alphabetical order

    OK I Found it. Here is a picture…It Works !!!
  8. Hi, I'm new here. I'm new to joining forums for C++ Builder Rad Studio. The Embarcadero web site https://blogs.embarcadero.com/community/ list this forum 1st. The Delphi and C++ IDEs and VCL are very similar. Not sure if C++ questions are welcome here. I'm using C++ Builder Rad Studio 11, Update 3. Is there a way to trigger the IDE to sort the project files in alphabetical order? I have wasted allot of time manually sorting the project files. When I add new units they always appear at the bottom i.e. not in alphabet order. Does the IDE have a setting or feature that will trigger a sort on the project files ? Best regards, Dan C/C++ Software engineer St Louis, Missouri USA
×