{"id":13420408,"url":"https://github.com/digidotcom/xbee_ansic_library","last_synced_at":"2025-03-15T06:33:05.728Z","repository":{"id":5832340,"uuid":"7048029","full_name":"digidotcom/xbee_ansic_library","owner":"digidotcom","description":"A collection of portable ANSI C code for communicating with Digi International's XBee wireless radio modules in API mode.","archived":false,"fork":false,"pushed_at":"2024-07-31T21:27:22.000Z","size":3127,"stargazers_count":204,"open_issues_count":1,"forks_count":116,"subscribers_count":66,"default_branch":"master","last_synced_at":"2024-08-01T23:26:37.667Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/digidotcom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-12-07T05:01:41.000Z","updated_at":"2024-07-31T21:27:23.000Z","dependencies_parsed_at":"2024-10-26T17:49:32.567Z","dependency_job_id":"1faa31c7-38ea-4dc6-8db4-3149497a2680","html_url":"https://github.com/digidotcom/xbee_ansic_library","commit_stats":{"total_commits":178,"total_committers":14,"mean_commits":"12.714285714285714","dds":0.1067415730337079,"last_synced_commit":"4e4a81cc466273dc7ab3b237c798fe2706dcad19"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digidotcom%2Fxbee_ansic_library","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digidotcom%2Fxbee_ansic_library/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digidotcom%2Fxbee_ansic_library/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digidotcom%2Fxbee_ansic_library/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/digidotcom","download_url":"https://codeload.github.com/digidotcom/xbee_ansic_library/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243695456,"owners_count":20332622,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T22:01:33.069Z","updated_at":"2025-03-15T06:33:05.722Z","avatar_url":"https://github.com/digidotcom.png","language":"C","funding_links":[],"categories":["TODO scan for Android support in followings"],"sub_categories":[],"readme":"Digi XBee ANSI C Library\n========================\n\nThe project is a collection of portable ANSI C code for communicating with\nDigi International's [XBee] wireless radio modules in API mode. You will\ntypically compile/link the files directly into your application, instead\nof compiling them into a shared/dynamic-link library.  Because of this\ndesign, most of the library configuration takes place at compile time.\n\nThis source has been contributed by [Digi International] under the Mozilla\nPublic License v2.0.  It is a BETA quality software release, and has gone\nthrough a limited QA cycle.\n\nIt currently supports the following platforms:\n\n- POSIX operating systems (Windows with [Cygwin] or [MSYS2], Mac OS X, Linux,\n  BSD) with gcc\n- Windows with [MinGW] or [Mingw-w64] and gcc\n- Digi International embedded hardware platforms that use [libdigiapix] to\n  control GPIO pins\n- DOS using the [OpenWatcom] compiler\n- Rabbit-brand microprocessors (using [Dynamic C] 10.70 or later)\n- Freescale HCS08 with CodeWarrior 10.x (part of [Programmable XBee Dev Kit])\n- Freescale FRDM-KL25Z with [mbed.org] compiler (limited support at this time)\n- [Silicon Labs] SLSTK3701A Starter Kit with Gecko SDK Suite v1.1.1 or later\n  with optional Micrium OS support\n\nIt provides an API for a host platform that communicates with an XBee radio\nserially.  Some of the features include:\n\n- Frame dispatcher that passes complete frames from the XBee radio out to\n  multiple functions based on frame type.\n- Interface for sending API frames serially, with automatic header and\n  checksum.\n- Message delivery that includes addressing information (short/long remote\n  address, source/destination endpoint, cluster ID and profile ID).\n- Respond to messages using addressing information from the envelope of\n  a received message.\n- Interface for sending \"AT Command\" frames.\n- Perform Node Discovery and manage a list of nodes.\n- Install firmware images (.EBL/.GBL or .OEM files) on the XBee radio.\n- Parse and display digital/analog I/O samples.\n- Interface with the General Purpose Memory (GPM) found on some XBee modules.\n\nUse [GitHub] to report bugs, request features or contribute code\nto this project.  Please read through this document before getting started\nwith the code.\n\n[Digi International]: http://www.digi.com/\n[XBee]: http://www.digi.com/xbee/\n[GitHub]: https://github.com/digidotcom/xbee_ansic_library\n[Cygwin]: http://www.cygwin.org/\n[MSYS2]: https://www.msys2.org/\n[MinGW]: http://www.mingw.org/\n[Mingw-w64]: http://mingw-w64.org/\n[libdigiapix]: https://github.com/digi-embedded/libdigiapix\n[OpenWatcom]: http://www.openwatcom.org/\n[Dynamic C]: http://www.digi.com/support/productdetail?pid=4978\n[Programmable XBee Dev Kit]: http://www.digi.com/programmablexbeekit\n[mbed.org]: http://mbed.org/\n[Silicon Labs]: http://www.silabs.com/\n\nRequirements\n------------\nLook at the `README.md` file in the appropriate `ports/` sub-directory\nfor information on setting up the build environment.\n\n\nDocumentation\n-------------\nYou can find [official documentation] on the GitHub page for the \nproject.  To generate local documentation to the `doc/html` directory,\nfirst download and install [Doxygen].\n\nLaunch Doxywizard and open `Doxyfile` at the root directory of the driver.\nGo to the \"Run\" tab and click the \"Run doxygen\" button to build the HTML\ndocumentation files.  The doxygen output will produce warnings for undocumented\nportions of the code -- that's OK and expected.\n\nTo view the documentation, open `doc/html/index.html` in a web browser.\n\n[official documentation]: http://digidotcom.github.io/xbee_ansic_library/\n[Doxygen]: http://www.doxygen.nl/\n\nXBee Firmware\n-------------\nConfigure your XBee radio with DigiMesh, ZigBee or Smart Energy firmware in\n\"API\" mode (with an API mode firmware or by setting ATAP=1).  The samples use\na default baud rate of 115200. The library is written to make use of flow control,\nso ATD6/ATD7 needs to be set to 1. Configure the radio with ATAO set to 1 to use\nextended transmit and receive frames.\n\n\nZigBee Firmware\n---------------\nWhen using ZigBee and Smart Energy firmware, keep the radio set to ATAO=1.\nIn your application, you will need to set AO to 3 at startup in order to\nreceive and process ZDO/ZDP requests used to discover your device's endpoints\nand clusters.  On exit, set AO back to 1 so the radio will process those\nrequests (and Smart Energy devices can complete Key Establishment to join a\nnetwork).\n\n    xbee_cmd_simple(\u0026my_xbee, \"AO\", 3);\n\nOn ZigBee networks without Key Establishment, it should be safe to keep AO set\nto 3.\n\n\nFile Descriptions\n-----------------\nNote that `frame_types.md` identifies headers and source files written to\nsupport each frame type.\n\nHeaders:\n\n- `xbee/platform.h`: Function prototypes for hardware abstraction layer.\n\n- `ports/\u003ctarget\u003e/platform_config.h`: Additional headers, automatically\n  included by `xbee/platform.h`, based on the target device.\n\n- `xbee/serial.h`: Platform-specific functions for managing the serial\n  interface, reading and writing bytes, checking the XBee's CTS pin and\n  setting the host's RTS pin.\n\n- `xbee/device.h`: Read frames from XBee module and dispatch to frame\n  handlers, send full frames to XBee module.\n\n- `xbee/atcmd.h`: Working with local and remote \"AT Command\" frames for\n  getting and setting XBee attributes and executing XBee commands.\n\n- `xbee/atmode.h`: Interfacing with XBee module in \"AT mode\", currently\n  used for firmware updates on non-ZigBee modules.\n\n- `xbee/bl_gen3.h`: Support for the \"Gen3 Bootloader\" used by S3B, S6, S6B,\n  XLR, Cellular, SX, SX868, and S8 hardware.\n\n- `xbee/ble.h`: Support for BLE feature frames on the XBee3 BLU.\n\n- `xbee/byteorder.h`: Byte-order-related functions used by multiple layers\n  of the driver.\n\n- `xbee/cbuf.h`: Circular buffer used by the serial driver on some\n  platforms, and the \"transparent serial\" cluster used in OTA updates.\n  Available for general use to upper layers of the stack.\n\n- `xbee/commissioning.h`: Code for supporting the ZCL Commissioning\n  Cluster on XBee ZB modules.  See `zigbee/zcl_commissioning.h` for the\n  required networking code.\n\n- `xbee/delivery_status.h`: Status codes for 0x89 and 0x8B frames.\n\n- `xbee/discovery.h`: Code related to Node Discovery (ATND).\n\n- `xbee/firmware.h`: Code for updating radio firmware via .ebl, .gbl or .oem\n  files.\n\n- `xbee/gpm.h`: Code related to the General Purpose Memory (GPM) present\n  on various XBee modules (e.g., S3B, S6B).\n\n- `xbee/io.h`: Code for working with the analog and digital I/O pins on\n  the XBee module.\n\n- `xbee/ipv4.h`: Support for IPv4 frames on XBee and XBee3 Cellular products.\n\n- `xbee/jslong.h` and `xbee/jslong_glue.h`: Code from mozilla.org used to\n  manage 64-bit integers on platforms without direct support of them.\n\n- `xbee/pxbee_ota_client.h`: Client code for sending OTA (over-the-air) firmware\n  updates to Programmable XBee modules.\n\n- `xbee/pxbee_ota_server.h`: Server code for advertising OTA capabilities on a\n  device (typically a Programmable XBee module).\n\n- `xbee/scan.h`: Structures describing `ATAS` (Active Scan) responses.\n\n- `xbee/sms.h`: Support for SMS features of XBee and XBee3 Cellular products.\n\n- `xbee/socket.h` and `xbee/socket_frames.h`: Support for Sockets API frames on\n  XBee and XBee3 Cellular prodcuts.\n\n- `xbee/sxa.h`: A \"Simplified XBee API\" with support for node table\n  management, configurable I/O, point-to-point data streams and a\n  connectionless datagram protocol.  Used for XBee-only (not general\n  ZigBee) networks.  (Sample code limited to Rabbit platform.)\n\n- `xbee/time.h`: Portable time functions for embedded platforms lacking\n  full support of the Standard C Library `time.h`.  Includes a version\n  of `gmtime()` and `mktime()` using 1/1/2000 as the epoch.\n\n- `xbee/transparent_serial.h`: Support code for the \"Digi Transparent\n  Serial\" cluster (cluster 0x0011 of endpoint 0xE8), to communicate with\n  \"dumb\" XBee modules running non-API mode firmware.\n\n- `xbee/user_data.h`: Support for User Data Relay API frames used on XBee\n  and XBee3 Cellular/802.15.4/Digimesh/Zigbee products.\n\n- `xbee/wifi.h`: Code specific to the XBee S6B (Wi-Fi) module.\n\n- `xbee/wpan.h`: Glue layer between XBee device driver and 802.15.4/ZigBee\n  network.\n\n- `xbee/xmodem.h`: XMODEM protocol layer, on top of xbee/serial layer, for\n  sending firmware updates.\n\n- `xbee/xmodem_crc16.h`: Function to calculate 16-bit XMODEM CRC.\n\n- `wpan/types.h`: Types used by Wireless Personal Area Networks, not\n  specific to the ZigBee protocol (e.g., 802.15.4 and DigiMesh).\n\n- `wpan/aps.h`: APS-layer of WPAN networks (endpoints/clusters).\n\n- `zigbee/zcl.h`: ZigBee Cluster Library, including general commands.\n\n- `zigbee/zcl_basic.h`: Basic Cluster for ZCL.\n\n- `zigbee/zcl_basic_attributes.h`: Used in main program to create a data\n  structure and attribute for use in the device's endpoint table.\n\n- `zigbee/zcl_client.h`: Helper functions for creating ZCL client\n  clusters.\n\n- `zigbee/zcl_commissioning.h`: Non-certified implementation of\n  Commissioning Cluster (server).\n\n- `zigbee/zcl_identify.h`: ZCL Identify Cluster (server).\n\n- `zigbee/zcl_onoff.h`: ZCL OnOff Cluster (incomplete).\n\n- `zigbee/zcl_time.h`: ZCL Time Cluster (client and server).\n\n- `zigbee/zcl_types.h`: ZCL datatypes\n\n- `zigbee/zdo.h`: ZigBee Device Objects/ZigBee Device Profile layer.\n\n\nSource (.c) directories:\n\n- `wpan`: source files for `include/wpan/*.h`\n\n- `xbee`: source files for `include/xbee/*.h`\n\n- `util`: Helper functions that may not be available on a given target.\n  In some cases (like `swapbytes.c`), it can be used until an optimized,\n  assembly-only version of the function can be written for the target.\n\n- `zigbee`: source files for include/zigbee/*.h\n\n\nSample Programs\n---------------\nSee `samples/README.md` for descriptions.\n\n\nAdding to the Library\n=====================\n\nWe welcome your contributions to this library of code, but ask that you\nplease follow these general guidelines.\n\nCoding Style\n------------\n-\tIn general, code additions should match the style of existing code.  Old\n\tfiles used 3-space tabs to match a legacy codebase, but current preference\n\tis to use four spaces for indentation instead of tabs.\n\n-\tWhen naming things in the global namespace (functions, macros, global\n    variables) use a consistent prefix in the names.\n\n-\tLimit line length to 80 characters.\n\n-\tUse Doxygen-formatted comments for functions, types, globals and macros.\n\n-\tAlways use curly braces ({ and }) after if and else statements.  Follow\n    style of existing files:\n\n        // Legacy style:\n        if (foo)\n        {\n           do_bar();\n        }\n        else\n        {\n           do_baz();\n        }\n\n        // Preferred style for new code:\n        if (foo) {\n            do_bar();\n        } else {\n            do_baz();\n        }\n\n-\tDeclare pointers as `char *foo`, not `char* foo` or `char * foo`.\n\n\nPortability\n-----------\nThis driver has been designed for portability to multiple platforms, from a\nresource-constrained 8-bit Freescale, up to a Windows PC.  As such, it's\nimportant to keep the following in mind while working with the driver:\n\n-\tLeave BeginHeader/EndHeader comments in place -- they're used by the\n    linker in Dynamic C on the Rabbit platform.\n\n-\tUse ANSI C (C89/C90 preferred, C99 features allowed if widely supported).\n    To ease portability, code should not make use of GNU or other compiler\n    extensions.\n\n    Exceptions: Some pointers in the driver are labelled `FAR` to allow for\n    use of far memory on the Rabbit and HCS08 targets.  Most target platforms\n    define `FAR` as an empty macro.\n\n-\tUse types from `stdint.h` instead of `int`, `short` and `long`.  Unless\n    a variable is used within a function for a loop (where `int` is fine),\n    or used in a platform-specific file (e.g., as part of the hardware\n    abstraction layer), you should make use of the standard types from\n    `stdint.h`: `int8_t`, `uint8_t`, `int16_t`, `uint16_t`, `int32_t`,\n    `uint32_t`.\n\n-\tVariables and struct members that are stored in non-host-byte-order should\n    have `_le` or `_be` appended to their names (for big endian and little\n    endian).  Use the functions from `xbee/byteorder.h` (`htobe16`, `le32toh`,\n    `memcpy_htobe`, `memcpy_betole`, etc.) to convert between host and\n    big/little endian byte order.  If you pretend that you don't know your\n    host platform's endian-ness, you'll be forced to write portable code that\n    never assumes a given byte order.\n\n    *DO NOT* use `hton`, `ntoh`, `htons`, `ntohs`, `intel` or `intel16`.\n\n    XBee frames store multi-byte values in big endian byte order.\n    ZigBee frames store multi-byte values in little endian byte order.\n    Target platforms can be big endian or little endian.\n\n    Use `#if BYTE_ORDER == LITTLE_ENDIAN` or `#if BYTE_ORDER == BIG_ENDIAN`\n    when code requires different execution paths depending on the target's\n    byte order.\n\n-   When working with ZCL attributes, make use of the ZCL types for 40-bit\n    `zcl40_t`, 48-bit `zcl48_t`, and 64-bit `zcl64_t` values.  24-bit\n    attributes should use `uint32_t` or `int32_t` and 56-bit attributes\n    should use `zcl64_t` (ZCL automatically sign extends into the high byte).\n\n-\tPlace code at the correct layer of the driver.  We're trying to keep the\n    ZigBee layers (and above) separate from the XBee layers to allow for possible\n    gateway applications (ZigBee to Ethernet, for example), and to limit the\n    public release of ZigBee and Smart Energy code.\n\n\nOther Options\n-------------\nIf you find that this library doesn't meet your needs, take a look at\n[libxbee], \"a C/C++ library to aid the use of Digi XBee radios in API mode\".\n\nFor a detailed list of libraries in many languages, visit Digi's [XBee Examples]\nsite.\n\n[libxbee]: https://github.com/attie/libxbee3/\n[XBee Examples]: http://examples.digi.com/quick-reference/\n\n\nLicense\n-------\n\nThis software is open-source software.  Copyright Digi International, 2013.\n\nThis Source Code Form is subject to the terms of the Mozilla Public\nLicense, v. 2.0. If a copy of the MPL was not distributed with this file,\nYou can obtain one at http://mozilla.org/MPL/2.0/.\n\nThis software includes MPL 1.1 licensed code from the Mozilla project.  See\n`include/jslong.h` and `src/util/jslong.c` for details.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigidotcom%2Fxbee_ansic_library","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdigidotcom%2Fxbee_ansic_library","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigidotcom%2Fxbee_ansic_library/lists"}