# Ruby code to control Russound CAV6.6

**URL:** <https://www.ruby-forum.com/t/ruby-code-to-control-russound-cav6-6/98746>\
**Category:** Ruby\
**Created:** [July 17, 2006, 10:02pm UTC](https://www.ruby-forum.com/t/ruby-code-to-control-russound-cav6-6/98746 "2006-07-17T22:02:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![phrogz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/2acd7d/32.png) [@phrogz](https://www.ruby-forum.com/u/phrogz)\
**Post date:** [July 17, 2006, 10:02pm UTC](https://www.ruby-forum.com/t/ruby-code-to-control-russound-cav6-6/98746/1 "2006-07-17T22:02:46Z")

</div>

I’m (finally) starting to set up my home for automated electronics. The  
first bit I’m working on will be for the Russound CAV6.6, though  
(looking at their various API documents) it should be largely  
applicable to various RS-232-controlled devices from Russound.

Is anyone interested in controlling this product, or other Russound  
products, using Ruby code? If so, please let me know. I’m trying to  
decide between hacking together what I need versus writing a flexible  
library that others may use.

---

<div class="post-metadata">

**Author:** ![phrogz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/2acd7d/32.png) [@phrogz](https://www.ruby-forum.com/u/phrogz)\
**Post date:** [July 17, 2006, 11:02pm UTC](https://www.ruby-forum.com/t/ruby-code-to-control-russound-cav6-6/98746/2 "2006-07-17T23:02:16Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

Phrogz wrote:

> I’m (finally) starting to set up my home for automated electronics. The  
> first bit I’m working on will be for the Russound CAV6.6, though  
> (looking at their various API documents) it should be largely  
> applicable to various RS-232-controlled devices from Russound.

Last time I checked, there wasn’t any (usable) serial-port extension  
for Ruby. Thus, how are you planning to have Ruby communicate via  
RS-232?

> Is anyone interested in controlling this product, or other Russound  
> products, using Ruby code? If so, please let me know. I’m trying to  
> decide between hacking together what I need versus writing a flexible  
> library that others may use.

The library, it seems to me, would simply be an extension/relative  
of the IO class which keeps state information about the particular  
Russound device being controlled, correct?

If so, you’d probably hacking in this direction anyway, so get  
something working first and then integrate your work into a library.  
-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.2.2 (GNU/Linux)

iD8DBQFEu/otmV9O7RYnKMcRAmeOAKCzANYCF6P694YXnIF0PNxvitv7FwCgmwsp  
g/R3rVywteJLjao6yoSOgNM=  
=mjk4  
-----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![phrogz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/2acd7d/32.png) [@phrogz](https://www.ruby-forum.com/u/phrogz)\
**Post date:** [July 18, 2006, 2:06am UTC](https://www.ruby-forum.com/t/ruby-code-to-control-russound-cav6-6/98746/3 "2006-07-18T02:06:08Z")

</div>

Suraj N. Kurapati wrote:

> Last time I checked, there wasn’t any (usable) serial-port extension  
> for Ruby. Thus, how are you planning to have Ruby communicate via  
> RS-232?

Like this:  
[http://groups.google.com/group/comp.lang.ruby/browse\_frm/thread/21d9ef82f56346a/1f72a79dd9760dc1?q=serial&rnum=1#1f72a79dd9760dc1](http://groups.google.com/group/comp.lang.ruby/browse_frm/thread/21d9ef82f56346a/1f72a79dd9760dc1?q=serial&rnum=1#1f72a79dd9760dc1)

> The library, it seems to me, would simply be an extension/relative  
> of the IO class which keeps state information about the particular  
> Russound device being controlled, correct?

Well, the Russound API has specific packet formats it uses. In addition  
to wrapping up common commands (volume=, zone\_source=, allon, alloff),  
the library does stuff like forming the packets for you, which includes  
calculating the checksum according to russound’s algorithm, inverting  
high-order bytes and injecting special markers, and so on.

It will use a derivative of IO for the actual communication, but  
there’s some higher-level niceties planned and in the works.
