The KAI Software Development Kit Explained

The KAI Software Development Kit Explained

anupama-nair

So you got yourself a KAI & you’ve been using the KAI along with its trusty sidekick, the KAI Control Center.
But now, you’ve thought of a new way to work with the KAI. One that no one else has thought of. Firstly, way to go! Second, how are you going to make your idea work? Enter, KAI SDK.

The KAI SDK is your key to unlocking the full potential of the KAI. You can create custom integrations & get your KAI to do exactly what you want. And we’re here to help you do this. This blog will tell you how to get to work with the KAI SDK.

First Things First, let’s look at some facts.

You don’t necessarily need the KAI Control Centre to use the KAI. The KCC is only meant to bring things down to its simplest. So pretty much anyone can use it. In fact, the KCC itself uses the SDK to interface with the KAI.

And if we can do that with the SDK, imagine what you could do with its powers. You will no longer have to rely on the KCC.

Step 1:

Launch the KAI Control Center. The KCC has been created in such a way that every time the Control Centre is launched, it makes sure that the KAI SDK Service is also running in the background.



You may have noticed this little notification on your Windows taskbar. This means the SDK service is running.

Step 2:

How to connect to the SDK.

The SDK runs on a Web Socket Port, Specifically Port 2203. (No, we did not just choose the port because it's our birthday ;) )

Before you start working on the SDK, you may want to take a look at the data that is coming through your WebSocket. If you would rather skip straight to the coding, skip to Step 3.
Else, here’s how you can take a first look at all the data that is coming through to the SDK. This may help you later on. You can do this using this Chrome Plugin.

  • In the URL field, Enter: localhost 2203
    &
    Click on Open.

  • Paste this JSON snippet in the request field. This will be an authentication request & you ought to receive a message that says “Success = True”.

{

"type": "authentication",

"moduleId": "test",

"moduleSecret": "qwerty"

}

  • Good Job! The SDK will now give you all the data you want.

  • Next, you put in this JSON to receive gesture data.


{

"type": "incomingData",

"kaiId": 1,

"defaultKai": true,

"defaultLeftKai": true,

"foregroundProcess": "chrome",

"data": [

{

"type": "gestureData",

"gesture": "swipeUp"

}]}

Switch on your KAI & perform a gesture & you’ll receive gesture data.

Step 3:

Now you are ready to do this using code instead.
You can start with Visual Studio or JetBrains Rider.

Here are the steps to follow.

  • Create a new c# project.

  • Add a new New Nuget Dependency ( kai.WebSocketModule )
    This makes interfacing with the WebSocket easier. You could do it yourself, but this library helps.

  • In your main function, add the following code to carry out Authentication. The two parameters being sent are the moduleID and the ModuleSecret.



KaiSDK.Initialize("test", "qwerty");

KaiSDK.DefaultKai.Gesture += (sender, e) => {

Console.WriteLine(e.Gesture) };

KaiSDK.Connect();

  • Next, you put in this piece of code to enable gesture data.


KaiSDK.DefaultKai.SetCapabilities(KaiCapabilities.GestureData);

Was that good fun? Of course, it was. You’re all set to begin creating your Custom Applications with the KAI and its SDK. You should be able to find all other information you would need, within our documentation.

If you still have trouble figuring things out, you can reach out to us through the chat option on our website.

So you got yourself a KAI & you’ve been using the KAI along with its trusty sidekick, the KAI Control Center.
But now, you’ve thought of a new way to work with the KAI. One that no one else has thought of. Firstly, way to go! Second, how are you going to make your idea work? Enter, KAI SDK.

The KAI SDK is your key to unlocking the full potential of the KAI. You can create custom integrations & get your KAI to do exactly what you want. And we’re here to help you do this. This blog will tell you how to get to work with the KAI SDK.

First Things First, let’s look at some facts.

You don’t necessarily need the KAI Control Centre to use the KAI. The KCC is only meant to bring things down to its simplest. So pretty much anyone can use it. In fact, the KCC itself uses the SDK to interface with the KAI.

And if we can do that with the SDK, imagine what you could do with its powers. You will no longer have to rely on the KCC.

Step 1:

Launch the KAI Control Center. The KCC has been created in such a way that every time the Control Centre is launched, it makes sure that the KAI SDK Service is also running in the background.



You may have noticed this little notification on your Windows taskbar. This means the SDK service is running.

Step 2:

How to connect to the SDK.

The SDK runs on a Web Socket Port, Specifically Port 2203. (No, we did not just choose the port because it's our birthday ;) )

Before you start working on the SDK, you may want to take a look at the data that is coming through your WebSocket. If you would rather skip straight to the coding, skip to Step 3.
Else, here’s how you can take a first look at all the data that is coming through to the SDK. This may help you later on. You can do this using this Chrome Plugin.

  • In the URL field, Enter: localhost 2203
    &
    Click on Open.

  • Paste this JSON snippet in the request field. This will be an authentication request & you ought to receive a message that says “Success = True”.

{

"type": "authentication",

"moduleId": "test",

"moduleSecret": "qwerty"

}

  • Good Job! The SDK will now give you all the data you want.

  • Next, you put in this JSON to receive gesture data.


{

"type": "incomingData",

"kaiId": 1,

"defaultKai": true,

"defaultLeftKai": true,

"foregroundProcess": "chrome",

"data": [

{

"type": "gestureData",

"gesture": "swipeUp"

}]}

Switch on your KAI & perform a gesture & you’ll receive gesture data.

Step 3:

Now you are ready to do this using code instead.
You can start with Visual Studio or JetBrains Rider.

Here are the steps to follow.

  • Create a new c# project.

  • Add a new New Nuget Dependency ( kai.WebSocketModule )
    This makes interfacing with the WebSocket easier. You could do it yourself, but this library helps.

  • In your main function, add the following code to carry out Authentication. The two parameters being sent are the moduleID and the ModuleSecret.



KaiSDK.Initialize("test", "qwerty");

KaiSDK.DefaultKai.Gesture += (sender, e) => {

Console.WriteLine(e.Gesture) };

KaiSDK.Connect();

  • Next, you put in this piece of code to enable gesture data.


KaiSDK.DefaultKai.SetCapabilities(KaiCapabilities.GestureData);

Was that good fun? Of course, it was. You’re all set to begin creating your Custom Applications with the KAI and its SDK. You should be able to find all other information you would need, within our documentation.

If you still have trouble figuring things out, you can reach out to us through the chat option on our website.