more G-Labs products

Author Topic: Debug logging  (Read 1302 times)

February 24, 2015, 07:54:37 AM
Read 1302 times

ocalvo

  • *
  • Information
  • Newbie
  • Posts: 10
I am struggling to get Insteon working. I have turned on logging but the generated logs does not have usefull data.

Is there a "debug level" I can turn on?

Thanks,

Oscar

February 24, 2015, 12:38:19 PM
Reply #1

nolio

  • *****
  • Information
  • Global Moderator
  • Posts: 544
You can launch HG program in command line from the HG directory.

February 24, 2015, 02:58:50 PM
Reply #2

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Hi ocalvo,

the best option to debug is doing it from source code.
To see why your modules aren't listed add a break point here:

https://github.com/genielabs/HomeGenie/blob/master/MigFiles/MIG/Interfaces/HomeAutomation/Insteon.cs#L176

If then you get familiar with debugging and hg, perhaps you can help adding missing code for handling incoming insteon events:

https://github.com/genielabs/HomeGenie/blob/master/MigFiles/MIG/Interfaces/HomeAutomation/Insteon.cs#L237

Cheers,
g.

February 25, 2015, 07:49:39 AM
Reply #3

ocalvo

  • *
  • Information
  • Newbie
  • Posts: 10
I am getting this output from console:
PLM ERROR: Access to the port 'COM3' is denied.
PLM ERROR: Object reference not set to an instance of an object.
PLM ERROR: Access to the port 'COM3' is denied.
PLM ERROR: Access to the port 'COM3' is denied.
PLM ERROR: Access to the port 'COM3' is denied.
PLM ERROR: Access to the port 'COM3' is denied.


My little test program works fine. Dont know why HomeGenie does not have access to it.

February 25, 2015, 08:54:00 AM
Reply #4

ocalvo

  • *
  • Information
  • Newbie
  • Posts: 10
I debug a little more:

The Disconnect method is calling Thread.Abort(). If the Plm was inside the Receive method, this will render the COM port opened and the program itself will no longer be able to connect

In general calling Thread.Abort should NEVER be called. Instead I propose that you start a new Task using Task.Start and pass a cancellation token. When Disconnect is called, then call CancellationTokenSource.Cancel to cancel the task gracefully.

I can provide a fix for this. Will try to submit a push request later.