Skip to content

Some SecsMessage event like S1F17 , need to reply,but the code used report "does not need to reply" #112

@value-key

Description

@value-key

Describe the bug
hello, i used secs4net v2.4.3, i use s1f17 request to set the equipment online/offline state, the response is s1f18, but the result is error-"message does not need reply", i found the current.ReplyExpected = false, how can i resolve this problem? code like below:
你好,我使用secs4net v2.4.3版本中遇到问题,我使用s1f17请求事件来设置设备的在线/离线状态,正常情况下设备应返回s1f18响应,结果设备却提示错误-“message does not need reply”,我发现代码中的secsMessage对象的ReplyExpected属性值=false,请问该如何解决这个问题? 代码如下:

SecsGem _secsGem;
IAsyncEnumerator enumerator = _secsGem.GetPrimaryMessageAsync(_cancellationTokenSource.Token).GetAsyncEnumerator();

//
using (enumerator as IDisposable)
{
while (await enumerator.MoveNextAsync())
{
var primaryMessage = enumerator.Current;
using (SecsMessage current = primaryMessage.PrimaryMessage)
{
using(var secondaryMsg = new SecsMessage(current.S, (byte)(current.F + 1)))
{
try
{
await primaryMessage.TryReplyAsync(secondaryMsg);
}
catch (Exception exception)
{
Logger.LogError(exception.Message);//log error
}
}
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions