question

xtiger avatar image
xtiger asked ·

Disconnect Gadget Device after sending Discover.Response Immediately.

I'm developing a firmware for out gadget hardware.

Now, I'm success that my gadget received the directive from Echo Device.

I made a event using nanopb for handshake . that is Discover.Response.

I think my Discover.Response is correct.

But Echo-dot disconnected Bluetooth Immediately as soon as sending Discover.Response from my gadget to Echo-dot.

I want to know why Bluetooth connection is disconnected.

Please tell me the reason and inform me what to do next!

gadgets toolkit
conrim-data.png (22.5 KiB)
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

xtiger avatar image
xtiger answered ·

Jason@amazon Can you help me?

10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

newuser-b61f45f4-ab2f-4b53-8c49-60291e10b3b4 avatar image
newuser-b61f45f4-ab2f-4b53-8c49-60291e10b3b4 answered ·

Let us try few things

Can you try updating your discovery response to contain supported type as an array of objects

"configuration": { "supportedTypes": [ { "name": "timers" }, { "name": "alarms" }, { "name": "reminders" }, { "name": "wakeword" } ] },

Also, could you please confirm, if you have followed the steps to register a Gadget as descrived here - https://developer.amazon.com/docs/alexa-gadgets-toolkit/register-gadget.html ?

Also, please make sure you are generating the correct device token as described here - https://developer.amazon.com/docs/alexa-gadgets-toolkit/alexa-discovery-interface.html#AdditionalIdentification

10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

xtiger avatar image
xtiger answered ·

Thanks fast reply, I will check your point.

First of all,

I wonder that I can develop a gadget with AMAZON in South Korea?

The Document of the Amazon gadget tookit limited locales (US, UK, Germany) for sale. we only develop our gadget in korea, the local for sale is US.

I want to know I can develop the gadget in South korea.

10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

xtiger avatar image
xtiger answered ·

NewUser-b61f45f4-ab2f-4b53-8c49-60291e10b3b4

"configuration": { "supportedTypes": [ { "name": "timers" }, { "name": "alarms" }, { "name": "reminders" }, { "name": "wakeword" } ] },

==>

I reconfirm Response format. the Response in console image is the result decoding by protoc. that is not JSON.

I think that is correct because supportedTypes have feature "repated".


Also, could you please confirm, if you have followed the steps to register a Gadget as descrived here - https://developer.amazon.com/docs/alexa-gadgets-toolkit/register-gadget.html ?

==> I think I did it following linked guide for register a Gadget

I got AMAZON ID and Secret key after register. you can see in the attached image.

Also, please make sure you are generating the correct device token as described here - https://developer.amazon.com/docs/alexa-gadgets-toolkit/alexa-discovery-interface.html#AdditionalIdentification

==>I generated device token using the sample code is "alexa-gadgets-sample-code-master"which is supported by amazon.


I doubt this problem is made by checking a local that is connected with my gadget. I think Echo-dot check a local if a local is not US,UK or Germany, Echo-dot take disconnect with my gadget.


I want to know my theory is correct.

Could you tell me about a reason?

10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

caroline@amazon avatar image
caroline@amazon answered ·

Thanks for flagging! We looked into this and discovered that the sample code implementation for our SHA calculation has a bug. We are currently working to update the sample and will update you when its ready. In the meantime, it may be helpful to refer to the Python implementation in the link you referenced:

import hashlib
def generate_token(device_id, device_token):
  hash_object = 
   (
    hashlib.sha256(bytes(device_id, 'utf-8') 
    + bytes(device_token, 'utf-8'))
    )
   hex_dig = hash_object.hexdigest()
   return bytes(hex_dig, 'utf-8')

https://developer.amazon.com/docs/alexa-gadgets-toolkit/alexa-discovery-interface.html#AdditionalIdentification

10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

xtiger avatar image
xtiger answered ·

Thanks your reply,

I can't believe it !

I received Directive for Echo-Dot after fixing token using python.

Thank you very much again again~!

I hope you have a nice day everyday!

1 comment
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

You're very welcome! Thanks for flagging that issue in the sample code for us and helping to make Alexa Gadgets Toolkit better.

0 Likes 0 ·
caroline@amazon avatar image
caroline@amazon answered ·

As a follow up to our last correspondence, we have updated the same code in GitHub. For your reference, you can find it here: https://github.com/alexa/alexa-gadgets-sample-code/tree/master/ConnectionHelpers/DeviceSecret. Thanks again!

10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.