/* 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. 2013 All rights reserved. */ using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ANT_Managed_Library { /// /// Container for all the USB Device information, returned from an ANTDevice /// public class ANT_DeviceInfo { /// /// USB Device Product Description /// public byte[] productDescription; /// /// USB Device Serial String /// public byte[] serialString; internal ANT_DeviceInfo(byte[] productDescription, byte[] serialString) { this.productDescription = productDescription; this.serialString = serialString; } /// /// Returns a formatted, readable string for the product description /// public String printProductDescription() { return printBytes(productDescription); } /// /// Returns a formatted, readable string for the serial string /// public String printSerialString() { return printBytes(serialString); } private String printBytes(byte[] rawBytes) { // Decode as null terminated ASCII string string formattedString = System.Text.Encoding.ASCII.GetString(rawBytes); return (formattedString.Remove(formattedString.IndexOf('\0'))); } }; }