34 lines
743 B
TypeScript
34 lines
743 B
TypeScript
|
/**
|
||
|
* @author Martin Karkowski
|
||
|
* @email m.karkowski@zema.de
|
||
|
* @create date 2020-03-02 11:41:13
|
||
|
* @modify date 2020-03-02 11:46:11
|
||
|
* @desc [description]
|
||
|
*/
|
||
|
|
||
|
export function generateOptions(options: {
|
||
|
name: string;
|
||
|
host: string;
|
||
|
amsNetIdTarget: string;
|
||
|
amsNetIdSource: string;
|
||
|
twinCatVersion: 2 | 3;
|
||
|
port?: number;
|
||
|
amsPortSource?: number;
|
||
|
amsPortTarget?: number;
|
||
|
timeout?: number;
|
||
|
}) {
|
||
|
return Object.assign(
|
||
|
{
|
||
|
//The tcp destination port
|
||
|
port: 48898,
|
||
|
//The ams source port
|
||
|
amsPortSource: 32905,
|
||
|
//The ams target port for TwinCat 2 Runtime 1
|
||
|
amsPortTarget: options.twinCatVersion === 2 ? 801 : 851,
|
||
|
//The timeout for PLC requests
|
||
|
timeout: 500
|
||
|
},
|
||
|
options
|
||
|
);
|
||
|
}
|