[GB.DBUS]

* BUG: Add debugging message to the GetAll() DBus method implementation.

git-svn-id: svn://localhost/gambas/trunk@7943 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2016-10-29 22:43:30 +00:00
parent 63bc9c7314
commit 724270e57b
3 changed files with 233 additions and 4 deletions

View file

@ -470,6 +470,7 @@ Private Sub GetAllProperties()
Dim sProp As String
Dim vVal As Variant
Dim hObs As DBusObserver
Dim bComma As Boolean
hObs = $hObserver
@ -479,7 +480,7 @@ Private Sub GetAllProperties()
hClass = Object.Class(Me)
'Debug "["
'Debug "[";; System.Backtrace.Join(" ")
For Each sSymbol In hClass.Symbols
@ -496,7 +497,7 @@ Private Sub GetAllProperties()
sPrefix = ""
Next
Endif
sProp = Mid$(sSymbol, Len(sPrefix) + 1)
If InStr(sProp, "_") Then Continue
@ -504,6 +505,8 @@ Private Sub GetAllProperties()
If sInterface <> sWantInterface Then Continue
'Debug sSymbol; " @ "; sInterface
vVal = Object.GetProperty(Me, sSymbol)
If IsNull(vVal) Then
If TypeOf(vVal) = gb.String Then
@ -520,13 +523,26 @@ Private Sub GetAllProperties()
'Debug "]"
If DBus.Debug Then
Error "gb.dbus: GetAll("; Quote(sWantInterface); "): [";
For Each vVal In cVal
If bComma Then
Error ", ";
Else
bComma = True
Endif
Error Quote(cVal.Key); ": "; vVal;
Next
Error "]"
Endif
hObs.Reply("a{sv}", [cVal])
End With
Catch
If DBus.Debug Then Error "gb.dbus: org.freedesktop.Properties.GetAll: error: "; Error.Text;; Error.Backtrace.Join(" ")
If DBus.Debug Then Error "gb.dbus: error: org.freedesktop.Properties.GetAll: "; Error.Text;; Error.Backtrace.Join(" ")
hObs.Error(Error.Text)
End

View file

@ -1,6 +1,6 @@
' Gambas module file
Public Sub Main()
Public Sub Main2()
Dim aVal As Variant[]
Dim hSignal As DBusSignal
@ -120,3 +120,11 @@ End
' DBus["org.kde.StatusNotifierItem-3527-1"]["/StatusNotifierItem", "org.kde.StatusNotifierItem"].ContextMenu(0, 0)
'
' End
Public Sub Main()
DBus.Debug = True
DBus.Name = "org.mpris.MediaPlayer2.xt7"
DBus.Session.Register(mpris, "/org/mpris/MediaPlayer2", ["org.mpris.MediaPlayer2", "org.mpris.MediaPlayer2.Player", "org.mpris.MediaPlayer2.TrackList", "org.mpris.MediaPlayer2.Playlists", "org.freedesktop.Dbus.Properties", "org.freedesktop.Dbus.Introspectable"])
End

View file

