Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
InnomatixDataStoreAPI/inc/NBO.h@0:b9e1003fbee7, 2016-04-15 (annotated)
- Committer:
- Innomatix
- Date:
- Fri Apr 15 18:35:31 2016 +0000
- Revision:
- 0:b9e1003fbee7
v1.0.2 Rework to use USB for comms, rework example, add user guides
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Innomatix | 0:b9e1003fbee7 | 1 | /******************************************************************* |
| Innomatix | 0:b9e1003fbee7 | 2 | * |
| Innomatix | 0:b9e1003fbee7 | 3 | * File: NBO.h |
| Innomatix | 0:b9e1003fbee7 | 4 | * |
| Innomatix | 0:b9e1003fbee7 | 5 | * Description: Library to get Network to Host byte order and |
| Innomatix | 0:b9e1003fbee7 | 6 | * vice versa. |
| Innomatix | 0:b9e1003fbee7 | 7 | * |
| Innomatix | 0:b9e1003fbee7 | 8 | * Copyright 2015 Innomatix, LLC., All Rights Reserved |
| Innomatix | 0:b9e1003fbee7 | 9 | * |
| Innomatix | 0:b9e1003fbee7 | 10 | * THIS DOCUMENT AND ITS CONTENTS ARE INTELLECTUAL PROPERTY |
| Innomatix | 0:b9e1003fbee7 | 11 | * OF INNOMATIX, LLC. ANY DUPLICATION IN PART OR WHOLE |
| Innomatix | 0:b9e1003fbee7 | 12 | * WITHOUT PRIOR WRITTEN CONSENT IS STRICTLY PROHIBITED. |
| Innomatix | 0:b9e1003fbee7 | 13 | * |
| Innomatix | 0:b9e1003fbee7 | 14 | ********************************************************************/ |
| Innomatix | 0:b9e1003fbee7 | 15 | #ifndef _NBO_H_ |
| Innomatix | 0:b9e1003fbee7 | 16 | #define _NBO_H_ |
| Innomatix | 0:b9e1003fbee7 | 17 | |
| Innomatix | 0:b9e1003fbee7 | 18 | #include <stdint.h> |
| Innomatix | 0:b9e1003fbee7 | 19 | |
| Innomatix | 0:b9e1003fbee7 | 20 | #ifdef __cplusplus |
| Innomatix | 0:b9e1003fbee7 | 21 | extern "C" { |
| Innomatix | 0:b9e1003fbee7 | 22 | #endif |
| Innomatix | 0:b9e1003fbee7 | 23 | |
| Innomatix | 0:b9e1003fbee7 | 24 | |
| Innomatix | 0:b9e1003fbee7 | 25 | /** |
| Innomatix | 0:b9e1003fbee7 | 26 | * Function to aid the MessageBuilders and ParseHelpers Libraries. It allows user |
| Innomatix | 0:b9e1003fbee7 | 27 | * to get a 32 bit number in Network Byte Order to host byte order (little endian). |
| Innomatix | 0:b9e1003fbee7 | 28 | * |
| Innomatix | 0:b9e1003fbee7 | 29 | * @param network - 32 bit number in network byte order. |
| Innomatix | 0:b9e1003fbee7 | 30 | * @retval host - the 32 bit number in host byte order. |
| Innomatix | 0:b9e1003fbee7 | 31 | ***************************************************************************************/ |
| Innomatix | 0:b9e1003fbee7 | 32 | uint32_t ntohl( uint32_t network); |
| Innomatix | 0:b9e1003fbee7 | 33 | |
| Innomatix | 0:b9e1003fbee7 | 34 | /** |
| Innomatix | 0:b9e1003fbee7 | 35 | * Function to aid the MessageBuilders and ParseHelpers Libraries. It allows user |
| Innomatix | 0:b9e1003fbee7 | 36 | * to get a 32 bit number in host byte order (little endian) to network byte order. |
| Innomatix | 0:b9e1003fbee7 | 37 | * |
| Innomatix | 0:b9e1003fbee7 | 38 | * @param host - 32 bit number in host byte order. |
| Innomatix | 0:b9e1003fbee7 | 39 | * @retval network - the 32 bit number network byte order. |
| Innomatix | 0:b9e1003fbee7 | 40 | **************************************************************************************/ |
| Innomatix | 0:b9e1003fbee7 | 41 | uint32_t htonl( uint32_t host); |
| Innomatix | 0:b9e1003fbee7 | 42 | |
| Innomatix | 0:b9e1003fbee7 | 43 | /** |
| Innomatix | 0:b9e1003fbee7 | 44 | * Function to aid the MessageBuilders and ParseHelpers Libraries. It allows user |
| Innomatix | 0:b9e1003fbee7 | 45 | * to get a 16 bit number host byte order (little endian) to network byte order. |
| Innomatix | 0:b9e1003fbee7 | 46 | * |
| Innomatix | 0:b9e1003fbee7 | 47 | * @param host - 16 bit number in host byte order. |
| Innomatix | 0:b9e1003fbee7 | 48 | * @retval network - the 16 bit number in network byte order. |
| Innomatix | 0:b9e1003fbee7 | 49 | **************************************************************************************/ |
| Innomatix | 0:b9e1003fbee7 | 50 | uint16_t htons( uint16_t host); |
| Innomatix | 0:b9e1003fbee7 | 51 | |
| Innomatix | 0:b9e1003fbee7 | 52 | /** |
| Innomatix | 0:b9e1003fbee7 | 53 | * Function to aid the MessageBuilders and ParseHelpers Libraries. It allows user |
| Innomatix | 0:b9e1003fbee7 | 54 | * to get a 16 bit number in Network Byte Order to host byte order (little endian). |
| Innomatix | 0:b9e1003fbee7 | 55 | * |
| Innomatix | 0:b9e1003fbee7 | 56 | * @param network - 16 bit number in network byte order. |
| Innomatix | 0:b9e1003fbee7 | 57 | * @retval host - the 16 bit number in host byte order. |
| Innomatix | 0:b9e1003fbee7 | 58 | **************************************************************************************/ |
| Innomatix | 0:b9e1003fbee7 | 59 | uint16_t ntohs( uint16_t network); |
| Innomatix | 0:b9e1003fbee7 | 60 | |
| Innomatix | 0:b9e1003fbee7 | 61 | |
| Innomatix | 0:b9e1003fbee7 | 62 | #ifdef __cplusplus |
| Innomatix | 0:b9e1003fbee7 | 63 | } |
| Innomatix | 0:b9e1003fbee7 | 64 | #endif |
| Innomatix | 0:b9e1003fbee7 | 65 | |
| Innomatix | 0:b9e1003fbee7 | 66 | #endif // _NBO_H__ |