Skip to content

Commit

Permalink
Merge pull request #78 from openxc/next
Browse files Browse the repository at this point in the history
Ready to release for new C5 additions
  • Loading branch information
emarsman committed May 9, 2016
2 parents 0e0ca32 + 98352e3 commit 7b22cac
Show file tree
Hide file tree
Showing 10 changed files with 672 additions and 276 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ env
coverage.xml
diffcover.html
htmlcov
*~
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
OpenXC Python Library Changelog
===============================

v0.13.0
----------

* Feature: Support for new C5 Cellular, SD, and RTC commands

v0.12.0
-----------

Expand Down
18 changes: 9 additions & 9 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ Reporting an Issue

* Make sure you have a `GitHub account <https://github.com/signup/free>`_
* Check if a ticket already exists for your issue on GitHub_.
* If one does not already exist, `create a new ticket`__
* Clearly describe the issue including steps to reproduce when it is a bug.
* Make sure you include in the earliest version that you know has the issue.
* If one does not already exist, `create a new ticket`__
+ Clearly describe the issue including steps to reproduce when it is a bug.
+ Make sure you include in the earliest version that you know has the issue.

__ GitHub_

Expand All @@ -25,18 +25,18 @@ Making Changes
fix or new feature.
* Fork the repository on GitHub
* Create a topic branch from where you want to base your work.
* This is usually the master branch.
* Only target release branches if you are certain your fix must be on that branch.
* To quickly create a topic branch based on master; ``git checkout -b
fix/master/my_contribution master``. Please avoid working directly on the
``master`` branch.
+ This is usually the master branch.
+ Only target release branches if you are certain your fix must be on that branch.
+ To quickly create a topic branch based on master:
``git checkout -b fix/master/my_contribution master``
+ Please avoid working directly on the ``master`` branch.
* Make commits of logical units.
* Check for unnecessary whitespace with `git diff --check` before committing.
* Make sure your commit messages are in the `proper
format <http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html>`_.
* Make sure you have added the necessary tests for your changes
* Run the `full test
suite <https://github.com/openxc/openxc-python/blob/master/README_developers.mkd>`_
suite <http://python.openxcplatform.com/en/master/contributing.html>`_
to assure nothing else was accidentally broken.

Submitting Changes
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ OpenXC for Python

.. image:: /docs/_static/logo.png

:Version: 0.12.0
:Version: 0.13.0
:Web: http://openxcplatform.com
:Download: http://pypi.python.org/pypi/openxc/
:Documentation: http://python.openxcplatform.com
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ OpenXC for Python

.. image:: /_static/logo.png

:Version: 0.12.0
:Version: 0.13.0
:Web: http://openxcplatform.com
:Download: http://pypi.python.org/pypi/openxc/
:Documentation: http://python.openxcplatform.com
Expand Down
30 changes: 30 additions & 0 deletions docs/tools/control.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,21 @@ Change the payload format to Protocol Buffers, then back to JSON:
$ openxc-control set --new-payload-format json
$ openxc-control set --new-payload-format protobuf
Change the time for the RTC unit on the C5 devices:

.. code-block:: bash
$ openxc-control set --time 1461545558
Set the host and port for the C5 Cellular device

.. code-block:: bash
$ openxc-control set --host www.server.com --port 80
This will return true when successful. If host is supplied, but not port,
port will default to 80.

------
write
------
Expand Down Expand Up @@ -96,6 +111,21 @@ a message with a lower ID using the extended frame format, you can use the
must allow writing the specific message that you request with
``openxc-control``.


---------------
sd_mount_status
---------------

This queries the device to see if the SD card is mounted correctly.

.. code-block:: bash
$ openxc-control sd_mount_status
This will return 'True' if the SD card is available for writing. Otherwise, it will return 'False'.



Command-line options
====================

Expand Down
38 changes: 38 additions & 0 deletions openxc/controllers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,32 @@ def set_payload_format(self, payload_format):
self.format = payload_format
return status


def rtc_configuration(self, unix_time):
"""Set the Unix time if RTC is supported on the device.
Returns True if the command was successful.
"""
request = {
"command": "rtc_configuration",
"unix_time": unix_time
}
status = self._check_command_response_status(request)
return status

def modem_configuration(self, host, port):
"""Set the host:port for the Cellular device to send data to.
Returns True if the command was successful.
"""
request = {
"command": "modem_configuration",
"host": host,
"port": port
}
status = self._check_command_response_status(request)
return status

def set_acceptance_filter_bypass(self, bus, bypass):
"""Control the status of CAN acceptance filter for a bus.
Expand Down Expand Up @@ -331,6 +357,18 @@ def version(self):
}
return self._check_command_response_message(request)

def sd_mount_status(self):
"""Request for SD Mount status if available.
"""
request = {
"command": "sd_mount_status"
}
responses = self.complex_request(request)
result = None
if len(responses) > 0:
result = responses[0].get('status')
return result

def device_id(self):
"""Request the unique device ID of the attached VI.
"""
Expand Down
Loading

0 comments on commit 7b22cac

Please sign in to comment.