The IrdaManager library is exclusively for use with Samsung devices.
It exposes the hidden Samsung IrdaManager system servcie, enabling you to use the device's IR transmitter to send IR codes.
For more info take a look at this thread: http://www.b4x.com/forum/basic4android-updates-questions/29902-what-hardware-does-b4a-support.html
IrdaManager
Version: 0.02
Here's a simple example showage usage syntax:
As you can see the WriteIrSend (DecimalData As String) As Boolean method accepts a String and this String should be a decimal IR code sequence.
If you get a code from somewhere that is a hexadecimal IR sequence then you will need to use the Hex2Dec (HexData As String, Separator As String) As String method to convert the hex sequence to a decimal sequence suitable for use with WriteIrSend.
The library files, example project and library source code are attached.
Martin.
It exposes the hidden Samsung IrdaManager system servcie, enabling you to use the device's IR transmitter to send IR codes.
For more info take a look at this thread: http://www.b4x.com/forum/basic4android-updates-questions/29902-what-hardware-does-b4a-support.html
IrdaManager
Version: 0.02
- IrdaManager
Methods:- Hex2Dec (HexData As String, Separator As String) As String
Converts a String of Hex IR codes into a String of comma separated decimal codes suitable for use with WriteIrSend.
Separator denotes the separator character used in the HexData input. - Initialize As Boolean
Initialize the IrdaManager.
Returns True if successfully initialized, otherwise False.
If initialization fails the B4A LastException property will contain the related Exception. - IsInitialized As Boolean
Returns whether or not the IrdaManager is initialized. - WriteIrSend (DecimalData As String) As Boolean
Sends Data using the IrdaManager.
Returns True if successfully sent, otherwise False.
If send fails the B4A LastException property will contain the related Exception.
- Hex2Dec (HexData As String, Separator As String) As String
Here's a simple example showage usage syntax:
B4X:
Sub Process_Globals
End Sub
Sub Globals
Dim IrdaManager1 As IrdaManager
End Sub
Sub Activity_Create(FirstTime As Boolean)
If IrdaManager1.Initialize Then
Log("IrdaManager successfully initialized")
Dim HexData As String="0000 006d 0022 0003 00a9 00a8 0015 003f 0015 003f 0015 003f 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 003f 0015 003f 0015 003f 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 003f 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0040 0015 0015 0015 003f 0015 003f 0015 003f 0015 003f 0015 003f 0015 003f 0015 0702 00a9 00a8 0015 0015 0015 0e6e"
Dim DecData As String=IrdaManager1.Hex2Dec(HexData, " ")
Log("DecData: "&DecData)
If IrdaManager1.WriteIrSend(DecData) Then
Log("WriteIrSend succeeded")
Else
Log("WriteIrSend failed: "&LastException)
End If
Else
Log("Failed to initialize the IrdaManager: "&LastException)
End If
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
As you can see the WriteIrSend (DecimalData As String) As Boolean method accepts a String and this String should be a decimal IR code sequence.
If you get a code from somewhere that is a hexadecimal IR sequence then you will need to use the Hex2Dec (HexData As String, Separator As String) As String method to convert the hex sequence to a decimal sequence suitable for use with WriteIrSend.
The library files, example project and library source code are attached.
Martin.