You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.3 KiB

8 months ago
  1. namespace Mirle.Component.MPLC.DataBlocks.Interfaces
  2. {
  3. /// <summary>
  4. /// 資料區塊介面
  5. /// </summary>
  6. public interface IDataBlock
  7. {
  8. /// <summary>
  9. /// 設置原始資料
  10. /// </summary>
  11. /// <param name="newRawData">原始資料</param>
  12. void SetRawData(byte[] newRawData);
  13. /// <summary>
  14. /// 取得原始資料
  15. /// </summary>
  16. /// <returns>原始資料</returns>
  17. byte[] GetRawData();
  18. /// <summary>
  19. /// 取得位元
  20. /// </summary>
  21. /// <param name="address">位置</param>
  22. /// <param name="value">是否成功取得</param>
  23. /// <returns>True/False</returns>
  24. bool TryGetBit(string address, out bool value);
  25. /// <summary>
  26. /// 設置位元開啟
  27. /// </summary>
  28. /// <param name="address">位置</param>
  29. /// <returns>True/False</returns>
  30. bool TrySetBitOn(string address);
  31. /// <summary>
  32. /// 設置位元關閉
  33. /// </summary>
  34. /// <param name="address">位置</param>
  35. /// <returns>True/False</returns>
  36. bool TrySetBitOff(string address);
  37. /// <summary>
  38. /// 取得字元
  39. /// </summary>
  40. /// <param name="address">位置</param>
  41. /// <param name="value">值</param>
  42. /// <returns>True/False</returns>
  43. bool TryGetWord(string address, out int value);
  44. /// <summary>
  45. /// 設置字元
  46. /// </summary>
  47. /// <param name="address">位置</param>
  48. /// <param name="value">值</param>
  49. /// <returns>True/False</returns>
  50. bool TrySetWord(string address, int value);
  51. /// <summary>
  52. /// 取得多個字元
  53. /// </summary>
  54. /// <param name="address">位置</param>
  55. /// <param name="data">資料集</param>
  56. /// <param name="length">長度</param>
  57. /// <returns>True/False</returns>
  58. bool TryGetWords(string address, out int[] data, int length);
  59. /// <summary>
  60. /// 設置多個字元
  61. /// </summary>
  62. /// <param name="address">位置</param>
  63. /// <param name="data">資料集</param>
  64. /// <returns>True/False</returns>
  65. bool TrySetWords(string address, int[] data);
  66. }
  67. }