Page 1 of 1

Vb.net troubleshottiing

PostPosted: Mon Oct 10, 2005 8:02 pm
by Olivier
Hello :)

i made a vb.net applicaiton that works fine to transmit IR codes.
However, when i learn codes, application bugs just after raising LearnCompleted event.... (at 90%)... however, it gets the correct ir code :(

Could i please send my code to anyone to get some help ?

thanks in advance ;)

PostPosted: Mon Oct 10, 2005 8:04 pm
by Guest
Public Class cls_usbuirt

Private mc As Controller 'var pour l'usb uirt
Private args As LearnCompletedEventArgs = Nothing 'arguments récup lors de l'apprentissage
Private code_format As CodeFormat = CodeFormat.Pronto
Private learn_code_modifier As LearnCodeModifier = LearnCodeModifier.None

'constructor
Public Sub New()

'cree l'objet pour usbuirt
Me.mc = New Controller

'capte les events
AddHandler mc.Received, AddressOf handler_mc_received

End Sub

'**********************************************************
'boucle qui attend kon recoive
Public Function wait_for_code() As String

'handler
AddHandler mc.Learning, AddressOf handler_mc_learning
AddHandler mc.LearnCompleted, AddressOf handler_mc_learning_completed

'lance l'apprentissage
Try
Try
Me.mc.LearnAsync(Me.code_format, Me.learn_code_modifier, Me.args)
Catch ex As Exception
Debug.WriteLine("##### Erreur: " & ex.Message)
Return "Err"
End Try

'attend que ce soit appris
Do While IsNothing(Me.args)
Application.DoEvents()
Loop

'c appris !!!
RemoveHandler mc.Learning, AddressOf handler_mc_learning
RemoveHandler mc.LearnCompleted, AddressOf handler_mc_learning_completed
Catch ex As Exception
Debug.WriteLine("##Erreur ####")
Return "Err"
End Try


'retourne le code
Return Me.args.Code

End Function

'*****************************************************************************
'handler en apprentissage
Private Sub handler_mc_learning(ByVal sender As Object, ByVal e As LearningEventArgs)
Try

Debug.WriteLine("Learning: " & e.Progress & " freq=" & e.CarrierFrequency & " quality=" & e.SignalQuality)
Catch ex As Exception
Debug.WriteLine("Aahhhhhhhhhhhhhhhhhhh")
End Try
End Sub

'*****************************************************************************
'handler a appris
Private Sub handler_mc_learning_completed(ByVal sender As Object, ByVal e As LearnCompletedEventArgs)
args = e
Debug.WriteLine("Learning completed: " & e.Code)
End Sub

End Class

PostPosted: Mon Oct 10, 2005 11:32 pm
by jrhees
The code appears fine to me. I will have to try compiling it and see if I can see anything. I have very similar code, with the difference that I do not Writeln and I do not have LearnAsync inside any Try's.

-Jon

PostPosted: Tue Oct 11, 2005 8:55 am
by Olivier
I'll post my vb project on a web site on the evening for u to test it
thanks for ur help

PostPosted: Tue Oct 11, 2005 4:36 pm
by Olivier
Here is a zip of my project:
http://snort.free.fr/usbuirt/testusbuirt1.zip

A few information:
- Testapp project provided with .net wrapper works correctly
- COnfig: win2k sp2, vs2003
- My program bugs after 100% learning

help !!!!