{"id":16164021,"url":"https://github.com/cyclenerd/quarqd","last_synced_at":"2025-03-18T22:31:20.125Z","repository":{"id":72096473,"uuid":"82452865","full_name":"Cyclenerd/quarqd","owner":"Cyclenerd","description":"💡 quarqd is a daemon for communicating with an ANT+ device","archived":false,"fork":false,"pushed_at":"2020-01-03T15:47:35.000Z","size":52,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-28T12:45:10.733Z","etag":null,"topics":["ant","c","cycling","make","makefile","python"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Cyclenerd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2017-02-19T11:02:07.000Z","updated_at":"2023-10-01T06:56:37.000Z","dependencies_parsed_at":"2023-02-26T21:45:21.123Z","dependency_job_id":null,"html_url":"https://github.com/Cyclenerd/quarqd","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cyclenerd%2Fquarqd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cyclenerd%2Fquarqd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cyclenerd%2Fquarqd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cyclenerd%2Fquarqd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Cyclenerd","download_url":"https://codeload.github.com/Cyclenerd/quarqd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243954850,"owners_count":20374365,"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":["ant","c","cycling","make","makefile","python"],"created_at":"2024-10-10T02:44:59.702Z","updated_at":"2025-03-18T22:31:20.119Z","avatar_url":"https://github.com/Cyclenerd.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# quarqd\n\n**This repository is a copy of the original https://opensource.quarq.us/quarqd/ but with a revised README**\n\nquarqd is a daemon for communicating with an ANT device and reading ANT+ sport data.  Data is communicated over a network socket.\n\n\n## Usage\n\nquarqd may be run by itself. It does not detach from the terminal.\n\n### Control files\n\nquarqd can take some information from the file\n\n`$HOME/.quarqd_config`, e.g.:\n\n```\nQUARQD_PORT=8168    # the port quarqd should listen for connections on\nANT_TTY=/dev/ttyS0  # the device name of the Ant serial port \nANT_BAUDRATE=115200 # the baudrate of the Ant device\nQUARQD_DEBUG=1      # debug is a bitmask.  \n                    # 1 -\u003e print runtime error information\n                    # 2 -\u003e print Ant connection status changes\n                    # 4 -\u003e (quarq builds only) print all Ant messages \n                    # (default is 1)\n```\n\nEnvironment variables of the same names may be used, overriding the settings in `$HOME/.quarqd_config`\n\n### Getting data\n\nConnect to `$QUARQD_PORT`. Data is streamed out as XML.\n\n\n## Implementation\n\nSingle thread.  All data input comes from a select loop.\n\nData output is buffered, and the messages are (hopefully) short enough that I/O doesn't block.\n\nThe part of the code that generates messages comes from the Python script quarqd_messages.py, which generates the messages with the help of `ant_messages.py`.\n\n\n## About XML messages\n\n```\n\u003c$xml_message id=$ID time=$TIME $xml_message_dataname=$value [$xml_message_dataname=$value [...]] /\u003e\n```\n\n`$ID` is the Ant device_number for the sensor followed by:\n* 'h' (heart rate),\n* 'p' (power sensor),\n* 's' (speed sensor),\n* 'c' (cadence sensor),\n* 'd' (dual speed+cadence sensor)\n\n`$TIME` is seconds past the epoch.\n\nFor values of `$xml_message` and `$xml_message_dataname`, see [message_format.txt](https://github.com/Cyclenerd/quarqd/blob/master/message_format.txt)\n\nExample with heart rate, power, cadence and speed:\n[output.txt](https://github.com/Cyclenerd/quarqd/blob/master/output.txt)\n\n### Out-of-band values\n\n**SensorFound**\n```\n\u003cSensorFound id=$ID type=$SENSORTYPE [paired]\u003e\n```\nA new sensor has been found.  if paired, then the device was found through the pairing process. \n\n\n**SensorStale**\n```\n\u003cSensorStale id=$ID type=$SENSORTYPE\u003e\n```\nThe data from the sensor hasn't been updated for the stale timeout. (time to blank the display)\n\n\n**SensorDropped**\n```\n\u003cSensorDropped id=$ID type=$SENSORTYPE\u003e\n```\nThe sensor has not been heard from for the drop timeout.\n\n\n**SensorLost**\n```\n\u003cSensorLost  id=$ID type=$SENSORTYPE\u003e\n```\nThe sensor is missing.  To restart scan, resend X-set-channel for the channel.\n\n\n**Timeout**\n```\n\u003cTimeout type=$TIMEOUT_TYPE value=$V\u003e\n```\nReports timeout.  \n\n`$TIMEOUT_TYPE` is one of:\n\n- blanking: timeout before a \"stale data\" message is reported.\n- drop: timeout before a drop is reported.\n- scan: initial scan timeout.  Lower values for quicker initial connection with sensors.\n- lost: timeout in seconds before giving up on a sensor. Set to \"0\" to reserve a channel for a specific sensor always.\n\n**Error**\n```\n\u003cError\u003e message \u003c/Error\u003e\n```\n\n\n## Commands\n\n**X-set-channel: $ID[,channel_number]**\n\n* `$ID` is the Ant device_number of the sensor, followed by the one-character sensor type. \"0\" for any device_number of the specified type.\n* `channel_number` is the Ant channel to use for the device. Four channels, numbered 0-3. The previous occupant of the channel will be booted if necessary.  Leave blank for next-available-channel.\n\nExamples:\n* `X-set-channel: 17p` (power meter #17)\n* `X-set-channel: 0h,1` (scan for heart rate sensor)\n\n\n**X-unset-channel: $ID**\n\nChannel is closed and removed.\n\n\n**X-set-timeout: timeout_type=$TIMEOUT_TYPE**\n\nValue is in seconds, floating-point. \u003cTimeout\u003e message is returned.\n\n\n**X-list-channels**\n\nWill cause quarqd to output SensorFound messages for all the channels it is connected to.\n\n\n**X-pair-device: $ID[,channel_number]**\n\nLooks for a device with the pairing bit set.  device_number in `$ID` should be 0.\n\n**X-calibrate: $ID**\n\nSends the calibration message to the power channel `$ID`\n\n\n**X-set-test-mode: $ID**\n\nSets the test mode for `$ID` (must be a CinQo meter)\n\n\n**X-unset-test-mode: $ID**\n\nUnsets the test mode for `$ID`\n\n\n**X-get-slope: $ID**\n\nRetrieves the slope value for `$ID`\n\n\n**X-set-slope: $ID $SLOPE**\n\nSets the slope value for `$ID` to `$SLOPE`\n\n\n## Setup notes\n\n### macOS (OS X)\n\n**With Garmin driver:**\n\nUse the following `.quarqd_config`:\n```\nANT_TTY=/dev/cu.ANTUSBStick.slabvcp\nANT_BAUDRATE=115200 \n```\n\n**With generic SiLabs driver:**\n\nUses cp210x driver. Download from SiLabs: http://www.silabs.com/products/mcu/Pages/USBtoUARTBridgeVCPDrivers.aspx\n\nThen edit `/System/Library/Extensions/SiLabsUSBDriver.kext/Contents/Info.plist` and change the idProduct to 4100 and the idVendor to 4047.\n\nThen reboot. Look for the device at `/dev/cu.SLAB_USBtoUART`\n\nSet `.quarqd_config`:\n```\nANT_TTY=/dev/cu.SLAB_USBtoUART\nANT_BAUDRATE=115200\n```\n\nThanks to [Mark Liversedge](https://github.com/liversedge) for access to his computer for testing this.\n\n**Sparkfun ANT stick:**\n\nUses FTDI driver. http://www.ftdichip.com/Drivers/VCP.htm\n\nSet `.quarqd_config`:\n```\nANT_BAUDRATE=4800 # SparkFun baudrate\nANT_TTY=/dev/cu.usbserial-A7005G7c # SparkFun FTDI driver\n```\n\nThanks to [Justin Knotzke](https://github.com/jknotzke) for access to his computer for testing this.\n \n \n### Linux\n\nThe required drivers are already in the kernel. ANT_TTY will be `/dev/ttyUSB0` or similar and ANT_BAUDRATE will be the same as on OS X.\n\n\n### iOS (iPhone)\n\nQuarqd can talk to the hardware serial port.  This was tested with an Ant module connected to the +3.3v, ground, and serial RX/TX lines of the dock connector.\nTested with a jailbroken iPod touch. (When Apple-sanctioned ANT devices hit the market, it is likely that they will have an intervening microprocessor and quarqd won't be compatible.)\n\n\n## Build\n\n**Requirements:**\n\n* ANT+ network key. Edit [main.c](https://github.com/Cyclenerd/quarqd/blob/master/quarqd/src/main.c) and remove `#error Fix NetworkKey to ANT+ key`.\n\t* You find a key (`ANT::key`) in the Reposiory of [Golden Cheetah](https://github.com/GoldenCheetah/GoldenCheetah/blob/master/src/ANT/ANT.cpp).\n* Python 2.x at `/usr/bin/python`\n* ANSI C compiler (`gcc`)\n\nTo build single target, using the default native C compiler:\n\n```\ncd quarqd/src ; make\n```\n\nTo build all targets:\n\n```\ncd quarqd ; make\n```\n(This will fail unless you have installed the same cross compilers as me.)\n\nPlease report bugs to [Mark Rages](https://github.com/markrages).\n\n\n## License\n\nCopyright (c) 2007-2010, Quarq Technology Inc. Please see [LICENSE.txt](https://github.com/Cyclenerd/quarqd/blob/master/LICENSE.txt).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyclenerd%2Fquarqd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcyclenerd%2Fquarqd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyclenerd%2Fquarqd/lists"}