Commercial Hardware tools and the eSDK are available only for approved partners

To initialize the library, use the function SpInit(). The function takes a struct of type SpConfig as a parameter. Within SpConfig there are a number of required fields that need to be set to start with:

  • SpConfig::memory_block. A pointer to an application-provided memory buffer that the library uses for all its memory allocations. The library does not allocate any memory beyond the size of the buffer (other than stack variables).
  • SpConfig::unique_id. A unique id for the device on which it is running, typically the MAC address. This is used by the library to distinguish the device from other Spotify Connect-enabled devices that the user has. It is important that this ID is sufficiently unique and that it does not change between sessions. (See SpConfig::unique_id for more information.)
  • SpConfig::display_name. The name of the device that will appear when selecting the device in the Connect menu of the Spotify mobile app, for example. Typically, this is the model name of the device or the name that the device uses to announce itself via UPnP or similar protocols.
  • The fields SpConfig::brand_name and SpConfig::model_name should be set to match the brand and model name that you provided in the certification application for the hardware product.
  • SpConfig::brand_display_name and SpConfig::model_display_name. Use these fields if the brand/model strings (see previous bullet) contain characters not allowed. If used, they will override SpConfig::brand_name and SpConfig::model_name for display purposes.
  • SpConfig::device_type. The field should be set to the device type that matches the hardware product most closely.
  • SpConfig::client_id. Provide a Client ID in the field.
  • SpConfig::product_id. For each product enter a designated Product ID, a non-zero unsigned integer which enumerates this model. The simplest way to assign Product IDs for your products is to just use 1, 2, 3, and so on. The Product ID must match the value given in the New Product Application form for this particular model.
  • SpConfig::error_callback. A callback function that the library will use to report errors that happen asynchronously.

Apart from these fields, there are a number of fields you may use. For a complete list, see the SpConfig page.

struct SpConfig conf;
enum SpDeviceType device_type = kSpDeviceTypeSpeaker;
const char *client_id = "my-client-id";

memset(&conf, 0, sizeof(conf));

conf.api_version = SP_API_VERSION;
conf.memory_block = malloc(buffer_size);
conf.memory_block_size = buffer_size;
conf.error_callback = CallbackError;
conf.error_callback_context = NULL;
conf.display_name = "Example";
conf.unique_id = "my-sample-unique-id";
conf.brand_name = "Example_Brand";
conf.model_name = "example_embedded";
conf.brand_display_name = "Example Brand";
conf.model_display_name = "example_embedded \u266C";
conf.device_type = device_type;
conf.zeroconf_serve = 1;
conf.zeroconf_port = 0;
conf.host_name = conf.unique_id;
conf.client_id = client_id;
conf.scope = SP_SCOPE_STREAMING;