Store: Scalextric
Scalextric US English $
M Menu
b 0 Items s

SCharacteristic data always nil

Megaplow

8 posts

Hello,

I can't tell you how excited I am to be playing with a slot car API. My Swift app is able to connect to the periphial and see all of the services and their characteristics. There seems to be an issue with the way I am getting data from the characteristics. No matter which I check or what I do, the characteristic data is always nil. For starters I am looking for the device data. Is there a Swift example of retrieving data from the API?

Joe

woodcote

805 posts

Hi Joe - welcome to the forum!

 

I am presuming you are playing with the swift app to have a look around the ARC powerbase. Maybe you are looking to write your own app to run races etc? Scalextric have released the Bluetooth communication protocols for the powerbase, which you will want to have a look at, if you haven’t already: https://www.scalextric.com/uk-en/forum/scalextric-arc-ble-protocol/?p=1

 

I’m not sure how many people that read these forums have tried to do what you are doing. Possibly a better place to post would be the Scalextric Digital section of Slot Forum.

 

I hope that helps. Let us know how you get on.

Megaplow

8 posts

Figured it out!

You can not read the characteristic data directly. You need to first call

peripheral.readValue(for: characteristic)

Then wait for the delegate method to be called, from within the handler the data is available. 

func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?)

Back to the races!

woodcote

805 posts

Glad you got it sorted! Do let us know how you progress with your project.

 

Have fun!

Andy P.

1707 posts


Community Moderator

This sounds all very interesting.

Please keep it up!

:-D

Please create an account or login to reply.

Forum Rules

  • The Scalextric Forum is intended for discussion of slot-car racing. Primarily, a place for newcomers to ask questions and seek assistance from like-minded individuals, the Scalextric Forum offers users the chance to join an active and friendly community.
  • Discussion of other slot-car brands is allowed, however, active promotion or advertising of our competitors is not permitted.
  • Please keep in mind that the Scalextric Forum is a publicly viewable space and you should never post personal information (including email addresses).
  • While every effort is made to contact you before any censorship, we reserve the right to amend or remove any content without explanation.
  • All customer service enquiries should be directed to Scalextric Customer Services.

Useful Links

Forum Guidelines


Membership Restricted Product