def get_shuffle(): return mkcmd(4, "002C")
def select_button(): return mkcmd(2, chr(0x0) + chr(0x0) + chr(0x0) + chr(0x80))
def scroll_down(): return mkcmd(2, chr(0x0) + chr(0x0) + chr(0x0) + chr(0x0) + chr(0x2))
def toggle_repeat(): return mkcmd(2, chr(0x0) + chr(0x0) + chr(0x0) + chr(0x1))
def on(): return mkcmd(2, chr(0x0) + chr(0x0) + chr(0x0) + chr(0x8))
def release_button(): return mkcmd(2, chr(0x0) + chr(0x0))
def previous_playlist(): return mkcmd(2, chr(0x0) + chr(0x0) + chr(0x40))
def set_song_in_playlist(song = 0): return mkcmd(4, "0037" + inttohexstr(song))
#!/usr/bin/env python import general import serial import time import advanceddock import struct from general import * serialPort = "/dev/tty.usbserial" ser = serial.Serial(serialPort, baudrate=19200, timeout=1) ser.write(general.mkcmd(0, "0104")) # Set iPod in AIR mode. res = readResponse(ser) ser.write(advanceddock.set_pulling_mode(1)) ser.write(advanceddock.switch_to_type(5,0)) while True: if ser.inWaiting(): res = readResponse(ser, fullMessage=True) print res
def set_repeat(mode = 0): return mkcmd(4, "0031" + inttohexstr(mode, 1))
def get_playlist_songs(): return mkcmd(4, "0035")
def get_repeat(): return mkcmd(4, "002F")
def set_shuffle(mode = 0): return mkcmd(4, "002E" + inttohexstr(mode, 1))
def get_ipod_name(): return mkcmd(4, "0014")
def pause_only(): return mkcmd(2, chr(0x0) + chr(0x0) + chr(0x2))
def volume_up(): return mkcmd(2, chr(0x0) + chr(0x2))
def toggle_mute(): return mkcmd(2, chr(0x0) + chr(0x0) + chr(0x4))
def volume_down(): return mkcmd(2, chr(0x0) + chr(0x4))
def next_playlist(): return mkcmd(2, chr(0x0) + chr(0x0) + chr(0x20))
def skip_forward(): return mkcmd(2, chr(0x0) + chr(0x8))
def toggle_shuffle(): return mkcmd(2, chr(0x0) + chr(0x0) + chr(0x80))
def skip_backwards(): return mkcmd(2, chr(0x0) + chr(0x10))
def off(): return mkcmd(2, chr(0x0) + chr(0x0) + chr(0x0) + chr(0x4))
def next_album(): return mkcmd(2, chr(0x0) + chr(0x20))
def menu_button(): return mkcmd(2, chr(0x0) + chr(0x0) + chr(0x0) + chr(0x40))
def previous_album(): return mkcmd(2, chr(0x0) + chr(0x40))
def scroll_up(): return mkcmd(2, chr(0x0) + chr(0x0) + chr(0x0) + chr(0x0) + chr(0x1))
def stop(): return mkcmd(2, chr(0x0) + chr(0x80))
def play(): return mkcmd(2, chr(0x0) + chr(0x1))
def raw_control(cmd = 1): return mkcmd(4, "0029" + inttohexstr(cmd, 1))