#Region Project Attributes
#ApplicationLabel: IrdaHelper
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
End Sub
Sub Globals
Dim button1,button2 As Button
Dim IrdaHelper1 As IrdaHelper
Dim sf As StringFunctions
End Sub
Sub Activity_Create(FirstTime As Boolean)
button1.Initialize("button1")
button2.Initialize("button2")
Activity.AddView(button1,0,0,100%x,100dip)
Activity.AddView(button2,0,150dip,100%x,100dip)
Dim Initialized As Boolean=IrdaHelper1.Initialize
If Initialized Then
Log("Able to transmit IR codes")
Select IrdaHelper1.GetIrdaHelperState
Case IrdaHelper1.STATE_CONSUMER_IR_MANAGER
Log("The ConsumerIrManager is initialized")
' you can get the instance of ConsumerIrManager using IrdaHelper1.GetConsumerIrManager
Case IrdaHelper1.STATE_IRDA_MANAGER
Log("The Samsung IrdaManager is initialized")
' you can get the instance of IrdaManager using IrdaHelper1.GetIrdaManager
Case IrdaHelper1.STATE_NOT_INITIALIZED
Log("Neither ConsumerIrManager or IrdaManager are initialized")
' this condition should not be met as IrdaHelper1.Initialize has returned True
End Select
Else
Log("Unable to transmit IR codes")
Log(IrdaHelper1.GetIrdaHelperState)
ToastMessageShow("no compatible",True)
ExitApplication
End If
End Sub
Sub Button1_Click
Log("send test")
fir4lolipop(38028,Array As Int(169,168,21,63,21,63,21,63,21,21,21,21,21,21,21,21,21,21,21,63,21,63,21,63,21,21,21,21,21,21,21,21,21,21,21,21,21,63,21,21,21,21,21,21,21,21,21,21,21,21,21,64,21,21,21,63,21,63,21,63,21,63,21,63,21,63,21,1794,169,168,21,21,21,3694))
End Sub
Sub Button2_Click
Log("send test")
fir4lolipop(38226,Array As Int(343,171,21,22,21,22,21,22,21,65,21,65,21,65,21,22,21,22,21,65,21,65,21,65,21,22,21,22,21,22,21,65,21,65,21,22,21,65,21,65,21,65,21,22,21,22,21,22,21,22,21,65,21,22,21,22,21,22,21,65,21,65,21,65,21,65,21,4892))
End Sub
Sub fir4lolipop(frecuencie As Int, pattern() As Int)
'calculate pulses
Dim pulses As Float
pulses= 1000000/frecuencie
Dim valor As Int
Dim list1 As List
list1.Initialize2(pattern)
For i=0 To list1.Size -1
valor=(list1.Get(i))*pulses
list1.Set(i,Bit.ToHexString(valor) )
Next
Dim stringhex As String = sf.ListToString(list1,False,False)
ToastMessageShow("send..." & stringhex,False)
IrdaHelper1.Transmit(IrdaHelper1.GetTransmitData3(stringhex, " "))
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub