topic.cpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // topic.cpp
  2. /*******************************************************************************
  3. * Copyright (c) 2013-2016 Frank Pagliughi <fpagliughi@mindspring.com>
  4. *
  5. * All rights reserved. This program and the accompanying materials
  6. * are made available under the terms of the Eclipse Public License v1.0
  7. * and Eclipse Distribution License v1.0 which accompany this distribution.
  8. *
  9. * The Eclipse Public License is available at
  10. * http://www.eclipse.org/legal/epl-v10.html
  11. * and the Eclipse Distribution License is available at
  12. * http://www.eclipse.org/org/documents/edl-v10.php.
  13. *
  14. * Contributors:
  15. * Frank Pagliughi - initial implementation and documentation
  16. *******************************************************************************/
  17. #include "mqtt/topic.h"
  18. #include "mqtt/async_client.h"
  19. namespace mqtt {
  20. /////////////////////////////////////////////////////////////////////////////
  21. delivery_token_ptr topic::publish(const void* payload, size_t n)
  22. {
  23. return cli_.publish(name_, payload, n, qos_, retained_);
  24. }
  25. delivery_token_ptr topic::publish(const void* payload, size_t n,
  26. int qos, bool retained)
  27. {
  28. return cli_.publish(name_, payload, n, qos, retained);
  29. }
  30. delivery_token_ptr topic::publish(binary_ref payload)
  31. {
  32. return cli_.publish(name_, std::move(payload), qos_, retained_);
  33. }
  34. delivery_token_ptr topic::publish(binary_ref payload, int qos, bool retained)
  35. {
  36. return cli_.publish(name_, std::move(payload), qos, retained);
  37. }
  38. token_ptr topic::subscribe(const subscribe_options& opts)
  39. {
  40. return cli_.subscribe(name_, qos_, opts);
  41. }
  42. /////////////////////////////////////////////////////////////////////////////
  43. // end namespace mqtt
  44. }