UNIXSerialPort.h 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #ifndef _UNIXSerialPort_h_INCLUDED_
  2. #define _UNIXSerialPort_h_INCLUDED_
  3. /*****************************************************************************/
  4. /* ここから */
  5. /*****************************************************************************/
  6. /*****************************************************************************/
  7. /* クラスの定義 */
  8. /*****************************************************************************/
  9. typedef struct _UNIXSerialPort * UNIXSerialPort;
  10. /*****************************************************************************/
  11. /* ヘッダファイルのインクルード */
  12. /*****************************************************************************/
  13. #include <stdio.h>
  14. #include <stdlib.h>
  15. /*****************************************************************************/
  16. /* メンバ関数の宣言 */
  17. /*****************************************************************************/
  18. /*---------------------------------------------------------------------------*/
  19. /* ポートの open/close */
  20. /*---------------------------------------------------------------------------*/
  21. int UNIXSerialPort_Open(UNIXSerialPort unix_serial_port);
  22. int UNIXSerialPort_Close(UNIXSerialPort unix_serial_port);
  23. int UNIXSerialPort_IsOpened(UNIXSerialPort unix_serial_port);
  24. int UNIXSerialPort_IsClosed(UNIXSerialPort unix_serial_port);
  25. /*---------------------------------------------------------------------------*/
  26. /* 受信データがあるかどうか */
  27. /*---------------------------------------------------------------------------*/
  28. /*
  29. * タイムアウト時間をミリ秒単位で指定.
  30. * 0 のときは,即時
  31. * -1 のときは,無期限待ち
  32. */
  33. int UNIXSerialPort_IsDataExisting(UNIXSerialPort unix_serial_port,
  34. int timeout);
  35. /*---------------------------------------------------------------------------*/
  36. /* 受信 */
  37. /*---------------------------------------------------------------------------*/
  38. int UNIXSerialPort_ReceiveCharacter(UNIXSerialPort unix_serial_port,
  39. int timeout);
  40. /*---------------------------------------------------------------------------*/
  41. /* 送信 */
  42. /*---------------------------------------------------------------------------*/
  43. int UNIXSerialPort_SendCharacter(UNIXSerialPort unix_serial_port,
  44. unsigned char c);
  45. /*---------------------------------------------------------------------------*/
  46. /* オブジェクトの作成 */
  47. /*---------------------------------------------------------------------------*/
  48. UNIXSerialPort UNIXSerialPort_Create();
  49. /*---------------------------------------------------------------------------*/
  50. /* オブジェクトの削除 */
  51. /*---------------------------------------------------------------------------*/
  52. UNIXSerialPort UNIXSerialPort_Destroy(UNIXSerialPort unix_serial_port);
  53. /*****************************************************************************/
  54. /* ここまで */
  55. /*****************************************************************************/
  56. #endif
  57. /*****************************************************************************/
  58. /* End of File. */
  59. /*****************************************************************************/