metronik.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // metronik.h :
  2. //
  3. /*
  4. *
  5. * ACHTUNG:
  6. * Befindet sich der Sensors am Bus mit anderen Teilnehmern führt ein Pollen der Slaves mit einem Frame-Delay < 10 ms zu Timeout-Problemen des Sensors!
  7. *
  8. */
  9. #if !defined(AGD_METRONIK_H__307066E3_A2D6_4104_A274_BC71B3798327__INCLUDED_)
  10. #define AGD_METRONIK_H__307066E3_A2D6_4104_A274_BC71B3798327__INCLUDED_
  11. #include <gfambrtumst.h>
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif // __cplusplus
  15. /////////////////////////////////////////////////////////////////////////////
  16. // metronik.h - Declarations:
  17. #define MB_ILM_FUNC_READ_UV ((uint8_t)0x41)
  18. #define MB_ILM_FUNC_READ_TEMP ((uint8_t)0x42)
  19. #define MB_ILM_FUNC_UNLOCK ((uint8_t)0x43)
  20. #define MB_ILM_FUNC_NEW_ADDR ((uint8_t)0x44)
  21. #define MB_ILM_FUNC_READ_RANGE ((uint8_t)0x45)
  22. #define MB_ILM_FUNC_READ_SERIAL ((uint8_t)0x46)
  23. /////////////////////////////////////////////////////////////////////////////
  24. typedef void (*PFN_READ_UV_COMPLETE) (uint32_t nTID, uint8_t nSlvID, uint16_t err, uint16_t nVal);
  25. typedef void (*PFN_READ_TEMP_COMPLETE) (uint32_t nTID, uint8_t nSlvID, uint16_t err, uint8_t nVal);
  26. typedef void (*PFN_READ_UNLOCK_COMPLETE) (uint32_t nTID, uint8_t nSlvID, uint16_t err, uint8_t nVal);
  27. typedef void (*PFN_NEW_ADDR_COMPLETE) (uint32_t nTID, uint8_t nSlvID, uint16_t err, uint8_t nVal);
  28. typedef void (*PFN_READ_RANGE_COMPLETE) (uint32_t nTID, uint8_t nSlvID, uint16_t err, uint16_t nVal);
  29. typedef void (*PFN_READ_SERIAL_COMPLETE) (uint32_t nTID, uint8_t nSlvID, uint16_t err, const uint8_t *pVal, size_t nCbVal);
  30. /////////////////////////////////////////////////////////////////////////////
  31. bool ModbusRtuILMReadUV(HMBRTUMST hMbMst, uint32_t nTID, uint8_t nSlvID, PFN_READ_UV_COMPLETE pfnReadUvComplete);
  32. bool ModbusRtuILMReadTemp(HMBRTUMST hMbMst, uint32_t nTID, uint8_t nSlvID, PFN_READ_TEMP_COMPLETE pfnReadTempComplete);
  33. bool ModbusRtuILMUnlock(HMBRTUMST hMbMst, uint32_t nTID, uint8_t nSlvID, PFN_READ_UNLOCK_COMPLETE pfnUnlockComplete);
  34. bool ModbusRtuILMReadRange(HMBRTUMST hMbMst, uint32_t nTID, uint8_t nSlvID, PFN_READ_RANGE_COMPLETE pfnReadRangeComplete);
  35. bool ModbusRtuILMReadSerial(HMBRTUMST hMbMst, uint32_t nTID, uint8_t nSlvID, PFN_READ_SERIAL_COMPLETE pfnReadSerialComplete);
  36. /*
  37. * ModbusRtuILMNewAddr: Weist dem Sensor eine neue Slave-Adresse zu.
  38. * Achtung: Der Sensor antwortet bei Erfolg bereits mit der neuen Slave-Adresse im Antwort-Frame!!!
  39. * Der Master ruft im Anschluss die Completion-Funktion mit dem Fehlercode MB_MST_ERROR_INVALID_SLAVE_ID (1) auf!
  40. * Die neue Slave-Adresse wurde in diesem Fall aber erfolgreich im Slave gesetzt!
  41. *
  42. * Achtung: Der Sensor akzeptiert die Broadcast-Adresse 0 als Slave-ID!!!! Diese sollte niemals gesetzt werden!
  43. */
  44. bool ModbusRtuILMNewAddr(HMBRTUMST hMbMst, uint32_t nTID, uint8_t nSlvID, uint8_t nNewAddr, PFN_NEW_ADDR_COMPLETE pfnNewAddrComplete);
  45. /////////////////////////////////////////////////////////////////////////////
  46. #ifdef __cplusplus
  47. }
  48. #endif // __cplusplus
  49. #endif // !defined(AGD_METRONIK_H__307066E3_A2D6_4104_A274_BC71B3798327__INCLUDED_)