/* This software is subject to the license described in the License.txt file included with this software distribution. You may not use this file except in compliance with this license. Copyright (c) Dynastream Innovations Inc. 2016 All rights reserved. */ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.InteropServices; namespace ANT_Managed_Library.ANTFS { /// /// ANT-FS Client Parameters. /// The application should initialize ALL fields of the configuration struct, /// otherwise, they will all be zero /// [StructLayout(LayoutKind.Sequential)] public struct ANTFS_ClientParameters { /// /// Device serial number. Set to 0 to use the serial number of the USB device /// public uint SerialNumber; /// /// Client device type (transmitted in beacon) /// public ushort BeaconDeviceType; /// /// Client manufacturing ID (transmitted in beacon) /// public ushort BeaconManufacturerID; /// /// Radio frequency to use while in Link state. /// public byte BeaconRadioFrequency; /// /// Beacon Period, as described in the ANT-FS Technology specification /// [MarshalAs(UnmanagedType.U1)] public BeaconPeriod LinkPeriod; /// /// Indicates whether pairing authentication is enabled /// [MarshalAs(UnmanagedType.Bool)] public bool IsPairingEnabled; /// /// Indicates whether upload functionality is supported /// [MarshalAs(UnmanagedType.Bool)] public bool IsUploadEnabled; /// /// Indicates whether there is data available for download /// [MarshalAs(UnmanagedType.Bool)] public bool IsDataAvailable; /// /// Authentication type to include in beacon, as described in the ANT-FS Technology specification /// [MarshalAs(UnmanagedType.U1)] public AuthenticationType AuthenticationType; /// /// Time, in seconds, that the client will wait without receiving any commands from the host before dropping to Link state. /// Set to 255 to disable. Zero is NOT a valid value. /// public byte BeaconTimeout; /// /// Time, in seconds, that the client library will wait for a response from the application to a pairing request. /// public byte PairingTimeout; /// /// ANTFS_ClientParameters, with the default beacon parameters /// /// Client device type /// Client manufacturing ID public ANTFS_ClientParameters(ushort deviceType, ushort manufacturerID) { // Default beacon configuration: Match unmanaged ANTFSClient::SetDefaultBeacon BeaconDeviceType = deviceType; BeaconManufacturerID = manufacturerID; SerialNumber = 0; // Use the USB device serial number by default BeaconRadioFrequency = 50; // ANT-FS RF Frequency LinkPeriod = BeaconPeriod.EightHz; IsPairingEnabled = true; IsUploadEnabled = false; IsDataAvailable = false; AuthenticationType = AuthenticationType.Pairing; BeaconTimeout = 60; // In seconds PairingTimeout = 5; // In seconds } } }