| 1 | // Copyright 2015 Google Inc. All Rights Reserved. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | // Decode Automatic Identification System (AIS) messages. |
| 16 | |
| 17 | #ifndef LIBAIS_DECODE_BODY_H_ |
| 18 | #define LIBAIS_DECODE_BODY_H_ |
| 19 | |
| 20 | #include <memory> |
| 21 | #include <string> |
| 22 | |
| 23 | #include "ais.h" |
| 24 | |
| 25 | namespace libais { |
| 26 | |
| 27 | // Decodes the payload of an AIS message and returns an AisMsg instance. |
| 28 | // Returns a nullptr on failure. |
| 29 | // The body is the armored text from 1 or more sentences that compose |
| 30 | // the encoded bits for an AIS message. |
| 31 | // The fill_bits are the number of pad bits in the last character of the |
| 32 | // body. AIS messages are 8-bit aligned and the characters in the armored |
| 33 | // body are 6-bit aligned. |
| 34 | std::unique_ptr<libais::AisMsg> CreateAisMsg(const string &body, |
| 35 | const int fill_bits); |
| 36 | |
| 37 | } // namespace libais |
| 38 | |
| 39 | #endif // LIBAIS_DECODE_BODY_H_ |