Answers for "https://volttron.readthedocs.io/en/develop/platform-features/message-bus/vip/vip-json-rpc.html#remote-procedure-calls"

0

https://volttron.readthedocs.io/en/develop/platform-features/message-bus/vip/vip-json-rpc.html#remote-procedure-calls

from volttron.platform.vip import Agent, Core, RPC

def add(a, b):
    '''Add two numbers and return the result'''
    return a + b


class ExampleAgent(Agent):
    @RPC.export
    def say_hello(self, name):
        '''Build and return a hello string'''
        return 'Hello, %s!' % (name,)

    @RPC.export('say_bye')
    def bye(self, name):
        '''Build and return a goodbye string'''
        return 'Goodbye, %s.' % (name,)

    @Core.receiver('setup')
    def onsetup(self, sender, **kwargs):
        self.vip.rpc.export('add')
Posted by: Guest on April-19-2021

Code answers related to "https://volttron.readthedocs.io/en/develop/platform-features/message-bus/vip/vip-json-rpc.html#remote-procedure-calls"

Python Answers by Framework

Browse Popular Code Answers by Language