nope/modules/mod-Beckhoff-PLC-Interface/helpers/gen.options.ts
2020-12-01 13:03:37 +01:00

30 lines
708 B
TypeScript

/**
* @author Martin Karkowski
* @email m.karkowski@zema.de
* @create date 2020-03-02 11:41:13
* @modify date 2020-12-01 13:01:52
* @desc [description]
*/
import { IBeckhoffOptions } from "../type/interfaces";
/**
* Function to generate ADS-Connection Options.
* @param options
*/
export function generateOptions(options: IBeckhoffOptions) {
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
) as IBeckhoffOptions;
}