Add custom translators for the Software Analyzer (SWANA)
- Last UpdatedApr 24, 2025
- 1 minute read
To add a custom translator library to the Software Analyzer (SWANA)
-
Create a new custom translator library and place it in the %DNAInstallRoot%\Tools\bin folder.
The translator class(es) in the library must implement the ISwanaTranslator interface that is located in the %DNAInstallRoot%\Tools\bin\OASySDNA.Common.dnaSWANA.Translators.dll and is defined as:
public interface ISwanaTranslator
{
/// <summary>
/// Name of the translator
/// </summary>
string Name { get; }
/// <summary>
/// Provides a list of all protocols this translator supports
/// </summary>
/// <returns></returns>
List<string> GetSupportedProtocols();
/// <summary>
/// Translates raw data bytes into formatted string.
/// </summary>
/// <param name="protocol">Name of OASyS communication protocol.</param>
/// <param name="subProtocol">Name of sub-protocol. This can be an empty string.</param>
/// <param name="connection">Name of the connection.</param>
/// <param name="messageType">Q, R or X</param>
/// <param name="dataSize">Data packet size.</param>
/// <param name="data">Raw communication data.</param>
/// <returns></returns>
string Translate(string protocol, string subProtocol, string connection, char messageType, int dataSize, byte[] data);
}
-
In the %DNADataRoot%\Tools\config\settings directory, create a JSON file with the following structure that specifies your extension file (you can add multiple extensions to the same file):
{
"ServiceFramework": {
"Extensions": {
"Swana": {
"SwanaPluginSample1.dll": true,
"SwanaPluginSample2.dll": true
}
}
}
}
-
Restart SWANA.
Note: The custom JSON and translator library files must be manually copied to computers.