-
Feb 3rd, 2018, 03:29 PM
#1
Thread Starter
Lively Member
[RESOLVED] App loading issue
Dear guys!!
Again stuck!!
So here it is: I have an app that needs to communicate with 2 Serial ports. And the info (COMa,COMb) comes from a config file, which COM port is for what purpose. The reason is to make a universal app, so depending on PC to PC, it will run simply.
What I did:
1) there is a conf file which already keeps the info (as I know).
2) the app loads the info and initiates a connection [serial.open].
3) The p continues to do its work.
Now, it has a config window that it uses for config settings.
Where I'm stuck:
1) If there is no conf file/if there is no info in file (say fresh install) then it fails to load at all [means i need some exception handling to pass it away.]
2) If the COM ports are not available in real, then the app is getting hang, and there I again need another exception handling to pass it away.
Last Note: I prefer to pass it away as then I can enter into the config window for config and that will eventually generate the conf file.
Ideas??
Mishu~
-
Feb 3rd, 2018, 03:49 PM
#2
Frenzied Member
Re: App loading issue
You can check the configuration file for default values before initializing the com ports.
-
Feb 5th, 2018, 10:10 AM
#3
Thread Starter
Lively Member
Re: App loading issue
Originally Posted by aashish_9601
You can check the configuration file for default values before initializing the com ports.
Putting the default values is not a big deal and already done that. But say, if default val is COM1 and COM2 but in practical, they are not available, then app is not working, the splashscreen is UP and then main window is not coming. I want is, say if default value is not helping to connect the COM port, then it should just avoid and do nothing or it can put me to the conf window. Now it's just "hang" and doing nothing.
some exception handling type of thing...
-
Feb 5th, 2018, 10:29 AM
#4
Re: App loading issue
I haven't check that but I do not see why it souldn't have the needed data:
You can use WMI to check the available COM ports and compare them to the config ports.
If they are not there then, do something.
This can be done once when the application install and write the ports somewhere in a config file, so it does not have to run WMI check every time. If some hardware is changed then, yes you will get an exception, then you will have to use WMI once more and get the new ports and write them somewhere for future usage.
ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·
-
Feb 6th, 2018, 02:41 PM
#5
Thread Starter
Lively Member
Re: App loading issue
Originally Posted by sapator
I haven't check that but I do not see why it souldn't have the needed data:
You can use WMI to check the available COM ports and compare them to the config ports.
If they are not there then, do something.
This can be done once when the application install and write the ports somewhere in a config file, so it does not have to run WMI check every time. If some hardware is changed then, yes you will get an exception, then you will have to use WMI once more and get the new ports and write them somewhere for future usage.
How to make a conf file during the install time?? I dont know that...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|