Added a # prefix before the commands.

This commit is contained in:
2021-04-23 19:45:10 +01:00
parent 384deecc3f
commit aca01de4ee
6 changed files with 92 additions and 100 deletions
+10 -5
View File
@@ -93,12 +93,17 @@ namespace ASCOM.Meade.net
/// </summary>
/// <param name="message"></param>
/// <returns></returns>
public static string SendString(string message)
public static string SendString(string message, bool includePrefix = true)
{
lock (LockObject)
{
SharedSerial.ClearBuffers();
SharedSerial.Transmit(message);
if (includePrefix)
SharedSerial.Transmit( $"#{message}");
else
SharedSerial.Transmit(message);
return SharedSerial.ReceiveTerminated("#").TrimEnd('#');
}
}
@@ -324,8 +329,8 @@ namespace ASCOM.Meade.net
try
{
ProductName = SendString("#:GVP#");
FirmwareVersion = SendString("#:GVN#");
ProductName = SendString(":GVP#");
FirmwareVersion = SendString(":GVN#");
}
catch (Exception ex)
{
@@ -345,7 +350,7 @@ namespace ASCOM.Meade.net
try
{
string utcOffSet = SendString("#:GG#");
string utcOffSet = SendString(":GG#");
//:GG# Get UTC offset time
//Returns: sHH# or sHH.H#
//The number of decimal hours to add to local time to convert it to UTC. If the number is a whole number the
+3 -3
View File
@@ -15,7 +15,7 @@ namespace ASCOM.Meade.net.Wrapper
void Lock(Action action);
T Lock<T>(Func<T> func);
string SendString(string message);
string SendString(string message, bool includePrefix = true);
void SendBlind(string message);
string SendChar(string message);
@@ -54,9 +54,9 @@ namespace ASCOM.Meade.net.Wrapper
return SharedResources.Lock(func);
}
public string SendString(string message)
public string SendString(string message, bool includePrefix = true)
{
return SharedResources.SendString(message);
return SharedResources.SendString(message, includePrefix);
}
public void SendBlind(string message)