Get/Set clipboard data from DBus or other background options in UT
- 
 @tonton_ said in Get/Set clipboard data from DBus or other background options in UT: you can introspect the service by doing this: dbus-send --session --type=method_call --print-reply \ --dest=com.lomiri.content.dbus.Service \ / \ org.freedesktop.DBus.Introspectable.Introspectthere is a method CreatePastewhich seems to do the job, but looking at input arguments expected, it seems not easy to use
 <method name="CreatePaste">
 <arg direction="in" type="s" name="app_id"/>
 <arg direction="in" type="s" name="surfaceId"/>
 <arg direction="in" type="ay" name="mimeData"/>
 <arg direction="in" type="as" name="types"/>
 <arg direction="out" type="b" name="success"/>
 </method>
- 
 Also dbus-monitor --sessionwhen doing a copy/paste from UI reveals the method called
- 
 Oh yeah, thanks for these infos  , i'll take a look after work ! Cheers , i'll take a look after work ! Cheers
- 
 @lduboeuf 
 trying to use the introspectable method to build a callThe methods : <interface name="com.lomiri.content.dbus.Service"> <method name="GetLatestPasteData"> <arg direction="in" type="s" name="surfaceId"/> <arg direction="out" type="ay" name="mimeData"/> </method> <method name="GetPasteData"> <arg direction="in" type="s" name="surfaceId"/> <arg direction="in" type="s" name="pasteid"/> <arg direction="out" type="ay" name="mimeData"/> </method>The call attempt : phablet@ubuntu-phablet:~$ dbus-send --session --type=method_call --print-reply --dest=com.lomiri.content.dbus.Service / com.lomiri.content.dbus.Service.GetPasteData Error org.freedesktop.DBus.Error.UnknownMethod: No such method 'GetPasteData' in interface 'com.lomiri.content.dbus.Service' at object path '/' (signature '')I'm not sure what i'm doing wrong here, giving the method exists (introspectable). I didn't try to give args on purpose, just to try to build correctly the call first 
- 
 @tonton_ I think not providing any arguments is what is triggering the error. In effect it is saying, there does not exist any method with that name that takes no arguments. 
- 
 @arubislander Thank you for the tip, you were right, i "just" have to find the proper way to encode/decode the "array of bytes" output from these dbus calls ! 
- 
 @tonton_ said in Get/Set clipboard data from DBus or other background options in UT: @arubislander Thank you for the tip, you were right, i "just" have to find the proper way to encode/decode the "array of bytes" output from these dbus calls ! I'm not sure if it is even doable as apparently it requires a "surface_id" and an "app_id" so this is something done for UI apps i guess 
- 
 @lduboeuf not sure either ^^ but if i can decode the bytes array, i believe i can at least retrieve the clipboard ! one step at a time here !  
- 
 so i get an array of bytes which looks like this : 03 00 00 00 34 00 00 00 0a 00 00 00 3e 00 00 00 09 00 00 00 47 00 00 00but longer. 
 It seems to be the clipboard content in mimedata, encoded, but i can't get how to decode it (tested through python or bash for now), sorry if dumb question, i'm getting more familiar with dbus, but not the most skilled around here, that's for sure 
 Does anyone have some clue about this ? I tried some byte converters to try to identify the encoding, but didn't get through for now...
- 
 Do you know the content of the clipboard. 
 What I would do is copy a known string and try to guess if it's encoded and how.I surmise your device is a 64bit ARM. 
 If I just try a simple ASCII conversion I get : "<LF>4><TAB>G"
 So something like:4> GIs it possible? 
- 
 @AppLee 
 thanks for the tip, i tried with ascii converter, didn't think of that, it works 
 I'll have to parse the resulting ascii (lots of escaped character, and html in it )


