/**** * A definition of the operations * supported on the shade ****/ #ifndef OPS_H #define OPS_H /**** * The following format is used for base station * to remote device communication. * * Instruction format: * | Addr | OpCode | XXX | YYY | * All fields are 1-byte. Addr is the address of the * remote device and should unique to a device. Unless * of course, the device is meant to be controlled * symmetrically. ****/ /**** * Description: Opens the shade a relative amount * Fields: * OpCode = 'O' * XXX = Amount to adjust * YYY = Don't Care ****/ #define OP_OPEN 'O' /**** * Description: Closes the shade a relative amount * Fields: * OpCode = 'C' * XXX = Amount to adjust * YYY = Don't Care ****/ #define OP_CLOSE 'C' /**** * Description: Rolls the shade up a relative amount * Fields: * OpCode = 'U' * XXX = Amount to adjust * YYY = Don't Care ****/ #define OP_UP 'U' /**** * Description: Rolls the shade down a relative amount * Fields: * OpCode = 'D' * XXX = Amount to adjust * YYY = Don't Care ****/ #define OP_DOWN 'D' /**** * Description: Adjust shade to a specific absolute position * Fields: * OpCoe = 'A' * XXX = Up/Down position * YYY = Flap Position ****/ #define OP_ADJ 'A' /**** * Description: Requests information from the shade * Fields: * OpCode = 'R' * XXX = Sensor to poll * YYY = Don't Care ****/ #define OP_REQUEST 'R' // Request information /**** * Description: Calibrates the motor * Fields: * OpCode = 'K' * XXX = Don't Care * YYY = Don't Care ****/ #define OP_CALIB 'K' /**** * The followig format is used for remote device to * base station communication: * | 0x00 | Addr | XXX | YYY | * Addr is the address of the device communicating * with the base station. ****/ /**** * Description: Response to request for information inquery * Fields: * XXX = Value reference (e.g. SensorID) * YYY = Value from reference ****/ /**** * The following format is used for base station to * computer communications: * * | Status | (RET VALUE) | * * The second field is optional and represents a return * value given to driving app on the computer if the * desired operation returns a value (e.g. Requests). ****/ /**** * Description: Tells the driving app on the computer to * wait. * Satus = 'W' ****/ #define STATUS_WAITING 'W' /**** * Description: Tells the driving app on the computer it * is done. * Fields: * Status = 'D' ****/ #define STATUS_DONE 'D' /*** * Description: Command from computer failed. * Fields: * Status = 'F' ****/ #define STATUS_FAIL 'F' #endif