Closed ny4i closed 1 year ago
Here is the code.
procedure SendParameterToNetwork();
var
Row : integer;
begin
if NetSocket = 0 then Exit;
Row := ListView_GetNextItem(SettingshLV, -1, LVNI_SELECTED);
if CommandsFilter <> cfCol then
if CFGCA[IndexArray[Row + 1]].crJ = 2 then Exit;
Windows.ZeroMemory(@ParameterToNetwork.pnCommand, SizeOf(ParameterToNetwork.pnCommand) + SizeOf(ParameterToNetwork.pnValue));
{(*}
ParameterToNetwork.pnCommand[0] := Char(ListView_GetItemText(SettingshLV, Row, COMMAND_FIELD, @ParameterToNetwork.pnCommand[1], SizeOf(ParameterToNetwork.pnCommand)));
ParameterToNetwork.pnValue[0] := Char(ListView_GetItemText(SettingshLV, Row, VALUE_FIELD, @ParameterToNetwork.pnValue[1], SizeOf(ParameterToNetwork.pnValue)));
{*)}
SendToNet(ParameterToNetwork, SizeOf(ParameterToNetwork));
end;
By adding another flag to the CFGRecord such as crNetwork, then only those items with a value of 1 would be sent to network.
Here is CFGRecord (line 84 in uCFG):
CFGRecord = record
{(*}
{04}crCommand : PChar;
{04}crAddress : Pointer;
{02}crMin : Word;
{02}crMax : Word;
{01}crS : CFGStatus;
{01}crA : Byte;//additional proc
{01}crC : Byte;//1-write to CFG file,
{01}crP : Byte;//Procedure 0-no proc,
{01}crJ : Byte;//0-edit, 1 -edit+restart, 2-readonly,3-message(ro)
{01}crKind : CFGKind;
{01}cfFunc : CFGFunc;
{01}crType : CFGType;
{*)}
end;
As described above, added crNetwork to each command. If crNetwork NOT = 0, we send the command to the network. Also, in the Config dialog, the description adds Sent to Network or NOT sent to Network as the case may be. The debug log will also show if the SendParameterToNetwork function exists early due to crNetwork = 0 (if DEBUG or TRACE is set).
This has to be tested yet as I have not setup a second instance yet.
Look at the CFGCA array around line 332 in uCFG for the parameters set to 0 or 1. crNetwork is at the end of each command declaration.
During set for Field Day, I clicked To Network (which calls SendParameterToNetwork in uOption). I discovered this sends all the options to the other stations. This is not optimal. For example, COMPUTER ID is sent to the others which is bad. There should be code added to exclude certain fields. A good way to do it would be to add this to the command array to indicate if the parameter should be sent to the network and only send those.