I have two subnero WNC-M25MSS3 modems, my goal is to realize a 2 nodes network. They are made of co-processor and Janus protocol. During my future deployment at sea, the modem named A will be located on the surface and the modem B in depth, I could connect to the shell of the modem A in order to carry out the commands of the scripts which I created there. My goal is the following: I must requisition data from B when I enter the command line "requestData" in the shell of A. To do this, once the command line is entered, this will generate a Janus message with data inside which will be transmitted to B. When B receives the message, it should automatically respond with the data. This is where I get stuck, I have created the data transmission scripts for both modems, but I can't find a way to make B "listen", i.e. wait for the message from A, as soon as it receives it, transmit the data and then listen again.
Here is the function of modem A to call a transmission:
B = host('B');
subscribe phy;
int counterA = 3; // counter which will create in the future
int ID = 0; // Transmitting to everybody
int [] request = new int[2];
request[0] = counterA; // Data is create in a table
request[1] = ID;
// request[2] = ; ????
phy << new TxJanusFrameReq(type: CONTROL, data: request, to: ID); // Transmission of data with Janus
Here is the infinite loop that I created on modem B so that it transmits with "sendData" once a message is received: it is here that I get stuck
subscribe phy;
while(RxFrameNtf != true){
//receivedData = [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
//receivedData = ntf.data;
try{
try { //wait 5 seconds function
Thread.sleep(5000) ;
} catch (InterruptedException e) {
// gestion de l'erreur
}
receivedData = ntf.data; // Analyse the receiving data
}catch (Exception e){
//println([receivedData]);
println("No data yet");
//tampomEvent;
}
//println([receivedData]);
}
println("Amazing, you're out now!!!");
if(ntf.data[1] == 0){
println("OK");
sendData;
}