Library for MQTT
mbed-mqtt-master/UNITTESTS/stubs/MQTTSerializePublish_stub.cpp@0:ba7e439238ab, 2022-06-20 (annotated)
- Committer:
- pavleradojkovic
- Date:
- Mon Jun 20 16:24:43 2022 +0000
- Revision:
- 0:ba7e439238ab
Inital commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pavleradojkovic | 0:ba7e439238ab | 1 | /* |
pavleradojkovic | 0:ba7e439238ab | 2 | * Copyright (c) 2019, Arm Limited and affiliates |
pavleradojkovic | 0:ba7e439238ab | 3 | * SPDX-License-Identifier: Apache-2.0 |
pavleradojkovic | 0:ba7e439238ab | 4 | * |
pavleradojkovic | 0:ba7e439238ab | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
pavleradojkovic | 0:ba7e439238ab | 6 | * you may not use this file except in compliance with the License. |
pavleradojkovic | 0:ba7e439238ab | 7 | * You may obtain a copy of the License at |
pavleradojkovic | 0:ba7e439238ab | 8 | * |
pavleradojkovic | 0:ba7e439238ab | 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
pavleradojkovic | 0:ba7e439238ab | 10 | * |
pavleradojkovic | 0:ba7e439238ab | 11 | * Unless required by applicable law or agreed to in writing, software |
pavleradojkovic | 0:ba7e439238ab | 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
pavleradojkovic | 0:ba7e439238ab | 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
pavleradojkovic | 0:ba7e439238ab | 14 | * See the License for the specific language governing permissions and |
pavleradojkovic | 0:ba7e439238ab | 15 | * limitations under the License. |
pavleradojkovic | 0:ba7e439238ab | 16 | */ |
pavleradojkovic | 0:ba7e439238ab | 17 | |
pavleradojkovic | 0:ba7e439238ab | 18 | #include "MQTTPacket.h" |
pavleradojkovic | 0:ba7e439238ab | 19 | |
pavleradojkovic | 0:ba7e439238ab | 20 | int MQTTSerialize_publishLength(int qos, MQTTString topicName, int payloadlen) |
pavleradojkovic | 0:ba7e439238ab | 21 | { |
pavleradojkovic | 0:ba7e439238ab | 22 | return payloadlen; |
pavleradojkovic | 0:ba7e439238ab | 23 | } |
pavleradojkovic | 0:ba7e439238ab | 24 | |
pavleradojkovic | 0:ba7e439238ab | 25 | int MQTTSerialize_publish(unsigned char* buf, int buflen, unsigned char dup, int qos, unsigned char retained, unsigned short packetid, |
pavleradojkovic | 0:ba7e439238ab | 26 | MQTTString topicName, unsigned char* payload, int payloadlen) |
pavleradojkovic | 0:ba7e439238ab | 27 | { |
pavleradojkovic | 0:ba7e439238ab | 28 | return payloadlen; |
pavleradojkovic | 0:ba7e439238ab | 29 | } |
pavleradojkovic | 0:ba7e439238ab | 30 | |
pavleradojkovic | 0:ba7e439238ab | 31 | int MQTTSerialize_ack(unsigned char* buf, int buflen, unsigned char packettype, unsigned char dup, unsigned short packetid) |
pavleradojkovic | 0:ba7e439238ab | 32 | { |
pavleradojkovic | 0:ba7e439238ab | 33 | return buflen; |
pavleradojkovic | 0:ba7e439238ab | 34 | } |
pavleradojkovic | 0:ba7e439238ab | 35 | |
pavleradojkovic | 0:ba7e439238ab | 36 | int MQTTSerialize_puback(unsigned char* buf, int buflen, unsigned short packetid) |
pavleradojkovic | 0:ba7e439238ab | 37 | { |
pavleradojkovic | 0:ba7e439238ab | 38 | return MQTTSerialize_ack(buf, buflen, PUBACK, 0, packetid); |
pavleradojkovic | 0:ba7e439238ab | 39 | } |
pavleradojkovic | 0:ba7e439238ab | 40 | |
pavleradojkovic | 0:ba7e439238ab | 41 | int MQTTSerialize_pubrel(unsigned char* buf, int buflen, unsigned char dup, unsigned short packetid) |
pavleradojkovic | 0:ba7e439238ab | 42 | { |
pavleradojkovic | 0:ba7e439238ab | 43 | return MQTTSerialize_ack(buf, buflen, PUBREL, dup, packetid); |
pavleradojkovic | 0:ba7e439238ab | 44 | } |
pavleradojkovic | 0:ba7e439238ab | 45 | |
pavleradojkovic | 0:ba7e439238ab | 46 | int MQTTSerialize_pubcomp(unsigned char* buf, int buflen, unsigned short packetid) |
pavleradojkovic | 0:ba7e439238ab | 47 | { |
pavleradojkovic | 0:ba7e439238ab | 48 | return MQTTSerialize_ack(buf, buflen, PUBCOMP, 0, packetid); |
pavleradojkovic | 0:ba7e439238ab | 49 | } |
pavleradojkovic | 0:ba7e439238ab | 50 | |
pavleradojkovic | 0:ba7e439238ab | 51 |