Hello Everyone,
I've created GUIs for S32K boards with FreeMaster several times, but until now I only used the ActiveX interface and methods.
This time I tried to create GUI that uses JSON-RPC methods, by modifying an existing ActiveX GUI.
Help me to see what I miss.
First problem,
I started with simple variable reading. I use the following fields for feedback.

Here we can see, that I received a positive feedback from the pcm.OnBoardDetected and from the pcm.IsCommPortOpen() methods. Only after that I tried to read a variable, but I received the following error message: "ReadVariable: Could not read the variable 'FMSTR_u32FwVversion[0]'. Error 0x8000fffb (Communication port is not opened.)."
Interesting is, that when I call the same ReadVariable method manually with a button, it works.

code sniplet:
pcm.ReadVariable(name)
.then((response) => {
$("#mcu_ic_text").val("Variable value: " + response.data);
})
.catch((err) => {
on_error(err.msg);
});
But I need to read variables automatically when the board connects.
Second,
When I click refresh (F5), it seems like nothing works that worked until that point. I have in the main() function, which is called after the refresh, a pcm.IsCommPortOpen() and a pcm.IsBoardDetected() methods, but they don't deliver any response after the refresh.
function main() {
pcm = new PCM("localhost:41000", on_connected, on_error, on_error);
pcm.OnServerError = on_error;
pcm.OnSocketError = on_error;
pcm.IsCommPortOpen().then(response => {
$("#pcb_version_text").val("Port status: " + response.data);
});
pcm.IsBoardDetected()
.then((response) => {
$("#nfc_ic_text").val("board:");
})
.catch((err) => {
on_error(err.msg);
});
}
PS:
- I removed the "<object id="pcm" height="0" width="0" classid="clsid:48A185F1-FFDB-11D3-80E3-00C04F176153"></object>" line
- I included the simple-jsonrpc-js.js and the freemaster-client.js files
- I created the PCM object: pcm = new PCM("localhost:41000", on_connected, on_error, on_error);
- I use the example.htm file from the FreeMaster installation folder to avoid syntax errors in the basic methods
I'm looking forward to an answer and thanks for any suggestions.
Best regards,
Kornel Lengl