-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed #1: Implemented org.freedesktop.DBus.Introspectable
- Loading branch information
1 parent
049443b
commit 887a1fa
Showing
3 changed files
with
205 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,194 @@ | ||
package mpris | ||
|
||
import ( | ||
introspect "github.com/godbus/dbus/introspect" | ||
) | ||
|
||
// IntrospectNode returns the root node of the library's introspection output. | ||
func (i *Instance) IntrospectNode() *introspect.Node { | ||
return &introspect.Node{ | ||
Name: i.Name(), | ||
Interfaces: []introspect.Interface{ | ||
introspect.IntrospectData, | ||
introspect.Interface{ | ||
Name: "org.mpris.MediaPlayer2", | ||
Properties: []introspect.Property{ | ||
introspect.Property{ | ||
Name: "CanQuit", | ||
Type: "b", | ||
Access: "read", | ||
}, | ||
introspect.Property{ | ||
Name: "CanRaise", | ||
Type: "b", | ||
Access: "read", | ||
}, | ||
introspect.Property{ | ||
Name: "HasTrackList", | ||
Type: "b", | ||
Access: "read", | ||
}, | ||
introspect.Property{ | ||
Name: "Identity", | ||
Type: "s", | ||
Access: "read", | ||
}, | ||
introspect.Property{ | ||
Name: "SupportedUriSchemes", | ||
Type: "as", | ||
Access: "read", | ||
}, | ||
introspect.Property{ | ||
Name: "SupportedMimeTypes", | ||
Type: "as", | ||
Access: "read", | ||
}, | ||
}, | ||
Methods: []introspect.Method{ | ||
introspect.Method{ | ||
Name: "Raise", | ||
}, | ||
introspect.Method{ | ||
Name: "Quit", | ||
}, | ||
}, | ||
}, | ||
introspect.Interface{ | ||
Name: "org.mpris.MediaPlayer2.Player", | ||
Properties: []introspect.Property{ | ||
introspect.Property{ | ||
Name: "PlaybackStatus", | ||
Type: "s", | ||
Access: "read", | ||
}, | ||
introspect.Property{ | ||
Name: "LoopStatus", | ||
Type: "s", | ||
Access: "readwrite", | ||
}, | ||
introspect.Property{ | ||
Name: "Rate", | ||
Type: "d", | ||
Access: "readwrite", | ||
}, | ||
introspect.Property{ | ||
Name: "Shuffle", | ||
Type: "b", | ||
Access: "readwrite", | ||
}, | ||
introspect.Property{ | ||
Name: "Metadata", | ||
Type: "a{sv}", | ||
Access: "read", | ||
}, | ||
introspect.Property{ | ||
Name: "Volume", | ||
Type: "d", | ||
Access: "readwrite", | ||
}, | ||
introspect.Property{ | ||
Name: "Position", | ||
Type: "x", | ||
Access: "read", | ||
}, | ||
introspect.Property{ | ||
Name: "MinimumRate", | ||
Type: "d", | ||
Access: "read", | ||
}, | ||
introspect.Property{ | ||
Name: "MaximumRate", | ||
Type: "d", | ||
Access: "read", | ||
}, | ||
introspect.Property{ | ||
Name: "CanGoNext", | ||
Type: "b", | ||
Access: "read", | ||
}, | ||
introspect.Property{ | ||
Name: "CanGoPrevious", | ||
Type: "b", | ||
Access: "read", | ||
}, | ||
introspect.Property{ | ||
Name: "CanPlay", | ||
Type: "b", | ||
Access: "read", | ||
}, | ||
introspect.Property{ | ||
Name: "CanSeek", | ||
Type: "b", | ||
Access: "read", | ||
}, | ||
introspect.Property{ | ||
Name: "CanControl", | ||
Type: "b", | ||
Access: "read", | ||
}, | ||
}, | ||
Signals: []introspect.Signal{ | ||
introspect.Signal{ | ||
Name: "Seeked", | ||
Args: []introspect.Arg{ | ||
introspect.Arg{ | ||
Name: "Position", | ||
Type: "x", | ||
}, | ||
}, | ||
}, | ||
}, | ||
Methods: []introspect.Method{ | ||
introspect.Method{ | ||
Name: "Next", | ||
}, | ||
introspect.Method{ | ||
Name: "Previous", | ||
}, | ||
introspect.Method{ | ||
Name: "Pause", | ||
}, | ||
introspect.Method{ | ||
Name: "PlayPause", | ||
}, | ||
introspect.Method{ | ||
Name: "Stop", | ||
}, | ||
introspect.Method{ | ||
Name: "Play", | ||
}, | ||
introspect.Method{ | ||
Name: "Seek", | ||
Args: []introspect.Arg{ | ||
introspect.Arg{ | ||
Name: "Offset", | ||
Type: "x", | ||
Direction: "in", | ||
}, | ||
}, | ||
}, | ||
introspect.Method{ | ||
Name: "SetPosition", | ||
Args: []introspect.Arg{ | ||
introspect.Arg{ | ||
Name: "TrackId", | ||
Type: "o", | ||
Direction: "in", | ||
}, | ||
introspect.Arg{ | ||
Name: "Position", | ||
Type: "x", | ||
Direction: "in", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
// TODO: This interface is not fully implemented. | ||
// introspect.Interface{ | ||
// Name: "org.mpris.MediaPlayer2.TrackList", | ||
|
||
// }, | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters