module YalgaarSubcribe

~ require_relative 'YalgaarInitModule' ~ require_relative 'YalgaarInitModule'

Namespace module for Subscribe default variables...

!/usr/bin/env ruby

Public Instance Methods

yalgaarSubcribe(*args) click to toggle source

yalgaarSubcribe(length); @brief - <To yalgaarSubcribe as given length>

@param <Length> : <length for how long uuid generating> DESCRIPTION:<To yalgaarSubcribe as given length>

# File lib/mqttbridge/YalgaarSubscribe.rb, line 34
def yalgaarSubcribe(*args)
        #~ puts @@isConnected
        if @@isConnected == true
                channel=args[0]
                @@lSubCallback=args[1]
                @@lPresenceCallback=args[2]
                @@lEroorCallback=args[3]
                
                if channel.is_a?(Array)
                        #~ puts channel.size
                        for ilterator in 0..channel.size-1
                                 if channelValidation(channel[ilterator])
                                        #~ puts channel[ilterator]
                                        topic=@@clientKey+'/'+channel[ilterator]
                                        @@client.subscribe(topic)
                                 else
                                        errmesg=showErrCode(YALGAAR_108)
                                        @@lEroorCallback.call(errmesg)
                                        #~ ErrorMsgCallback("Channel is not valid")
                                 end
                        end 
                else
                        if channelValidation(channel)
                                #~ puts channel
                                topic=@@clientKey+'/'+channel
                                @@client.subscribe(topic)
                         else       
                                errmesg=showErrCode(YALGAAR_108)
                                @@lEroorCallback.call(errmesg)
                         end
                end
                return 0
        else
                return YALGAAR_NO_SERVER_CONNECTION
        end   
end
yalgaarUnSubcribe(channel) click to toggle source

yalgaarUnSubcribe(length); @brief - <To yalgaarUnSubcribe as given length>

@param <Length> : <length for how long uuid generating> DESCRIPTION:<To yalgaarUnSubcribe as given length>

# File lib/mqttbridge/YalgaarSubscribe.rb, line 74
def yalgaarUnSubcribe(channel)
        if channel.is_a?(Array)
                #~ puts channel.size
                for ilterator in 0..channel.size-1
                         if channelValidation(channel[ilterator])
                                #~ puts channel[ilterator]
                                topic=@@clientKey+'/'+channel[ilterator]
                                @@client.unsubscribe(topic)
                         else       
                                errmesg=showErrCode(YALGAAR_108)
                                @@lEroorCallback.call(errmesg)
                                #~ ErrorMsgCallback("Channel is not valid")
                         end
                end  
        else
                if channelValidation(channel)
                        #~ puts channel
                        topic=@@clientKey+'/'+channel
                        @@client.unsubscribe(topic)
                 else        
                        errmesg=showErrCode(YALGAAR_108)
                        @@lEroorCallback.call(errmesg)
                 end
        end
end