@@ -26,7 +26,6 @@ import (
2626 "github.com/AndroidGoLab/binder/binder"
2727 "github.com/AndroidGoLab/binder/binder/versionaware"
2828 "github.com/AndroidGoLab/binder/kernelbinder"
29- "github.com/AndroidGoLab/binder/parcel"
3029 "github.com/AndroidGoLab/binder/servicemanager"
3130)
3231
@@ -178,37 +177,16 @@ func main() {
178177
179178 spy := & gattSpy {registeredCh : make (chan int32 , 1 )}
180179 gattCallback := genBluetooth .NewBluetoothGattCallbackStub (spy )
180+ gattProxy := genBluetooth .NewBluetoothGattProxy (gattBinder )
181181
182- // registerClient via raw transaction (the generated proxy may not
183- // handle all the complex parameters correctly).
184- code , err := gattBinder .ResolveCode (ctx , genBluetooth .DescriptorIBluetoothGatt , "registerClient" )
185- if err != nil {
186- fmt .Fprintf (os .Stderr , "resolve registerClient: %v\n " , err )
187- os .Exit (1 )
188- }
182+ // ParcelUuid for the app identifier (placeholder; the actual UUID
183+ // value is not significant for GATT client registration).
184+ appID := genOs.ParcelUuid {}
189185
190- data := parcel .New ()
191- data .WriteInterfaceToken (genBluetooth .DescriptorIBluetoothGatt )
192- data .WriteInt32 (1 ) // non-null ParcelUuid
193- data .WriteInt64 (0x0000180000001000 )
194- data .WriteInt64 (- 9223371485494954757 )
195- binder .WriteBinderToParcel (ctx , data , gattCallback .AsBinder (), transport )
196- data .WriteBool (false )
197- data .WriteInt32 (0 )
198- attr := shellAttribution ()
199- data .WriteInt32 (1 )
200- attr .MarshalParcel (data )
201-
202- reply , err := gattBinder .Transact (ctx , code , 0 , data )
203- if err != nil {
186+ if err := gattProxy .RegisterClient (ctx , appID , gattCallback , false , 0 , shellAttribution ()); err != nil {
204187 fmt .Fprintf (os .Stderr , "registerClient: %v\n " , err )
205188 os .Exit (1 )
206189 }
207- if statusErr := binder .ReadStatus (reply ); statusErr != nil {
208- fmt .Fprintf (os .Stderr , "registerClient status: %v\n " , statusErr )
209- fmt .Fprintf (os .Stderr , "Hint: AIDL version mismatch — the BT stack may not expect AttributionSource.\n " )
210- return
211- }
212190
213191 select {
214192 case status := <- spy .registeredCh :
0 commit comments