Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
5330593
bitte die neue S7 1200 G2 einfügen, diese Serie kann ab Tia V20 progr…
SigiRab Nov 14, 2025
d3d960d
Merge pull request #75 from SigiRab/feature/newS7-1200G2
thomas-v2 Nov 14, 2025
38b00f2
Use double quote for string
thomas-v2 Nov 27, 2025
9f1864f
Alarms: Add method to read the active alarms without notification
thomas-v2 Nov 27, 2025
ce4c92c
Add files via upload
SigiRab Nov 28, 2025
9cfa84b
Update PlcTags.cs
SigiRab Nov 28, 2025
b9acd44
Update S7CommPlusConnection.cs
SigiRab Nov 28, 2025
b61c126
Update S7CommPlusConnection.cs
SigiRab Nov 28, 2025
450e23b
Merge pull request #77 from SigiRab/read/write-arrays
thomas-v2 Dec 3, 2025
b84fb52
Move Array-Tag classes into single PlcTags file
thomas-v2 Dec 3, 2025
ef73ef3
add function: support for S7-1507S F software controller(min FW:21.9)
allrightsreserved Mar 23, 2026
1a91c49
Revert "add function: support for S7-1507S F software controller(min …
allrightsreserved Mar 23, 2026
c4eb099
support for Software controllers as of firmware version V21.9.
allrightsreserved Mar 23, 2026
dbd61e4
Merge pull request #83 from allrightsreserved/feature/Support-for-Sof…
thomas-v2 Mar 24, 2026
d92ea69
Merge remote-tracking branch 'thomas-v2/master'
schnuff-dev Apr 22, 2026
cc39500
Removed create socket function and some whitespace
schnuff-dev Apr 23, 2026
09f6996
Added proper exceptions to MsgSocket
schnuff-dev May 6, 2026
2a9dbec
Replaced TickCount with Stopwatch in MsgSocket to avoid overflow
schnuff-dev May 6, 2026
422b571
Replaced Environment.TickCount with Stopwatch
schnuff-dev May 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/DriverTest/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ static void Main(string[] args)
Console.WriteLine("Main - Versuche Verbindungsaufbau zu: " + HostIp);

S7CommPlusConnection conn = new S7CommPlusConnection();
res = conn.Connect(HostIp, Password, Username);
if (res == 0)
try
{
conn.Connect(HostIp, Password, Username);
Console.WriteLine("Main - Connect fertig");

#region Variablenhaushalt browsen
Expand Down Expand Up @@ -95,7 +95,7 @@ static void Main(string[] args)
List<object> values = new List<object>();
List<UInt64> errors = new List<UInt64>();


// Fehlerhafte Variable setzen
//readlist[2].LID[0] = 123;
res = conn.ReadValues(readlist, out values, out errors);
Expand All @@ -112,7 +112,7 @@ static void Main(string[] args)
string formatstring = "{0,-80}{1,-30}{2,-20}{3,-20}";
Console.WriteLine(String.Format(formatstring, "SYMBOLIC-NAME", "ACCESS-SEQUENCE", "TYP", "VALUE"));
for (int i = 0; i < vars.Count; i++)
{
{
string s = String.Format(formatstring, vars[i].Name, vars[i].AccessSequence, Softdatatype.Types[vars[i].Softdatatype], values[i]);
Console.WriteLine(s);
}
Expand Down Expand Up @@ -167,12 +167,12 @@ static void Main(string[] args)
conn.SetPlcOperatingState(3);
#endregion
*/
conn.Disconnect();
}
else
catch (Exception e)
{
Console.WriteLine("Main - Connect fehlgeschlagen!");
Console.WriteLine("Main - " + e.ToString());
}
conn.Disconnect();
Console.WriteLine("Main - ENDE. Bitte Taste drücken.");
Console.ReadKey();
}
Expand Down
68 changes: 68 additions & 0 deletions src/S7CommPlusDriver/Alarming/BrowseAlarms.cs
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,74 @@ private void GetTexts(byte[] tloa_1, byte[] tloa_2, byte[] tloa_3, byte[] tlsa,
}
}
}

/// <summary>
/// Reads the active program alarms from the Plc (single poll).
///
/// Call example:
/// CultureInfo ci = new CultureInfo("de-DE");
/// var alarmList = new List<AlarmsDai>();
/// conn.GetActiveAlarms(out alarmList, ci.LCID);
/// foreach (var a in alarmList)
/// {
/// Console.WriteLine(a.ToString());
/// }
/// </summary>
/// <param name="alarmList">Contains the alarms, empty if there is no active alarm</param>
/// <param name="languageId">Language id for retrieving the text entries, use language code e.g. 1031 for german</param>
/// <returns>0 on success</returns>
public int GetActiveAlarms(out List<AlarmsDai> alarmList, int languageId)
{
int res;

alarmList = new List<AlarmsDai>();

var exploreReq = new ExploreRequest(ProtocolVersion.V2);
exploreReq.ExploreId = Ids.NativeObjects_theAlarmSubsystem_Rid;
exploreReq.ExploreRequestId = Ids.AlarmSubsystem_itsUpdateRelevantDAI;
exploreReq.ExploreChildsRecursive = 1;
exploreReq.ExploreParents = 0;

// Add the requestes attributes.
// Request the same attributes we get from an alarm notification, so we can reuse other methods.
exploreReq.AddressList.Add(Ids.DAI_CPUAlarmID);
exploreReq.AddressList.Add(Ids.DAI_AllStatesInfo);
exploreReq.AddressList.Add(Ids.DAI_AlarmDomain);
exploreReq.AddressList.Add(Ids.DAI_Coming);
exploreReq.AddressList.Add(Ids.DAI_Going);
exploreReq.AddressList.Add(Ids.DAI_MessageType);
exploreReq.AddressList.Add(Ids.DAI_HmiInfo);
// Extra ones which we only need for compatibility with notification.
exploreReq.AddressList.Add(Ids.ObjectVariableTypeName);
exploreReq.AddressList.Add(Ids.DAI_SequenceCounter);
exploreReq.AddressList.Add(Ids.DAI_AlarmTexts_Rid);

res = SendS7plusFunctionObject(exploreReq);
if (res != 0)
{
return res;
}
m_LastError = 0;
WaitForNewS7plusReceived(m_ReadTimeout);
if (m_LastError != 0)
{
return m_LastError;
}

var exploreRes = ExploreResponse.DeserializeFromPdu(m_ReceivedPDU, true);
res = checkResponseWithIntegrity(exploreReq, exploreRes);
if (res != 0)
{
return res;
}

foreach (var obj in exploreRes.Objects)
{
alarmList.Add(AlarmsDai.FromNotificationObject(obj, languageId));
}

return 0;
}
}

public class AlarmData
Expand Down
Loading