Please Wait

Loading..

Yocto Project SDK 1.0.0

Create amazing realtime applications easily with Yalgaar Yocto Project SDK

Yocto Project SDK

Steps to Deploy Recipe in Yocto Build System:

Note:

Current version does not support AES Encryption feature.

Dependencies:

   “Yalgaar” recipe is depend on the “systemd” process.

Procedure to add Yalgaar Recipe:

  • Add below lines in “/build/conf/local.conf” file to enable systemd support.
    • DISTRO_FEATURES_append = " systemd"
    • VIRTUAL-RUNTIME_init_manager = "systemd"
    • DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"
    • VIRTUAL-RUNTIME_initscripts = ""
  • Add below line in “/build/conf/local.conf” file to add the yalgaar recipe.
    • IMAGE_INSTALL_append += "yalgaar"
  • Add yalgaarSDK(recipe package) to any custom meta-layer
    • copy “yalgaarSDK” Directory inside any custom meta layer.
    • Example of Full Path: /poky/meta-sls/meta-intel/recipes-*/yalgaarSDK
  • Add YalgaarSDK contain meta-layer in bblayer.conf file
    • Example: BBLAYERS ?= " ##OEROOT##/poky/meta-sls/meta-intel "
  • Create Board image using below command
    • bitbake [Board-specific Target]
    • Example:
      • bitbake core-minimal-image
      • bitbake image-full-intel-gen2-dev

Procedure to Test Example Binary on specific Board:

  • Default path of “yalgaar_io.pem ” certificate file is “/usr/bin”.
  • Test the Generated example binary on Board using below command
    • cd /usr/bin
    • ./yalgaarSDK


1 Connect To Yalgaar

Include "yalgaar_api.h" in your code.

#include "yalgaar_api.h"

To connect to a Yalgaar client, use following method, it must have valid Client Key.

yalgaar_connect(char *clientKey,bool isSecure,char *uuid,char *AES_SECURITY_KEY,unsigned int AESTYPE,void(*connectionCallback) (yalgaar_error_t error_msg));

Parameter:

  • clientKey
    • Description: Yalgaar provided authentic client key for project.
    • DataType: unsigned char
  • isSecure
    • Description: Specified connection is establish with SSL or not.
    • DataType: boolean (value must be true or false)
  • uuid
    • Description: Any unique user name for user to enable presence feature for client. UUID is CASE SENSITIVE and only alpha numeric, hyphens,@,underscore allowed and maximum length must be 50.
    • DataType: unsinged char
  • AES_SECURITY_KEY
    • Description: Secret key use for encrypt/decrypt message.
    • DataType: unsigned char
  • AESTYPE
    • Description: Type of AES algorithm use for encrypt/decrypt message. Support AES type 128,192 and 256.
    • DataType: unsigned int
  • connectionCallback
    • Description: Called when successfully connected to server or any error during connection.
    • DataType: ENUM (yalgaar_error_t)


2 Publish Message

To publish message, use following method.

yalgaar_publish(const unsigned char *channel,char *message);

Parameter:

  • channel
    • Description: Channel name to be publish message. Only alpha numeric, hyphens, @, underscore allowed and maximum length must be 50.
    • DataType: unsigned char
  • message
    • Description: Data to be send on given channel.
    • DataType: unsigned char


3 Subscribe Message

To subscribe message, use following method.

yalgaar_subscribe(char *channel,void(*subscribeMessageCallback)(void *),void(*presenceMessageCallback)(struct presence_t *),void(*errorMessageCallback)(void *));
yalgaar_subscribes(char **channel,void(*subscribeMessageCallback)(void *),void(*presenceMessageCallback)(struct presence_t *),void(*errorMessageCallback)(void *));

Parameter:

  • channel
    • Description: channel name on which message will be subscribed. For multiple channel names use "yalgaar_subscribes" function. Channel name is CASE SENSITIVE. Only alpha numeric, hyphens, @, underscore allowed and maximum length must be 50.
    • DataType: unsigned char
  • subscribeMessageCallback
    • Description: Callback function to consume received message.
    • DataType: void *
  • presenceMessageCallback
    • Description: Callback function to consume presence events such as join or leave.
    • DataType: struct presence_t *
  • errorMessageCallback
    • Description: Callback is called on system error occurred during subscription.
    • DataType: void *


4 Unsubscribe Message

To unsubscribe message, use following method.

yalgaar_unsubscribe(channel);
  • channel
    • Description: Channel name to be unsubscribe. Channel name is CASE SENSITIVE. Only alpha numeric, hyphens, @, underscore allowed and maximum length must be 50.
    • DataType: unsigned char


5 Get User List

To get list of all user subscribe with specified channel name, use following method.

yalgaar_GetUserList(char *channel,void(*userListCallback)(Sll *),void(*errorMessageCallback)(void *));

Parameter:

  • channel
    • Description: Valid channel name. Channel name is CASE SENSITIVE and only alpha numeric, hyphens, @, underscore allowed and maximum length must be 50.
    • DataType: unsigned char
  • userListCallback
    • Description: Callback is called when successfully get user list.
    • DataType: Sll *
  • errorMessageCallback
    • Description: Callback is called on system error occurred during getting user list.
    • DataType: void *


6 Get Channel List

To get list of all channels subscribed by specified user, use following method.

yalgaar_GetChannelList(char *UUID,void(*channelListCallback)(Sll *),void(*errorMessageCallbacks)(void *));

Parameter:

  • UUID
    • Description: Any unique user name or user id. UUID is CASE SENSITIVE and only alpha numeric, hyphens,@,underscore allowed and maximum length must be 50.
    • DataType: unsigned char
  • channelListCallback
    • Description: Callback is called when successfully get channel list.
    • DataType: Sll *
  • errorMessageCallbacks
    • Description: Callback is called on system error occurred during getting channel list.
    • DataType: void *


7 History Message

To get message history from specified channel name, use following method.

yalgaar_GetHistoryMessage(char *channelName,char *messageCount,void(* historymessagecallback)(char *),void(*errorMessageCallback)(char *));

Parameter:

  • channelName
    • Description: Valid channel name. Channel name is CASE SENSITIVE and only alpha numeric, hyphens, @, underscore allowed and maximum length must be 50.
    • DataType: unsigned char
  • messageCount
    • Description: How many messages that you want to fetch. Maximum 100 messages allow at a time.
    • DataType: char *
  • historymessagecallback
    • Description: Callback is called when successfully get history message list.
    • DataType: char *
  • errorMessageCallbacks
    • Description: Callback is called on system error occurred during getting history message.
    • DataType: void *


8 Disconnect

To disconnect connection with YalgaarClient, use following method.

yalgaar_disconnect();


You can publish/subscribe message like so :

#include "yalgaar_api.h"
void connection_Callback(int result,char *error_msg);
void subscribe_message_callback(void *payload)
{
    printf(stderr,"\n\nsubscribe_message_callback=%s\n",(char *)payload);
}
void error_message_callback(void *error_msg)
{
    printf("\n Error :%s \n",( char *)error_msg);
}
void connection_Callback(int result,char *error_msg)
{
    yalgaar_error_t rc = FAILURE;
    char err_string[YALGAAR_ERROR_MESSAGE_LENGTH];
    if(!result)
    {
        printf("\n Connected..\n");
        rc =yalgaar_subscribe("YourChannel",&subscribe_message_callback,NULL,&error_message_callback);
        if(SUCCESS != rc)
        {
            enum_to_message(rc,err_string);
            printf("\nError subscribing : %s ", err_string);fflush(stdout);
        }
        yalgaar_publish("YourChannel","This is Yalgaar Yocto Project SDK Example");
    }
    else
    {
        printf("\nError:%s",error_msg);fflush(stdout);
    }
}
int main(int argc, char**argv)
{
    yalgaar_error_t rc = FAILURE;
    char err_string[YALGAAR_ERROR_MESSAGE_LENGTH];
    /**Yalgaar connect Method called*/
    rc = yalgaar_connect("YourClientKey",1,"UUID",0,0,&connection_Callback);
    if(SUCCESS != rc)
    {
        printf("\nError yalgaar_connect : %d ", rc);
        disconnectCallbackHandler();
        return -1;
    }
    while(1)
    {
        /**this function is call to wait for receive from yalgaar */
        yalgaar_wait_to_read();
    }
    if(SUCCESS != rc)
    {
        printf("\nAn error occurred in the loop. %d\n",rc);
    }
    rc = yalgaar_disconnect();
    return rc;
}