Welcome to the Fisothemes's Standard Library for TwinCAT! This library aims to consolidate, clean up, and improve the existing TwinCAT library on my GitHub profile. The goal is to provide TwinCAT developers with a clean, simple, and consistent library that enhances their development experience and helps them build projects more efficiently.
- Modularity: The library is organized into different modules, each focusing on a specific area such as core functionality, error handling, strings, numerics, collections, I/O, hashing, streams, sockets, and callbacks.
- ๐ง Reusability: The modules will be designed to be reusable components that can be easily integrated into your TwinCAT projects.
- ๐ง Documentation: The repository will include comprehensive documentation that guides you on how to use the library effectively and efficiently.
- ๐ง Examples: A collection of examples will be provided to showcase the usage of different modules and help you get started quickly.
- ๐ง Contributions: Contributions from the TwinCAT community are welcome! Please refer to the Contribution Guidelines for more information.
Please note that the Fisothemes's Standard Library for TwinCAT is currently under development. While it is not yet ready for full usage, I would like to provide you with a glimpse of what is planned. Here are some code snippets to give you a taste of what I have in mind:
FsFB_Object IMPLEMENTS FsI_Object
โโโ Methods
โ โโโ Is(ipObject : FsI_Object) -> BOOL
โ โโโ ToString() -> FsT_LStr
โโโ Properties
โโโ TypeName : FsT_Str
โโโ InstacePath : FsT_LStr
โโโ Address : FsT_Ptr
โโโ Size : FsT_Size
โโโ MemoryArea : FsT_MemArea
FsFB_Error EXTENDS FsFB_Object IMPLEMENTS FsI_Error
โโโ Properties
โโโ Code : FsT_ErrCode
โโโ Message : FsT_ErrMsg
Declarations:
VAR
sValue : STRING(255);
fbImmutStr : FsFB_ImmutableString('I love cats!');
DogPos : FsT_Pos;
fbErr : FsFB_Error;
END_VAR
Implementation:
sValue := fbImmutStr
.Search('Dogs', 0, Pos => DogPos, e => fbErr)
.ToString();
CASE fbErr.Code OF
0: ...
ELSE
// Handle Error.
END_CASE
Declarations:
VAR
SendBuffer, RecvBuffer : FsT_Str;
fbTcpClient : FsFB_TcpClient;
fbErr : FsFB_Error;
END_VAR
Implementation:
IF bConnect THEN
// The Connect method returns TRUE when done irrespective of error.
bConnect := NOT fbTcpClient.Connect('127.0.0.1', 8008, e => fbErr);
IF fbErr.Code <> 0 THEN
// Handle error.
END_IF
END_IF
IF bDisconnect THEN
bDisconnect := NOT fbTcpClient.Disconnect(e => ipErr);
END_IF
IF bSend THEN
bSend := NOT fbTcpClient.Send(SendBuffer, e => ipErr);
END_IF
IF bReceive THEN
bReceive := NOT fbTcpClient.Receive(RecvBuffer, nBytes => nRBytes, e => ipErr);
END_IF
This project is licensed under the MIT License.
If you have any questions or suggestions regarding the Fisothemes's Standard Library for TwinCAT, you can reach out to me via [email protected].