Thanks for that post ivan.tellez I found a app that utilizes the temperature sensor, barometric sensor, and the humidity sensor on the 4S. I wish there were some libraries for those.
Initialize AsBoolean Initialize the IrdaManager.
Returns True if successfully initialized, otherwise False.
If initialization fails the B4A LastException property will contain the related Exception.
IsInitialized AsBoolean Returns whether or not the IrdaManager is initialized.
WriteIrSend (Data AsString)AsBoolean Sends Data using the IrdaManager.
Returns True if successfully sent, otherwise False.
If send fails the B4A LastException property will contain the related Exception.
This is GREAT work ! I was able to trigger, using your code, from my Galaxy Tablet. I'm working on the conversion of the codes from Hex to Dec and I'm good with everything except the very first value.
I figured it out after looking at the other source... Not terrible obvious but we'll see if it works tomorrow !
Sub hex2dec(irData As String)As String
Dim sparts() As String
Dim MyList As List
Dim frequency As Int
Dim i As Int
sparts = Regex.Split(" ", irData)
MyList.Initialize()
For i = 0 To sparts.Length -1
MyList.Add(sparts(i))
Next
MyList.removeat(0) 'dummy
frequency = Bit.ParseInt(MyList.Get(0),16)
MyList.removeat(0)
MyList.removeat(0) ' seq1
MyList.removeat(0) ' seq2
For i = 0 To MyList.Size -1
MyList.Set(i, Bit.ParseInt(MyList.get(i), 16))
Next
frequency = (1000000 / (frequency * 0.241246))
MyList.InsertAt(0, frequency)
irData = ""
For i = 0 To MyList.Size -1
irData = irData & MyList.Get(i)
If i < MyList.Size -1 Then irData = irData & ","
Next
Log(irData)
Return irData
End Sub
But, the real interesting part, would be to parse lirc config files in B4A and output a string to use with the Samsung IR
I was just about to upload a library update with a new Hex2Dec method but shall upload it anyway.
IrdaManager Version: 0.02
IrdaManager Methods:
Hex2Dec (HexData AsString, Separator AsString)AsString 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 AsBoolean Initialize the IrdaManager.
Returns True if successfully initialized, otherwise False.
If initialization fails the B4A LastException property will contain the related Exception.
IsInitialized AsBoolean Returns whether or not the IrdaManager is initialized.
WriteIrSend (DecimalData AsString)AsBoolean Sends Data using the IrdaManager.
Returns True if successfully sent, otherwise False.
If send fails the B4A LastException property will contain the related Exception.
And a b4a example:
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
Strangely enough this example runs on my Galaxy Tab2!
The IrdaManager Initialize and WriteIrSend methods both return True.
Maybe Samsung include the IrdaManager API in all of their firmwares regardless of whether the device has the required IR hardware?
I don't have time to look at the Lirc stuff now, i'll try and find time later to have a look.
This question is not really related to this thread.
Basic4android requires .Net Framework 2 or above. On Vista or above it is already preinstalled.
512mb of ram are required.
I'm running the demo on the Galaxy 10.x Tab 2 (which, atleast in the US) has the IR Blaster... Also, the newly announced S4 Active and Mini BOTH claim to have the IR Blaster....