Ejemplo n.º 1
0
        public void InitializeDataSource()
        {
            var    assembly = Assembly.GetCallingAssembly();
            string key;

            using (Stream stream = assembly.GetManifestResourceStream("TrignoEmg.PublicKey.lic"))
            {
                StreamReader sr = new StreamReader(stream);
                key = sr.ReadLine();
            }
            string license;

            using (Stream stream = assembly.GetManifestResourceStream("TrignoEmg.OpenFeasyo.lic"))
            {
                StreamReader sr = new StreamReader(stream);
                license = sr.ReadToEnd();
            }

#if ANDROID
            var deviceSourceCreator = new DelsysAPI.Android.DeviceSourcePortable(key, license);
#else
            var deviceSourceCreator = new DelsysAPI.NET.DeviceSourcePortable(key, license);
#endif
            deviceSourceCreator.SetDebugOutputStream(Console.WriteLine);

            DeviceSource         = deviceSourceCreator.GetDataSource(SourceType.TRIGNO_BT);
            DeviceSource.Key     = key;
            DeviceSource.License = license;
            LoadDataSource(DeviceSource);
        }
Ejemplo n.º 2
0
        public void InitializeDataSource()
        {
            // Load your key & license either through reflection as shown in the User Guide, or by hardcoding it to these strings.
            // Load your license and key files
            // This tutorial assumes you have them contained in embedded resources named PublicKey.lic and License.lic, as part of
            // a solution with an output executable called BasicExample.
            var    assembly = Assembly.GetExecutingAssembly();
            string key;

            using (Stream stream = assembly.GetManifestResourceStream("Basic_Streaming.NET.APIKey.lic")) // Change the name of the .lic file accordingly
            {
                StreamReader sr = new StreamReader(stream);
                key = sr.ReadLine();
            }
            string lic;

            using (Stream stream = assembly.GetManifestResourceStream("Basic_Streaming.NET.License.lic")) // Change the name of the .lic file accordingly
            {
                StreamReader sr = new StreamReader(stream);
                lic = sr.ReadToEnd();
            }

            // The API uses a factory method to create the data source of your application.
            // This creates the factory method, which will then give the data source for your platform.
            // In this case the platform is BT.
            var deviceSourceCreator = new DelsysAPI.NET.DeviceSourcePortable(key, lic);

            // Sets the output stream for debugging information from the API. This could be a file stream,
            // but in this example we simply use the Console.WriteLine output stream.
            deviceSourceCreator.SetDebugOutputStream(Console.WriteLine);
            // Here is where we tell the factory method what type of data source we want to receive,
            // which we then set a reference to for future use.
            DeviceSource = deviceSourceCreator.GetDataSource(SourceType.TRIGNO_BT);
            // Here we use the key and license we previously loaded.
            DeviceSource.Key     = key;
            DeviceSource.License = lic;
            // Load source
            LoadDataSource(DeviceSource);
            // Create a reference to the first Pipeline (which was generated by the factory method above)
            // for easier access to various objects within the API.
            BTPipeline       = PipelineController.Instance.PipelineIds[0];
            TransformManager = PipelineController.Instance.PipelineIds[0].TransformManager;

            // Just setting up some of the necessary callbacks from the API.
            BTPipeline.CollectionStarted                     += CollectionStarted;
            BTPipeline.CollectionDataReady                   += CollectionDataReady;
            BTPipeline.CollectionComplete                    += CollectionComplete;
            BTPipeline.TrignoBtManager.ComponentAdded        += ComponentAdded;
            BTPipeline.TrignoBtManager.ComponentLost         += ComponentLost;
            BTPipeline.TrignoBtManager.ComponentRemoved      += ComponentRemoved;
            BTPipeline.TrignoBtManager.ComponentScanComplete += ComponentScanComplete;

            // The component manager is how you reference specific / individual sensors so creating
            // a reference to it will shorten a lot of calls.
            var ComponentManager = PipelineController.Instance.PipelineIds[0].TrignoBtManager;
        }
        public void InitializeDataSource()
        {
            // Load your key & license either through reflection as shown in the User Guide, or by hardcoding it to these strings.
            string key     = "";
            string license = "";

            var deviceSourceCreator = new DelsysAPI.NET.DeviceSourcePortable(key, license);

            deviceSourceCreator.SetDebugOutputStream(Console.WriteLine);
            DeviceSource         = deviceSourceCreator.GetDataSource(SourceType.TRIGNO_BT);
            DeviceSource.Key     = key;
            DeviceSource.License = license;
            LoadDataSource(DeviceSource);
        }