/* * * Copyright © 2006, University of Washington, * Department of Computer Science and Engineering. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither name of the University of Washington, Department of Computer * Science and Engineering nor the names of its contributors may be used to * endorse or promote products derived from this software without specific * prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * */ enum { SANG_SONG = 42, ADJUST_GLOBALS = 50, STOP_N_WAIT = 51, COMMAND = 52, STARTLE = 60, IDENTIFICATION = 61 }; enum { MAX_SONGS = 16, QUEUE_SIZE = 64, MAX_REPETITION_CHECK = 3, MAX_16 = 0xFFFF }; enum { HEALTHY = 1, INFECTED = 2, IMMUNE = 3, DEAD = 4 }; typedef struct Heard { uint16_t nodeNum; uint16_t songNum; uint16_t signal_strength; } Heard; typedef struct SongPlayed { uint16_t songNum; uint16_t timesPlayed; } SongPlayed; typedef struct SangSongPacket { uint16_t transmittingNodeNum; uint16_t sequenceNum; uint16_t songNum; uint8_t healthState; uint8_t immuneSystemStrength; uint8_t mutationCount; uint8_t mutationAmount; uint8_t minImmunityRange; uint8_t maxImmunityRange; } SangSongPacket; typedef struct GlobalParameters { uint16_t nodeNum; uint16_t minListen; uint16_t maxListen; uint16_t threshold; uint16_t minInfectionLength; uint16_t maxInfectionLength; uint16_t minImmuneLength; uint16_t maxImmuneLength; uint16_t minRebirthDelay; uint16_t maxRebirthDelay; uint16_t minPointValue; uint8_t repetition; uint8_t silence; uint8_t transmitPower; uint8_t startledHopCount; uint8_t infectiousness; uint8_t chanceRecovery; uint8_t chanceBornInfected; } GlobalParameters; typedef struct Stop_N_Wait { uint16_t nodeNum; uint16_t startAddr; uint16_t endAddr; } Stop_N_Wait; typedef struct CommandPkt { uint16_t nodeNum; uint16_t startAddr; uint16_t endAddr; uint16_t LED; uint16_t song; uint8_t healthState; } CommandPkt; typedef struct StartlePkt { uint16_t nodeNum; uint16_t hopCount; uint16_t startledSeqNum; } StartlePkt; typedef struct IdentificationPkt { uint16_t nodeNum; } IdentificationPkt;