Json RPC Server StartComm

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Json RPC Server StartComm

ソリューションへジャンプ
809件の閲覧回数
Ickes
Contributor I

Hi,

I am using matlab and freemaster rpc-server for automatic data logging.

I tried to get all the information from the freemaster lite JS api because there is no rpc-server api where the json structures for the commands are defined or at least I could not find it.

 

So far it has worked and I can read and write variables and stop the communication, but the structure to start communication does not work. Does anyone here have an idea what is wrong with this?

jsonMessage2(1).jsonrpc="2.0";
jsonMessage2(1).method="StartComm";
jsonMessage2(1).params=["comm_plugin_conn","name","addr=localhost;port=9990;timeout=500","string"];
jsonMessage2(1).id=0;

The error message is: msg: 'StartComm: Could not open the communication port (Error 0x848a0001: Connect string invalid.) !'

I got the connection string from the freemaster desktop application running with an existing freemaster project, in the UI I can start the communication without problems.

 

0 件の賞賛
1 解決策
771件の閲覧回数
iulian_stan
NXP Employee
NXP Employee

Hi @Ickes,

StartComm expects a single argument - connection string:

Capture.PNG

It can be passed as positional or named argument.
In your case the message could look like this (assuming the target is connected to you PC via UART):

 

(positional):

jsonMessage2(1).jsonrpc="2.0";
jsonMessage2(1).method="StartComm";
jsonMessage2(1).params=["RS232;port=COM1;speed=115200"];
jsonMessage2(1).id=0;

(named):

jsonMessage2(1).jsonrpc="2.0";
jsonMessage2(1).method="StartComm";
jsonMessage2(1).params={"name": "RS232;port=COM1;speed=115200"};
jsonMessage2(1).id=0;

Currently, there is no explicit description of the JSON messages. The message can be inferred from the JS client y following these 2 rules:

  1. `method` property is the same as JS function name
  2. `params` is an array of properties following the same order in which they appear in JS function definition or an JSON object. In the second case, object properties are the same as JS function arguments (no restriction on order in this case).

Hope it helps,
Iulian

元の投稿で解決策を見る

0 件の賞賛
2 返答(返信)
743件の閲覧回数
Ickes
Contributor I

Hi @iulian_stan,

thank you for your reply. I am using the FreeMASTER tcp to serial plugin and found a way to start the communication.

With the plugin the necessary string consists of the comm-plugin-id followed by the comm-plugin-string

''' StartCommMessage(1).params=["{comm-plugin-id};comm-plugin-string","name"];

0 件の賞賛
772件の閲覧回数
iulian_stan
NXP Employee
NXP Employee

Hi @Ickes,

StartComm expects a single argument - connection string:

Capture.PNG

It can be passed as positional or named argument.
In your case the message could look like this (assuming the target is connected to you PC via UART):

 

(positional):

jsonMessage2(1).jsonrpc="2.0";
jsonMessage2(1).method="StartComm";
jsonMessage2(1).params=["RS232;port=COM1;speed=115200"];
jsonMessage2(1).id=0;

(named):

jsonMessage2(1).jsonrpc="2.0";
jsonMessage2(1).method="StartComm";
jsonMessage2(1).params={"name": "RS232;port=COM1;speed=115200"};
jsonMessage2(1).id=0;

Currently, there is no explicit description of the JSON messages. The message can be inferred from the JS client y following these 2 rules:

  1. `method` property is the same as JS function name
  2. `params` is an array of properties following the same order in which they appear in JS function definition or an JSON object. In the second case, object properties are the same as JS function arguments (no restriction on order in this case).

Hope it helps,
Iulian

0 件の賞賛