语言

Menu
Sites
Language
SAP HelloAccessory Example not Working

Hey guys, 

I am trying to implement a simple communication function between my Gear S3 and Pixel 2XL. 

I have tested the HelloAccessory example with the scenario: phone is the provider, and watch is the customer. Both codes are installed and running well. However, the connection can not be able to build up with the Error code 1280. I also debug the code that the SA agents on both sides can be initialized successfully, but the connection always fails when the watch call the connect function.

Here I provided the debug log: 

2019-12-01 01:07:22.973 18323-18323/provider.helloaccessory.example.accessory.sdk.android.samsung.com.helloaccessoryprovider D/[SA_SDK]SAAdapter: Accessory service connected
2019-12-01 01:07:22.975 18323-18323/provider.helloaccessory.example.accessory.sdk.android.samsung.com.helloaccessoryprovider I/[SA_SDK]SAAdapter: Received Client ID:1017328989
2019-12-01 01:07:22.975 18323-18340/provider.helloaccessory.example.accessory.sdk.android.samsung.com.helloaccessoryprovider I/[SA_SDK]SAAdapter: Application is now connected to Accessory Framework!
2019-12-01 01:07:22.976 18323-18340/provider.helloaccessory.example.accessory.sdk.android.samsung.com.helloaccessoryprovider I/[SA_SDK]SAAgent: Agent ID retrieved successfully for com.samsung.android.sdk.accessory.example.helloaccessory.provider.ProviderService Agent ID:6900

2019-12-01 01:07:29.607 18323-18323/provider.helloaccessory.example.accessory.sdk.android.samsung.com.helloaccessoryprovider D/[SA_SDK]SAAgent: Received incoming connection indication
2019-12-01 01:07:29.609 18323-18340/provider.helloaccessory.example.accessory.sdk.android.samsung.com.helloaccessoryprovider I/[SA_SDK]SAAgent: Connection initiated by peer: 21767 on Accessory: SAMSUNG_ACCESSARY__1C:23:2C:8B:7B:60 Transaction: 114

2019-12-01 01:07:29.610 18323-18340/provider.helloaccessory.example.accessory.sdk.android.samsung.com.helloaccessoryprovider I/[SA_SDK]SAAgent: Trying to Accept service connection request from peer:21767 Transaction:114

2019-12-01 01:07:29.613 18323-18340/provider.helloaccessory.example.accessory.sdk.android.samsung.com.helloaccessoryprovider I/[SA_SDK]SAAgent: Agent ID retrieved successfully for com.samsung.android.sdk.accessory.example.helloaccessory.provider.ProviderService Agent ID:6900

2019-12-01 01:07:29.614 18323-18340/provider.helloaccessory.example.accessory.sdk.android.samsung.com.helloaccessoryprovider D/[SA_SDK]SAAgent: Instantiating SASocket: com.samsung.android.sdk.accessory.example.helloaccessory.provider.ProviderService$ServiceConnection

2019-12-01 01:07:29.621 2750-2765/? E/SASdkWrapper: SA_ERROR: Error code 1280
2019-12-01 01:07:29.625 18323-18354/provider.helloaccessory.example.accessory.sdk.android.samsung.com.helloaccessoryprovider E/[SA_SDK]SASocket: Failed to accept service connection : Failed to accept connection request!

It seems that the SA initialization works well. However, there is an error occurred from the framework after calling  

acceptServiceConnectionRequest(peerAgent). I have no idea why it happened.

My Gear S3 software information is: 4.0.0.2, R760XXU2DSA1, and my Pixel 2XL software version is Android 8.1.0 Oero.

Here I also provide the accessoryservices.xml on both sides:

On the phone:
<application name="HelloAccessoryProvider" >
    <serviceProfile
        id="/sample/hello"
        name="zac"
        role="provider"
        serviceImpl="com.samsung.android.sdk.accessory.example.helloaccessory.provider.ProviderService"
        version="1.0"
        serviceLimit="ANY"
        serviceTimeout="10">
        <supportedTransports>
            <transport type="TRANSPORT_BT" />
            <!--<transport type="TRANSPORT_WIFI" />-->
        </supportedTransports>
        <serviceChannel
            id="107"
            dataRate="high"
            priority="low"
            reliability= "enable"/>
    </serviceProfile>
</application>

On the watch:

<?xml version="1.0" encoding="UTF-8"?>

<resources>

    <application name="org.tizen.helloaccessoryconsumer">

        <serviceProfile id="/sample/hello" name="zac"

            role="consumer" version="1.0">

            <supportedTransports>

                <transport type="TRANSPORT_BT" />

                <!-- <transport type="TRANSPORT_WIFI" /> -->

            </supportedTransports>

            <serviceChannel id="107" dataRate="high" priority="low"

                reliability="enable">

            </serviceChannel>

        </serviceProfile>

    </application>

</resources>

I think they are correct but the issue is that the connection can not be built. 

So, please advise me if anything I missed out. 

Many thanks.