@ -0,0 +1,205 @@
' Gambas class file
'
Inherits DBusObject
Create Static
''org.freedesktop.Dbus.Introspectable-------------------------------------------------------------------------------------------------------------
'
' Public Function org_freedesktop_Dbus_Introspectable_Introspect() As String
' Return "NULL"
' End
'
' ''org.freedesktop.Dbus.Properties-----------------------------------------------------------------------------------------------------------------
' Public Function org_freedesktop_Dbus_Properties_Get(Myinterface As String, MyProperty As String) As String
' Return "NULL"
' End
' Public Function org_freedesktop_Dbus_Properties_Set(Myinterface As String, MyProperty As String) As String
' Return "NULL"
' End
' Public Function org_freedesktop_Dbus_Properties_GetAll(Myinterface As String, MyProperty As String) As String[]
' Return "NULL"
' End
''ORG.MPRIS.MEDIAPLAYER2-----------------------------------------------------------------------------------------------------------------
Property Read org_mpris_MediaPlayer2_CanQuit As Boolean
Property Read org_mpris_MediaPlayer2_CanRaise As Boolean
Property Read org_mpris_MediaPlayer2_HasTrackList As Boolean
Property Read org_mpris_MediaPlayer2_Identity As String
Property Read org_mpris_MediaPlayer2_DesktopEntry As String 'opzionale
Property Read org_mpris_MediaPlayer2_SupportedUriSchemes As String[]
Property Read org_mpris_MediaPlayer2_SupportedMimeTypes As String[]
Function org_mpris_MediaPlayer2_CanQuit_Read() As Boolean
Return True
End
Function org_mpris_MediaPlayer2_CanRaise_Read() As Boolean
Return True
End
Function org_mpris_MediaPlayer2_HasTrackList_Read() As Boolean
Return True
End
Function org_mpris_MediaPlayer2_Identity_Read() As String
Return "xt7-player"
End
Function org_mpris_MediaPlayer2_DesktopEntry_Read() As String
Return "xt7-player"
End
Function org_mpris_MediaPlayer2_SupportedUriSchemes_Read() As String[]
Return ["file", "http"]
End
Function org_mpris_MediaPlayer2_SupportedMimeTypes_Read() As String[]
Return ["application/ogg", "application/x-ogg", "application/x-ogm-audio", "audio/aac", "audio/mp4", "audio/mpeg", "audio/mpegurl", "audio/ogg", "audio/vnd.rn-realaudio", "audio/vorbis", "audio/x-flac", "audio/x-mp3", "audio/x-mpeg", "audio/x-mpegurl", "audio/x-ms-wma", "audio/x-musepack", "audio/x-oggflac", "audio/x-pn-realaudio", "audio/x-scpls", "audio/x-speex", "audio/x-vorbis", "audio/x-vorbis+ogg", "audio/x-wav", "video/x-ms-asf", "x-content/audio-player"]
End
Public Function org_mpris_MediaPlayer2_Raise()
'FMain.raise
End
Public Function org_mpris_MediaPlayer2_Quit()
'we cannot just quit the application, because it would unregister
'dbus before we exit this kifunction, leading to a runtime error
'so use a timer to program a delayed quit.
'FMain.TimerQuit.start
End
''ORG.MPRIS.MEDIAPLAYER2.PLAYER-----------------------------------------------------------------------------------------------------------------
Property Read org_mpris_MediaPlayer2_Player_PlaybackStatus As String
Property org_mpris_MediaPlayer2_Player_LoopStatus As String
Property org_mpris_MediaPlayer2_Player_Rate As Float
Property org_mpris_MediaPlayer2_Player_Shuffle As Boolean
Property Read org_mpris_MediaPlayer2_Player_Metadata As String[] 'controllare bene il tipo di dato
Property org_mpris_MediaPlayer2_Player_Volume As Float
Property Read org_mpris_MediaPlayer2_Player_Position As Long
Property Read org_mpris_MediaPlayer2_Player_MinimumRate As Float
Property Read org_mpris_MediaPlayer2_Player_MaximumRate As Float
Property Read org_mpris_MediaPlayer2_Player_CanGoNext As Boolean
Property Read org_mpris_MediaPlayer2_Player_CanGoPrevious As Boolean
Property Read org_mpris_MediaPlayer2_Player_CanPlay As Boolean
Property Read org_mpris_MediaPlayer2_Player_CanPause As Boolean
Property Read org_mpris_MediaPlayer2_Player_CanSeek As Boolean
Property Read org_mpris_MediaPlayer2_Player_CanControl As Boolean
Function org_mpris_MediaPlayer2_Player_PlayBackStatus_Read() As String
End
Function org_mpris_MediaPlayer2_Player_LoopStatus_Read() As String
'If FMain.TogglePls.value Then
Return "Playlist"
'Else
'Return "None"
'Endif
End
Function org_mpris_MediaPlayer2_Player_LoopStatus_Write(p As String)
'FMain.TogglePls.value = (p = "Playlist")
End
Function org_mpris_MediaPlayer2_Player_Rate_Read() As Float
End
Function org_mpris_MediaPlayer2_Player_Rate_Write(p As Float)
End
Function org_mpris_MediaPlayer2_Player_Shuffle_Read() As Boolean
'Return FMain.ShufflePls.value
End
Function org_mpris_MediaPlayer2_Player_Shuffle_Write(p As Boolean)
'FMain.ShufflePls.value = p
End
Function org_mpris_MediaPlayer2_Player_Metadata_Read() As String[]
End
Function org_mpris_MediaPlayer2_Player_Volume_Read() As Float
'Return (FMain.SaveVolumeSlider.value * (100 Div FMain.SaveVolumeSlider.MaxValue))
End
Function org_mpris_MediaPlayer2_Player_Volume_Write(p As Float)
' If p <= 0 Then
' FMain.volume_set("0")
' Else
' FMain.volume_set(CStr(p * 100))
' Endif
End
Function org_mpris_MediaPlayer2_Player_Position_Read() As Long
End
Function org_mpris_MediaPlayer2_Player_Position_Write() As Long
End
Function org_mpris_MediaPlayer2_Player_MinimumRate_Read() As Float
End
Function org_mpris_MediaPlayer2_Player_MaximumRate_Read() As Float
End
Function org_mpris_MediaPlayer2_Player_CanGoNext_Read() As Boolean
End
Function org_mpris_MediaPlayer2_Player_CanGoPrevious_Read() As Boolean
End
Function org_mpris_MediaPlayer2_Player_CanPlay_Read() As Boolean
End
Function org_mpris_MediaPlayer2_Player_CanPause_Read() As Boolean
End
Function org_mpris_MediaPlayer2_Player_CanSeek_Read() As Boolean
End
Function org_mpris_MediaPlayer2_Player_CanControl_Read() As Boolean
End
Public Function org_mpris_MediaPlayer2_Player_Next()
'FMain.SelectNext(False, FMain.GetActivePlayQueue())
End
Public Function org_mpris_MediaPlayer2_Player_Previous()
'FMain.ButtonPrev_click()
End
Public Function org_mpris_MediaPlayer2_Player_Pause()
End
Public Function org_mpris_MediaPlayer2_Player_PlayPause()
' FMain.ButtonPlay_click()
End
Public Function org_mpris_MediaPlayer2_Player_Stop()
'FMain.buttonstop_click()
End
Public Function org_mpris_MediaPlayer2_Player_Play()
'If (FMain.mplayer.ProcessRunningOvr()) And (Not FMain.mplayer.paused()) Then Return
'FMain.ButtonPlay_click()
End
Public Function org_mpris_MediaPlayer2_Player_Seek(p As Long)
End
Public Function org_mpris_MediaPlayer2_Player_SetPosition(o As Long, p As Long)
End
Public Function org_mpris_MediaPlayer2_Player_OpenUri(p As String)
'FMain.Play(p)
End