local_lockout.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /***************************************************************************
  2. lib/local_lockout.c
  3. -------------------
  4. copyright : (C) 2002 by Frank Mori Hess
  5. email : fmhess@users.sourceforge.net
  6. ***************************************************************************/
  7. /***************************************************************************
  8. * *
  9. * This program is free software; you can redistribute it and/or modify *
  10. * it under the terms of the GNU General Public License as published by *
  11. * the Free Software Foundation; either version 2 of the License, or *
  12. * (at your option) any later version. *
  13. * *
  14. ***************************************************************************/
  15. #include "ib_internal.h"
  16. static int local_lockout( ibConf_t *conf, const Addr4882_t addressList[] )
  17. {
  18. uint8_t cmd;
  19. int retval;
  20. retval = InternalEnableRemote( conf, addressList );
  21. if( retval < 0 ) return retval;
  22. cmd = LLO;
  23. retval = my_ibcmd( conf, &cmd, 1 );
  24. if( retval < 0 ) return retval;
  25. return 0;
  26. }
  27. void SendLLO( int boardID )
  28. {
  29. ibConf_t *conf;
  30. int retval;
  31. conf = enter_library( boardID );
  32. if( conf == NULL )
  33. {
  34. exit_library( boardID, 1 );
  35. return;
  36. }
  37. retval = local_lockout( conf, NULL );
  38. if( retval < 0 )
  39. {
  40. exit_library( boardID, 1 );
  41. return;
  42. }
  43. exit_library( boardID, 0 );
  44. }
  45. void SetRWLS( int boardID, const Addr4882_t addressList[] )
  46. {
  47. ibConf_t *conf;
  48. int retval;
  49. conf = enter_library( boardID );
  50. if( conf == NULL )
  51. {
  52. exit_library( boardID, 1 );
  53. return;
  54. }
  55. if( numAddresses( addressList ) == 0 )
  56. {
  57. setIberr( EARG );
  58. exit_library( boardID, 1 );
  59. return;
  60. }
  61. retval = local_lockout( conf, addressList );
  62. if( retval < 0 )
  63. {
  64. exit_library( boardID, 1 );
  65. return;
  66. }
  67. exit_library( boardID, 0 );
  68. }