Skip to content

SECS-II/HSMS-SS/GEM implementation on .NET

License

Notifications You must be signed in to change notification settings

KnightChang17/secs4net

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

secs4net

NuGet

Project Description
SECS-II/HSMS-SS/GEM implementation on .NET. This library provide easy way to communicate with SEMI standard compatible device.

1. Send message to device

try
{
    //await secondary message
    var s3f18 = await device.SendAsync(s3f17); 
    
    //access item value
    byte b1 = (byte)s3f18.SecsItem.Items[0]; 
    byte b2 = s3f18.SecsItem.Items[0].GetValue<byte>();
    string str = s3f18.SecsItem.Items[0].GetString();

    // LINQ query
    var query =
        from a in s3f18.SecsItem.Items[3].Items
        select new {
            num = a.GetValue<int>(),
        };
}
catch(SecsException)
{
    // exception  when
    // T3 timeout
    // device reply SxF0
    // device reply S9Fx
}

2. Handle primary message from device

secsGem.PrimaryMessageReceived += async (sender, messageWrapper) => 
{
    try 
    {
        //do something for primaryMsg
        var primaryMsg = messageWrapper.Message;
	   

        // reply secondary msg to device
        await messageWrapper.ReplyAsync( secondaryMsg ); 
    }
    catch (Exception ex) 
    {

    }
};

3. SecsMessage/Item construction is also LINQ friendly

using static Secs4Net.Item;

var s16f15 = 
    new SecsMessage(16, 15, "CreateProcessJob"            
        L(
            U4(0),
            L(from pj in tx.ProcessJobs select
                L(
                    A(pj.Id),
                    B(0x0D),
                    L(from carrier in pj.Carriers select
                    L(
                        A(carrier.Id),
                        L(from slotInfo in carrier.SlotMap select
                            U1(slotInfo.SlotNo)))),
                        L(
                            U1(1),
                            A(pj.RecipeId),
                            L()),
                        Boolean(true),
                        L()))));

4. SecsMessage/Item is immutable(API level).

About

SECS-II/HSMS-SS/GEM implementation on .NET

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 85.4%
  • Standard ML 14.6%