Search Results for

    Show / Hide Table of Contents

    Class IpcQueue

    This type represents an Ipc queue, which can be used to send data between the controller and its clients. IPC can be used with RW 5.10 and later. Messages can be sent to the queue from other clients who knows the queue id. Only the creator of the queue can recieve messages from the queue.

    Inheritance
    Object
    NamedObject
    SDKBase
    IpcQueue
    Implements
    IComparable
    INamedObject
    IDisposable
    Inherited Members
    SDKBase.Dispose()
    SDKBase.Dispose(Boolean)
    NamedObject.Equals(String)
    NamedObject.Equals(NamedObject)
    NamedObject.Equals(Object)
    NamedObject.CompareTo(String)
    NamedObject.CompareTo(NamedObject)
    NamedObject.CompareTo(Object)
    NamedObject.GetHashCode()
    NamedObject.ToString()
    NamedObject.Name
    Namespace: ABB.Robotics.Controllers.Messaging
    Assembly: ABB.Robotics.Controllers.PC.dll
    Syntax
    public class IpcQueue : SDKBase, IComparable, INamedObject, IDisposable
    Remarks

    Messages must be sent and recieved from a MTA thread. This means that you shall not send and recieve messages from the UI thread. See Receive(Int32, IpcMessage) for more information.

    Properties

    Capacity

    Returns the capacity (max number of elements) of the queue.

    Declaration
    public int Capacity { get; }
    Property Value
    Type Description
    Int32

    MessageSizeLimit

    Returns the size limitation for a message.

    Declaration
    public int MessageSizeLimit { get; }
    Property Value
    Type Description
    Int32

    QueueId

    Returns the ID of the Ipc queue.

    Declaration
    public int QueueId { get; }
    Property Value
    Type Description
    Int32

    QueueName

    Returns the name of the Ipc queue.

    Declaration
    public string QueueName { get; }
    Property Value
    Type Description
    String

    RemoteAccessible

    Specifies whether the queue is remotely accessible or not.

    Declaration
    public bool RemoteAccessible { get; }
    Property Value
    Type Description
    Boolean

    Methods

    Receive(Int32, IpcMessage)

    This method receives a message from the queue.

    Declaration
    public IpcReturnType Receive(int Timeout, IpcMessage Msg)
    Parameters
    Type Name Description
    Int32 Timeout

    A timeout value in milliseconds.

    IpcMessage Msg

    The received message (if any).

    Returns
    Type Description
    IpcReturnType

    The result of the call.

    Remarks

    IPC can only be used with RW 5.10 and later.

    This method must be called from a MTA thread. Create a separate reciever thread and use the method Thread.SetApartmentState() to set the apartment state to MTA before starting it.

    Calls to this method are blocking.

    Examples

    This example creates a queue and then tries to read a message from it.

    Controller c = new Controller();

    IpcQueue rabQueue = c.Ipc.CreateQueue("RABQueue", 5, Ipc.MaxMessageSize); IpcMessage message = new IpcMessage(Ipc.MaxMessageSize);

    rabQueue.Receive(1000, message);

    // Expecting IPC message data of type string. Convert it for later use. string messageData = new UTF8Encoding().GetString(message.Data);

    Exceptions
    Type Condition
    ArgumentException

    QueueId is invalid.

    Send(IpcMessage)

    This method sends a message to a RAPID queue.

    Declaration
    public void Send(IpcMessage Message)
    Parameters
    Type Name Description
    IpcMessage Message

    The message to send.

    Remarks

    IPC can only be used with RW 5.10 and later.

    There must be code to receive the message in the RAPID program.

    No mastership is required to send a message.

    This method must be called from a MTA thread. Create a separate sender thread and use the method Thread.SetApartmentState() to set the apartment state to MTA before starting it.

    Examples

    In this example a message (string;"test") is sent to a RAPID queue.

    private void SendData()
    {
        Controller c = new Controller();
        IpcQueue rapidQueue = c.Ipc.GetQueue("RMQ_T_ROB1");
        IpcMessage message = new IpcMessage();
        Byte[] data = new UTF8Encoding().GetBytes("string;\"test\"");
        message.SetData(data);
        rapidQueue.Send(message);
    }

    Send(Int32, Int32, Int32, Int32, Byte[])

    This method sends a message to the queue.

    Declaration
    public void Send(int Sender, int Cmd, int UserDef, int UserData, byte[] Data)
    Parameters
    Type Name Description
    Int32 Sender

    The sender of the message

    Int32 Cmd

    The type of command

    Int32 UserDef

    A user defined value

    Int32 UserData

    User information

    Byte[] Data

    The data that will be sent

    Remarks

    This method must be called from a MTA thread. Create a separate sender thread and use the method Thread.SetApartmentState() to set the apartment state to MTA before starting it.

    Examples

    Controller c = new Controller();

    IpcQueue rapidQueue = c.Ipc.GetQueue("RMQ_T_ROB1");

    Byte[] data = new UTF8Encoding().GetBytes("string;"test"");

    rapidQueue.Send(0, 0, 0, 0, data);

    Exceptions
    Type Condition
    ArgumentException

    if Data is invalid.

    Send(Int32, Int32, Int32, Int32, Byte[], Int32)

    This method sends a message to the queue.

    Declaration
    public void Send(int Sender, int Cmd, int UserDef, int UserData, byte[] Data, int Length)
    Parameters
    Type Name Description
    Int32 Sender

    The sender of the message

    Int32 Cmd

    The type of command

    Int32 UserDef

    A user defined value

    Int32 UserData

    User information

    Byte[] Data

    The data that will be sent

    Int32 Length

    Length of the data that will be sent

    Remarks

    This method must be called from a MTA thread. Create a separate sender thread and use the method Thread.SetApartmentState() to set the apartment state to MTA before starting it.

    Examples

    Controller c = new Controller();

    IpcQueue rapidQueue = c.Ipc.GetQueue("RMQ_T_ROB1");

    Byte[] data = new UTF8Encoding().GetBytes("string;"test""); Send string including null character rapidQueue.Send(0, 0, 0, 0, data, data.Length+1);

    Exceptions
    Type Condition
    ArgumentException

    if Data is invalid.

    Implements

    System.IComparable
    INamedObject
    System.IDisposable
    In This Article
    Back to top Copyright © 2021 ABB