コード例 #1
0
        protected void AddChangeOfValueSignal(IAdapterProperty Property)
        {
            var covSignal      = new BridgeAdapterSignal(Constants.CHANGE_OF_VALUE_SIGNAL);
            var propertyHandle = new BridgeAdapterValue(Constants.COV__PROPERTY_HANDLE, null);
            var attrHandle     = new BridgeAdapterValue(Constants.COV__ATTRIBUTE_HANDLE, null);

            covSignal.Params.Add(propertyHandle);
            covSignal.Params.Add(attrHandle);
            this.Signals.Add(covSignal);
        }
コード例 #2
0
        public BridgeAdapter(string adapterName)
        {
            Windows.ApplicationModel.Package        package        = Windows.ApplicationModel.Package.Current;
            Windows.ApplicationModel.PackageId      packageId      = package.Id;
            Windows.ApplicationModel.PackageVersion versionFromPkg = packageId.Version;

            this.Vendor      = "win10";
            this.AdapterName = adapterName;

            // the adapter prefix must be something like "com.mycompany" (only alpha num and dots)
            // it is used by the Device System Bridge as root string for all services and interfaces it exposes
            this.ExposedAdapterPrefix   = "com." + this.Vendor.ToLower();
            this.ExposedApplicationGuid = Guid.Parse("{0x6516a3e3,0xcc3e,0x4c67,{0xb7,0x5f,0x73,0x75,0x8b,0x09,0x23,0xae}}");

            if (null != package && null != packageId)
            {
                this.ExposedApplicationName = packageId.Name;
                this.Version = versionFromPkg.Major.ToString() + "." +
                               versionFromPkg.Minor.ToString() + "." +
                               versionFromPkg.Revision.ToString() + "." +
                               versionFromPkg.Build.ToString();
            }
            else
            {
                this.ExposedApplicationName = "DeviceSystemBridge";
                this.Version = "0.0.0.0";
            }

            this.Signals         = new List <IAdapterSignal>();
            this.devices         = new List <IAdapterDevice>();
            this.signalListeners = new Dictionary <int, IList <SIGNAL_LISTENER_ENTRY> >();

            // Device Arrival Signal
            var deviceArrivalSignal  = new BridgeAdapterSignal(Constants.DEVICE_ARRIVAL_SIGNAL);
            var deviceHandle_arrival = new BridgeAdapterValue(Constants.DEVICE_ARRIVAL__DEVICE_HANDLE, null);

            deviceArrivalSignal.Params.Add(deviceHandle_arrival);
            this.Signals.Add(deviceArrivalSignal);

            // Device Removal Signal
            var deviceRemovalSignal  = new BridgeAdapterSignal(Constants.DEVICE_REMOVAL_SIGNAL);
            var deviceHandle_removal = new BridgeAdapterValue(Constants.DEVICE_REMOVAL__DEVICE_HANDLE, null);

            deviceRemovalSignal.Params.Add(deviceHandle_removal);
            this.Signals.Add(deviceRemovalSignal);
        }