So, if you have a device (such as my Samsung S4 Mini with Android OS KitKat) that supports an InfraRed Blaster and you are a subscriber to Multichoice's DSTV (with an enabled PVR) then you can use the attached project to control your DSTV PVR decoder. MultiChoice covers some of the African regions with its services.
I have added no designer code to position any of the buttons/images - you can do so if you want.
The attached library files wraps this Gitgub project with some modifications to it that comes from this pull request.
My Samsung S4 Mini controls my DSTV PVR decoder 100%. The kids can now break or lose the original remote - not a problem any longer.
Posting the following:
1. B4A sample project
2. B4A library files
3. LibRes.zip - download it, extract it, and the copy folder LibRes and it's contents to be on the same folder level as that of the /Files and /Objects folders of the B4A project.
Take note of the B4A Manifest file.
The library will add the following permission to the manifest:
Sample Code:
Library:
DSTV_Remote
Author: Github: Jordan (fishjord), Wrapped by: Johan Schoeman
Version: 1
As long as what your device supports an IR blaster I am sure that the project can be modified / amended to support other appliances (such as air conditioners) by changing the code in remotes.xml that is located in the /LibRes/xml folder of the attached B4A project
I have added no designer code to position any of the buttons/images - you can do so if you want.
The attached library files wraps this Gitgub project with some modifications to it that comes from this pull request.
My Samsung S4 Mini controls my DSTV PVR decoder 100%. The kids can now break or lose the original remote - not a problem any longer.
Posting the following:
1. B4A sample project
2. B4A library files
3. LibRes.zip - download it, extract it, and the copy folder LibRes and it's contents to be on the same folder level as that of the /Files and /Objects folders of the B4A project.
Take note of the B4A Manifest file.
The library will add the following permission to the manifest:
B4X:
@Permissions(values={"android.permission.TRANSMIT_IR"})
Sample Code:
B4X:
#Region Project Attributes
#ApplicationLabel: b4aDSTV_Remote
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: portrait
#CanInstallToExternalStorage: False
#End Region
#AdditionalRes: ..\LibRes
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private dstv As DSTV_Remote_Embedded
Private btnPower As ImageView
Private btnVolumeUp As ImageView
Private btnVolumeDown As ImageView
Private btnChannelUp As ImageView
Private btnChannelDown As ImageView
Private btnMute As ImageView
Private btnInfo As ImageView
Private btnExit As ImageView
Private btnZero As Button
Private btnOne As Button
Private btnTwo As Button
Private btnThree As Button
Private btnFour As Button
Private btnFive As Button
Private bntSix As Button
Private btnSeven As Button
Private btnEight As Button
Private bntNine As Button
Private btnTVGuide As Button
Private btnOK As Button
Private BtnAudio As Button
Private btnLanguage As Button
Private btnMenu As Button
Private btnUp As Button
Private btnDown As Button
Private btnLeft As Button
Private btnRight As Button
Private btnTV As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("main")
dstv.Initialize("")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub btnPower_Click
dstv.SendCommand(0)
End Sub
Sub btnVolumeUp_Click
dstv.SendCommand(1)
End Sub
Sub btnVolumeDown_Click
dstv.SendCommand(2)
End Sub
Sub btnChannelUp_Click
dstv.SendCommand(14)
End Sub
Sub btnChannelDown_Click
dstv.SendCommand(15)
End Sub
Sub btnMute_Click
dstv.SendCommand(4)
End Sub
Sub btnInfo_Click
dstv.SendCommand(16)
End Sub
Sub btnExit_Click
dstv.SendCommand(10)
End Sub
Sub btnZero_Click
dstv.SendCommand(19)
End Sub
Sub btnOne_Click
dstv.SendCommand(20)
End Sub
Sub btnTwo_Click
dstv.SendCommand(21)
End Sub
Sub btnThree_Click
dstv.SendCommand(22)
End Sub
Sub btnFour_Click
dstv.SendCommand(23)
End Sub
Sub btnFive_Click
dstv.SendCommand(24)
End Sub
Sub bntSix_Click
dstv.SendCommand(25)
End Sub
Sub btnSeven_Click
dstv.SendCommand(26)
End Sub
Sub btnEight_Click
dstv.SendCommand(27)
End Sub
Sub bntNine_Click
dstv.SendCommand(28)
End Sub
Sub btnTVGuide_Click
dstv.SendCommand(29)
End Sub
Sub btnOK_Click
dstv.SendCommand(30)
End Sub
Sub BtnAudio_Click
dstv.SendCommand(31)
End Sub
Sub btnLanguage_Click
dstv.SendCommand(32)
End Sub
Sub btnMenu_Click
dstv.SendCommand(9)
End Sub
Sub btnUp_Click
dstv.SendCommand(33)
End Sub
Sub btnDown_Click
dstv.SendCommand(34)
End Sub
Sub btnLeft_Click
dstv.SendCommand(35)
End Sub
Sub btnRight_Click
dstv.SendCommand(36)
End Sub
Sub btnTV_Click
dstv.SendCommand(37)
End Sub
Library:
DSTV_Remote
Author: Github: Jordan (fishjord), Wrapped by: Johan Schoeman
Version: 1
- DSTV_Remote_Embedded
Methods:- Initialize (paramString As String)
- SendCommand (id As Int)
- updateSelectedManufacturer (manny As String)
- android.permission.TRANSMIT_IR
As long as what your device supports an IR blaster I am sure that the project can be modified / amended to support other appliances (such as air conditioners) by changing the code in remotes.xml that is located in the /LibRes/xml folder of the attached B4A project
Attachments
Last edited: