/* File: phone.h Author: R. P. Futrelle Date: 8/1/98 Notice: Copyright 1998 by R. P. Futrelle and the College of Computer Science, Northeastern University Class: COM1204, Object-Oriented Design, Summer 1998. Proj: PS2.µ Metrowerks Code Warrior Mac. Done in IDE version 2.0.1. Purpose: Phone class definition. Modification history: 8/1/98: RPF. Started. */ // Phone number forms: exchange is 1-9, remainder of phone number is 1-99 // (leading zeros print poorly). class Phone : public Node{ public: static int next_id; int id; // ID number int p_number; // (100*exchange + p_number) Connector *connector; // the state components bool answered; bool dialing; bool me; bool picked_up; bool sound; Timer *pickup_timer; Timer *hangup_timer; Phone(int p_number); // constructor bool is_state(bool, bool, bool, bool, bool); void set_state(bool, bool, bool, bool, bool); void run(); void do_states(); // Actions void pickup_ph(); // puts pickup packet in link void hangup_ph(); // puts hangup packet in link void dial_ph(int p_number); // puts dial packet in link void speak(string); // puts speech in packet and packet in link };