public static void Init(string manifestFile, int httpPort, int dsspPort) { if (bank == null) { Robot.httpPort = httpPort; Robot.dsspPort = dsspPort; FileAttributes att = File.GetAttributes(manifestFile); if ((att & (FileAttributes.Device | FileAttributes.Directory | FileAttributes.Offline)) != 0) { throw new IOException("Manifest file is not a normal file"); } Console.Write("Starting DSS environment..."); DssEnvironment.Initialize(httpPort, dsspPort, "file://" + manifestFile); Console.WriteLine("Done"); bank = new AdapterBank(new List <IAdapterFactory>() { new Myro.Adapters.DriveAdapterFactory(), new Myro.Adapters.VectorAdapterFactory(), new Myro.Adapters.WebcamAdapterFactory(), new Myro.Adapters.CamControlAdapterFactory() }); driveAdapter = bank.GetAdapterSpec <DriveAdapter>("drive"); soundAdapter = bank.GetAdapterSpec <VectorAdapter>("tonegen"); webcamAdapter = bank.GetAdapterSpec <WebcamAdapter>("webcam"); camcontrolAdapter = bank.GetAdapterSpec <CamControlAdapter>("camcontrol"); } else { throw new Exception("Myro is already initialized"); } }
/// <summary> /// This is an internal helper method that creates the AdapterBank, and /// caches the pre-known adapters. /// </summary> private static void createAdapters() { bank = new AdapterBank(new List <IAdapterFactory>() { new Myro.Adapters.DriveAdapterFactory(), new Myro.Adapters.VectorAdapterFactory(), new Myro.Adapters.WebcamAdapterFactory(), new Myro.Adapters.FlukeControlAdapterFactory() }); driveAdapter = bank.GetAdapterSpec <DriveAdapter>("drive"); soundAdapter = bank.GetAdapterSpec <VectorAdapter>("tonegen"); webcamAdapter = bank.GetAdapterSpec <WebcamAdapter>("webcam"); controlAdapter = bank.GetAdapterSpec <FlukeControlAdapter>("flukecontrol"); }
public double[] get(string name) { //try //{ return(((Myro.Adapters.VectorAdapter)bank.GetAdapterSpec(name).Adapter).GetAllElements().ToArray()); //} //catch (Exception) //{ return new double[] { 0.0 }; } }
/// <summary> /// This is an internal helper method that creates the AdapterBank, and /// caches the pre-known adapters. /// </summary> private static void createAdapters() { bank = new AdapterBank(new List<IAdapterFactory>() { new Myro.Adapters.DriveAdapterFactory(), new Myro.Adapters.VectorAdapterFactory(), new Myro.Adapters.WebcamAdapterFactory(), new Myro.Adapters.FlukeControlAdapterFactory() }); driveAdapter = bank.GetAdapterSpec<DriveAdapter>("drive"); soundAdapter = bank.GetAdapterSpec<VectorAdapter>("tonegen"); webcamAdapter = bank.GetAdapterSpec<WebcamAdapter>("webcam"); controlAdapter = bank.GetAdapterSpec<FlukeControlAdapter>("flukecontrol"); }
public double[] Get(string name) { return(bank.GetAdapterSpec <VectorAdapter>(name).Adapter.GetAllElements().ToArray()); }