Author Topic: C# class library  (Read 14246 times)

micro-systems

  • Guest
C# class library
« on: May 12, 2020, 03:29:48 PM »
Hi,
yesterday I purchased the C# Bluetooth Framework library.
My intention is to create a C# class library with Visual Studio.
My test source code:

Code: [Select]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using wclCommon;
using wclBluetooth;

namespace ManagedBLE
{
    public class ManagedBLE
    {
        private wclBluetoothManager Manager;

        public void Open()
        {
            Manager = new wclBluetoothManager();
            Manager.AfterOpen += new EventHandler(Manager_AfterOpen);
            Manager.OnDiscoveringStarted += new wclBluetoothEvent(Manager_OnDiscoveringStarted);
            Manager.OnDeviceFound += new wclBluetoothDeviceEvent(Manager_OnDeviceFound);
            Manager.Open();
        }

        void Manager_AfterOpen(object sender, EventArgs e)
        {
            wclBluetoothRadio Radio = (wclBluetoothRadio)Manager[0];
            Int32 Res = Radio.Discover(10, wclBluetoothDiscoverKind.dkBle);
        }

        void Manager_OnDiscoveringStarted(object Sender, wclBluetoothRadio Radio)
        {

        }
       
        void Manager_OnDeviceFound(object Sender, wclBluetoothRadio Radio, long Address)
        {

        }

    }
}

An external executable call the Open() function, available by the library, AfterOpen event is triggered, but OnDiscoveringStarted event is never triggered.
Is it possible to create a library or does it work only for windows forms?
Do you have any suggestions on this?
Thanks for your valuable support

Tavella Fabrizio
Micro Systems
Italy

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: C# class library
« Reply #1 on: May 12, 2020, 03:35:36 PM »
Hi,

You can find a "short" answer by this link: https://forum.btframework.com/index.php?topic=3520.msg9021#msg9021

I do not receomend to use skNone. Use skApc instead (refer to APC and Console demo applications from Bluetooth Framework package).

 

Sitemap 1 2 3 4 5 6 7