Class ConnectionStateChangedEventArgs

    Definition

    Namespace:
    Tizen.Network.WiFiDirect
    Assembly:
    Tizen.Network.WiFiDirect.dll

    An extended EventArgs class which contains the changed connection state during connecting or disconnecting the peer device. This event is triggered when the connection state with a specific peer device changes.

    public class ConnectionStateChangedEventArgs : EventArgs
    Inheritance
    object
    System.EventArgs
    ConnectionStateChangedEventArgs
    Remarks

    This event is raised by the ConnectionStateChanged event. Use this event to monitor connection progress and handle connection state changes such as:

    • Connection request initiated
    • WPS (Wi-Fi Protected Setup) in progress
    • Connection established
    • Disconnection initiated or completed
    • Group creation/destruction events

    Example usage:

    peer.ConnectionStateChanged += (sender, e) =>
    {
        if (e.Error == WiFiDirectError.None)
        {
            switch (e.State)
            {
                case WiFiDirectConnectionState.ConnectionRsp:
                    Console.WriteLine($"Connected to peer: {e.MacAddress}");
                    break;
                case WiFiDirectConnectionState.DisconnectRsp:
                    Console.WriteLine($"Disconnected from peer: {e.MacAddress}");
                    break;
            }
        }
        else
        {
            Console.WriteLine($"Connection error: {e.Error}");
        }
    };

    Properties

    View Source

    Error

    The Wi-Fi Direct operation result. Indicates whether the state change was successful or if an error occurred.

    Declaration
    public WiFiDirectError Error { get; }
    Property Value
    Type Description
    WiFiDirectError

    None if successful, otherwise the specific error code.

    Remarks

    This event is raised by the ConnectionStateChanged event. Use this event to monitor connection progress and handle connection state changes such as:

    • Connection request initiated
    • WPS (Wi-Fi Protected Setup) in progress
    • Connection established
    • Disconnection initiated or completed
    • Group creation/destruction events

    Example usage:

    peer.ConnectionStateChanged += (sender, e) =>
    {
        if (e.Error == WiFiDirectError.None)
        {
            switch (e.State)
            {
                case WiFiDirectConnectionState.ConnectionRsp:
                    Console.WriteLine($"Connected to peer: {e.MacAddress}");
                    break;
                case WiFiDirectConnectionState.DisconnectRsp:
                    Console.WriteLine($"Disconnected from peer: {e.MacAddress}");
                    break;
            }
        }
        else
        {
            Console.WriteLine($"Connection error: {e.Error}");
        }
    };
    View Source

    MacAddress

    The MAC address of the peer device whose connection state changed. This uniquely identifies the peer device in the connection event.

    Declaration
    public string MacAddress { get; }
    Property Value
    Type Description
    string

    The MAC address string of the peer device (e.g., "AA:BB:CC:DD:EE:FF").

    Remarks

    This event is raised by the ConnectionStateChanged event. Use this event to monitor connection progress and handle connection state changes such as:

    • Connection request initiated
    • WPS (Wi-Fi Protected Setup) in progress
    • Connection established
    • Disconnection initiated or completed
    • Group creation/destruction events

    Example usage:

    peer.ConnectionStateChanged += (sender, e) =>
    {
        if (e.Error == WiFiDirectError.None)
        {
            switch (e.State)
            {
                case WiFiDirectConnectionState.ConnectionRsp:
                    Console.WriteLine($"Connected to peer: {e.MacAddress}");
                    break;
                case WiFiDirectConnectionState.DisconnectRsp:
                    Console.WriteLine($"Disconnected from peer: {e.MacAddress}");
                    break;
            }
        }
        else
        {
            Console.WriteLine($"Connection error: {e.Error}");
        }
    };
    View Source

    State

    The Wi-Fi Direct connection state of the peer. Represents the current state in the connection lifecycle.

    Declaration
    public WiFiDirectConnectionState State { get; }
    Property Value
    Type Description
    WiFiDirectConnectionState

    A WiFiDirectConnectionState enum value indicating the current connection state.

    Remarks

    This event is raised by the ConnectionStateChanged event. Use this event to monitor connection progress and handle connection state changes such as:

    • Connection request initiated
    • WPS (Wi-Fi Protected Setup) in progress
    • Connection established
    • Disconnection initiated or completed
    • Group creation/destruction events

    Example usage:

    peer.ConnectionStateChanged += (sender, e) =>
    {
        if (e.Error == WiFiDirectError.None)
        {
            switch (e.State)
            {
                case WiFiDirectConnectionState.ConnectionRsp:
                    Console.WriteLine($"Connected to peer: {e.MacAddress}");
                    break;
                case WiFiDirectConnectionState.DisconnectRsp:
                    Console.WriteLine($"Disconnected from peer: {e.MacAddress}");
                    break;
            }
        }
        else
        {
            Console.WriteLine($"Connection error: {e.Error}");
        }
    };
    • View Source
    Back to top Copyright © 2016-2025 Samsung
    Generated by DocFX