zensysupnpdevice.cs

来自「zwave 无线通讯协议 PC controller 控制器源码」· CS 代码 · 共 101 行

CS
101
字号
//////////////////////////////////////////////////////////////////////////////////////////////// 
//
//          #######
//          #   ##    ####   #####    #####  ##  ##   #####
//             ##    ##  ##  ##  ##  ##      ##  ##  ##
//            ##  #  ######  ##  ##   ####   ##  ##   ####
//           ##  ##  ##      ##  ##      ##   #####      ##
//          #######   ####   ##  ##  #####       ##  #####
//                                           #####
//          Z-Wave, the wireless language.
//
//          Copyright Zensys A/S, 2003,2004
//
//          All Rights Reserved
//
//          Description:   This source file is the sourcefile for the
//                         ZensysUPnPDevice class, which all Zensys UPnP devices should
//                         derive from
//
//          Author:   Johann Sigfredsson
//
//          Last Changed By:  $Author: jch $
//          Revision:         $Revision: 1.1 $
//          Last Changed:     $Date: 2006/03/31 14:30:46 $
//
//////////////////////////////////////////////////////////////////////////////////////////////

using System;
using Intel.UPNP;
using Zensys.ZWave.Communication;
using Zensys.ZCmdClass;
using Zensys.ZWave.Logging;

namespace Zensys
{
	/// <summary>
	/// Summary description for Class1.
	/// </summary>
	public class ZensysUPnPDevice : ZensysBridgedDevice
  {
    /* This should be extended with new UPnP device types when needed */
    public enum UPnPDeviceTypes : byte
    {
      Unknown,
      BinaryLight,
      AVRenderer,
    }

    protected UPnPDeviceTypes deviceUPnPType = UPnPDeviceTypes.Unknown;  /* Default */

    public override byte NodeId {get {return nodeId;} set {if (((value >= 0) && (value <= 232)) || (value == 0xff)) nodeId = value;}}
    public UPnPDevice Device {get {return device as UPnPDevice;} set {device = value as object;}}
    public UPnPDeviceTypes DeviceUPnPType {get {return deviceUPnPType;} set {deviceUPnPType = value;}}

    public ZensysUPnPDevice()
		{
    }

    public void ZensysUPnPDownDeviceInit(ZensysUPnPDevice.UPnPDeviceTypes devUPnPType, ZWaveDeviceTypes devType, byte Id, ZWaveLogging log)
    {
      deviceUPnPType = devUPnPType;
      ZensysBridgeDeviceInit(ZensysBridgedDevice.ZWaveBridgeTypes.UPnP, devType, Id, log);
    }

    public void ZensysUPnPUpDeviceInit(ZensysUPnPDevice.UPnPDeviceTypes devUPnPType, ZWaveDeviceTypes devType, byte Id, ZWaveLogging log)
    {
      deviceUPnPType = devUPnPType;
      ZensysBridgeDeviceInit(ZensysBridgedDevice.ZWaveBridgeTypes.UPnP2ZWave, devType, Id, log);
    }

    public override void Start()
    {
      try
      {
        base.Start();
        Device.StartDevice();
      }
      catch (Exception)
      {
      }
    }

    public override void Stop()
    {
      try
      {
        base.Stop();
        Device.StopDevice();
      }
      catch (Exception)
      {
      }
    }

    public override string ToString()
    {
      return "UPnPDeviceBase";
    }
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?