SerialPortEnums.cs :  » Development » SerialPort » OpenNETCF » IO » Ports » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Development » SerialPort 
SerialPort » OpenNETCF » IO » Ports » SerialPortEnums.cs
using System;
using System.ComponentModel;

namespace OpenNETCF.IO.Ports{
  #region Enumerations

  [Flags]
  public enum SerialErrors
  {
    /// <summary>
    /// An input buffer overflow has occurred. There is either no room in the input buffer,
    /// or a character was received after the end-of-file (EOF) character.
    /// </summary>
    [Description("Receive Overflow")]  RxOver = 1,

    /// <summary>
    /// A character-buffer overrun has occurred. The next character is lost.
    /// </summary>
    [Description("Buffer Overrun")]    Overrun = 2,

    /// <summary>
    /// The hardware detected a parity error.
    /// </summary>
    [Description("Parity Error")]    RxParity = 4,

    /// <summary>
    /// The hardware detected a framing error.
    /// </summary>
    [Description("Framing Error")]    Frame = 8,

    /// <summary>
    /// The application tried to transmit a character, but the output buffer was full.
    /// </summary>
    [Description("Transmit Full")]    TxFull = 256,
  }

  [Flags]
  public enum SerialPinChanges
  {
    [Description("CTS Changed")]  CtsChanged  = 8,
    [Description("DSR Changed")]  DsrChanged  = 16,
    [Description("CD Changed")]    CDChanged  = 32,
    [Description("Break")]      Break    = 64,
    [Description("Ring")]      Ring    = 256,
  }

  [Flags]
  public enum SerialReceived
  {
    [Description("Received Chars")]  ReceivedChars  = 1,
    [Description("End of Receive")]  EofReceived    = 2,
  }

  [Flags]
  public enum StopBits
  {
    [Description("1")]    One       = 1,
    [Description("1.5")]  OnePointFive = 2,
    [Description("2")]    Two       = 4,
  }

  public enum Handshake
  {
    [Description("None")]    None         = 0,
    [Description("Xon/Xoff")]  XOnXOff         = 1,
    [Description("RTS")]    RequestToSend     = 2,
    [Description("Xon/RTS")]  RequestToSendXOnXOff = 3,
  }

  public enum Parity
  {
    [Description("None")]  None  = 0,
    [Description("Odd")]  Odd    = 1,
    [Description("Even")]  Even  = 2,
    [Description("Mark")]  Mark  = 3,
    [Description("Space")]  Space  = 4,
  }

  #endregion

  #region Delegates and Events

  public class SerialErrorEventArgs : EventArgs
  {
    private SerialErrors _EventType;

    public SerialErrors EventType
    {
      get { return _EventType; }
    }

    public SerialErrorEventArgs(SerialErrors eventType)
    {
      _EventType = eventType;
    }

    public override string ToString()
    {
      return "UART Error: " + Enum.Format(typeof(SerialErrors), EventType, "G");
    }

  }

  public class SerialPinChangedEventArgs : EventArgs
  {
    private SerialPinChanges _EventType;

    public SerialPinChanges EventType
    {
      get { return _EventType; }
    }

    public SerialPinChangedEventArgs(SerialPinChanges eventType)
    {
      _EventType = eventType;
    }

    public override string ToString()
    {
      return "Serial Pin Changed: " + Enum.Format(typeof(SerialPinChanges), EventType, "G");
    }
  }

  public class SerialReceivedEventArgs : EventArgs
  {
    private SerialReceived _EventType;

    public SerialReceived EventType
    {
      get { return _EventType; }
    }

    public SerialReceivedEventArgs(SerialReceived eventType)
    {
      _EventType = eventType;
    }

    public override string ToString()
    {
      return "Serial Received Event: " + Enum.Format(typeof(SerialReceived), EventType, "G");
    }
  }

  /// <summary>
  /// Represents the method that will handle the event of a SerialPort object.
  /// </summary>
  public delegate void SerialErrorEventHandler(object sender, SerialErrorEventArgs e);

  /// <summary>
  /// Represents the method that will handle the PinChangedEvent event of a SerialPort object.
  /// </summary>
  public delegate void SerialPinChangedEventHandler(object sender, SerialPinChangedEventArgs e);

  /// <summary>
  /// Represents the method that will handle the ReceivedEvent event of a SerialPort object.
  /// </summary>
  public delegate void SerialReceivedEventHandler(object sender, SerialReceivedEventArgs e);

  #endregion
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.