KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Intercom_Control_PDU.h
Go to the documentation of this file.
1 /*********************************************************************
2 Copyright 2013 Karl Jones
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7 
8 1. Redistributions of source code must retain the above copyright notice, this
9  list of conditions and the following disclaimer.
10 2. Redistributions in binary form must reproduce the above copyright notice,
11  this list of conditions and the following disclaimer in the documentation
12  and/or other materials provided with the distribution.
13 
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
18 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 
25 For Further Information Please Contact me at
26 Karljj1@yahoo.com
27 http://p.sf.net/kdis/UserGuide
28 *********************************************************************/
29 
30 /********************************************************************
31  class: Intercom_Control_PDU
32  DIS: (6) 1278.1A - 1998
33  created: 2009/02/24
34  author: Karl Jones
35 
36  purpose: Contains detailed infomation about the state of an intercom
37  device and the actions it is requesting of another intercom
38  device or the response to a requested action.
39 
40  size: 320 bits / 40 - min size
41 *********************************************************************/
42 
43 #pragma once
44 
45 #include "./../Header.h"
46 #include "./../../DataTypes/CommunicationsChannelType.h"
47 #include "./../../DataTypes/EntityIdentifier.h"
48 #include "./../../DataTypes/IntercomCommunicationParameters.h"
49 
50 namespace KDIS {
51 namespace PDU {
52 
59 using std::vector;
60 
62 {
63 protected:
64 
66 
68 
70 
72 
74 
76 
78 
80 
82 
84 
86 
88 
89  std::vector<KDIS::DATA_TYPE::IntercomCommunicationParameters> m_vICP;
90 
91 public:
92 
93  static const KUINT16 INTERCOM_CONTROL_PDU_SIZE = 40; // Min Size
94 
96 
97  Intercom_Control_PDU( KDataStream & stream ) throw( KException );
98 
99  Intercom_Control_PDU( const Header & H, KDataStream & stream ) throw( KException );
100 
101  virtual ~Intercom_Control_PDU();
102 
103  //************************************
104  // FullName: KDIS::PDU::Intercom_Control_PDU::SetControlType
105  // KDIS::PDU::Intercom_Control_PDU::GetControlType
106  //!Description: Identifies the type of control requested.
107  // Parameter: ControlType CT
108  //************************************
109  void SetControlType( KDIS::DATA_TYPE::ENUMS::ControlType CT );
110  KDIS::DATA_TYPE::ENUMS::ControlType GetControlType() const;
111 
112  //************************************
113  // FullName: KDIS::PDU::Intercom_Control_PDU::SetCommunicationsChannelType
114  // KDIS::PDU::Intercom_Control_PDU::GetCommunicationsChannelType
115  //!Description: Identifies the Communications Channel Type, class & type.
116  // Parameter: const CommunicationsChannelType & CCT
117  //************************************
118  void SetCommunicationsChannelType( const KDIS::DATA_TYPE::CommunicationsChannelType & CCT );
119  const KDIS::DATA_TYPE::CommunicationsChannelType & GetCommunicationsChannelType() const;
120  KDIS::DATA_TYPE::CommunicationsChannelType & GetCommunicationsChannelType();
121 
122  //************************************
123  // FullName: KDIS::PDU::Intercom_Control_PDU::SetSourceEntityID
124  // KDIS::PDU::Intercom_Control_PDU::GetSourceEntityID
125  //!Description: Entity that is the source of the radio intercom transmission.
126  //! This Entity ID can be for either the entity that contains/owns
127  //! the intercom device or the intercom device itself.
128  // Parameter: const EntityIdentifier & ID
129  //************************************
130  void SetSourceEntityID ( const KDIS::DATA_TYPE::EntityIdentifier & ID );
131  const KDIS::DATA_TYPE::EntityIdentifier & GetSourceEntityID() const;
132  KDIS::DATA_TYPE::EntityIdentifier & GetSourceEntityID();
133 
134  //************************************
135  // FullName: KDIS::PDU::Intercom_Control_PDU::SetSourceCommDeviceID
136  // KDIS::PDU::Intercom_Control_PDU::GetSourceCommDeviceID
137  //!Description: Identifies the specific intercom device being interfaced
138  //! and/or simulated within an entity.
139  //! All devices on an entity must have a unique ID.
140  //! Set to 0 if the entity does not have a simulated device.
141  // Parameter: KUINT16 ID
142  //************************************
143  void SetSourceCommDeviceID( KUINT16 ID );
144  KUINT16 GetSourceCommDeviceID() const;
145 
146  //************************************
147  // FullName: KDIS::PDU::Intercom_Control_PDU::SetSourceLineID
148  // KDIS::PDU::Intercom_Control_PDU::GetSourceLineID
149  //!Description: Identifies the line number to which this intercom control refers.
150  //! E.G. For a intercom device with a single line the value would be 1.
151  // Parameter: KUINT8 ID
152  //************************************
153  void SetSourceLineID( KUINT8 ID );
154  KUINT8 GetSourceLineID() const;
155 
156  //************************************
157  // FullName: KDIS::PDU::Intercom_Control_PDU::SetTransmitPriority
158  // KDIS::PDU::Intercom_Control_PDU::GetTransmitPriority
159  //!Description: Identifies the priority of this message relative to transmissions
160  //! from other intercom devices on the same channel.
161  //! The value 0 is reserved.
162  //! 1 = highest priority, 255 = lowest priority.
163  // Parameter: KUINT8 TP
164  //************************************
165  void SetTransmitPriority( KUINT8 TP );
166  KUINT8 GetTransmitPriority() const;
167 
168  //************************************
169  // FullName: KDIS::PDU::Intercom_Control_PDU::SetTransmitLineState
170  // KDIS::PDU::Intercom_Control_PDU::GetTransmitLineState
171  //!Description: Identify the current transmit state of the line at the intercom
172  //! source.
173  // Parameter: TransmitLineState TLS
174  //************************************
175  void SetTransmitLineState( KDIS::DATA_TYPE::ENUMS::TransmitLineState TLS );
176  KDIS::DATA_TYPE::ENUMS::TransmitLineState GetTransmitLineState() const;
177 
178  //************************************
179  // FullName: KDIS::PDU::Intercom_Control_PDU::SetLineStateCommand
180  // KDIS::PDU::Intercom_Control_PDU::GetLineStateCommand
181  //!Description: When the Control Type of the Intercom Control PDU is
182  //! request or acknowledge, this field shall specify the
183  //! detailed type requested. Otherwise set to 0.
184  // Parameter: LineStateCommand LSC
185  //************************************
186  void SetLineStateCommand( KDIS::DATA_TYPE::ENUMS::LineStateCommand LSC );
187  KDIS::DATA_TYPE::ENUMS::LineStateCommand GetLineStateCommand() const;
188 
189  //************************************
190  // FullName: KDIS::PDU::Intercom_Control_PDU::SetMasterEntityID
191  // KDIS::PDU::Intercom_Control_PDU::GetMasterEntityID
192  //!Description: Entity that has created this intercom channel.
193  // Parameter: const EntityIdentifier & ID
194  //************************************
195  void SetMasterEntityID ( const KDIS::DATA_TYPE::EntityIdentifier & ID );
196  const KDIS::DATA_TYPE::EntityIdentifier & GetMasterEntityID() const;
197  KDIS::DATA_TYPE::EntityIdentifier & GetMasterEntityID();
198 
199  //************************************
200  // FullName: KDIS::PDU::Intercom_Control_PDU::SetMasterCommDeviceID
201  // KDIS::PDU::Intercom_Control_PDU::GetMasterCommDeviceID
202  //!Description: Identifies the specific intercom device that has created
203  //! this intercom channel.
204  //! When identifying a particular intercom device, the Master
205  //! Communications Device ID shall be greater than or equal to one.
206  //! The Master Communications Device ID field ID shall contain the
207  //! value zero only when the entity creating this channel does not have,
208  //! or does not wish to associate this channel with, an intercom device.
209  //! All intercom units associated with a particular site/application/entity
210  //! are numbered to provide unique identification.
211  // Parameter: KUINT16 ID
212  //************************************
213  void SetMasterCommDeviceID( KUINT16 ID );
214  KUINT16 GetMasterCommDeviceID() const;
215 
216  //************************************
217  // FullName: KDIS::PDU::Intercom_Control_PDU::SetMasterChannelID
218  // KDIS::PDU::Intercom_Control_PDU::GetMasterChannelID
219  //!Description: Identifies a unique intercom channel created by this Master Entity
220  //! ID and Master Communications Device ID pair.
221  // Parameter: KUINT16 ID
222  //************************************
223  void SetMasterChannelID( KUINT16 ID );
224  KUINT16 GetMasterChannelID() const;
225 
226  //************************************
227  // FullName: KDIS::PDU::Intercom_Control_PDU::SetMasterChannelID
228  //!Description: Length of all optional Intercom parameters, in octets.
229  //************************************
230  KUINT32 GetIntercomParametersLength() const;
231 
232  //************************************
233  // FullName: KDIS::PDU::Intercom_Control_PDU::AddIntercomCommunicationParameters
234  // KDIS::PDU::Intercom_Control_PDU::SetIntercomCommunicationParameters
235  // KDIS::PDU::Intercom_Control_PDU::GetIntercomCommunicationParameters
236  //!Description: Add a Intercom Communication Parameter / Get vector or params.
237  // Parameter: const IntercomCommunicationParameters & ICP
238  //************************************
239  void AddIntercomCommunicationParameters( const KDIS::DATA_TYPE::IntercomCommunicationParameters & ICP );
240  void SetIntercomCommunicationParameters( const std::vector<KDIS::DATA_TYPE::IntercomCommunicationParameters> & ICP );
241  const std::vector<KDIS::DATA_TYPE::IntercomCommunicationParameters> & GetIntercomCommunicationParameters() const;
242 
243  //************************************
244  // FullName: KDIS::PDU::Intercom_Control_PDU::GetAsString
245  //!Description: Returns a string representation of the PDU.
246  //************************************
247  virtual KString GetAsString() const;
248 
249  //************************************
250  // FullName: KDIS::PDU::Intercom_Control_PDU::Decode
251  //!Description: Convert From Network Data.
252  // Parameter: KDataStream & stream
253  // Parameter: bool ignoreHeader = false - Decode the header from the stream?
254  //************************************
255  virtual void Decode( KDataStream & stream, bool ignoreHeader = false ) throw( KException );
256 
257  //************************************
258  // FullName: KDIS::PDU::Intercom_Control_PDU::Encode
259  //!Description: Convert To Network Data.
260  // Parameter: KDataStream & stream
261  //************************************
262  virtual KDataStream Encode() const;
263  virtual void Encode( KDataStream & stream ) const;
264 
265  KBOOL operator == ( const Intercom_Control_PDU & Value ) const;
266  KBOOL operator != ( const Intercom_Control_PDU & Value ) const;
267 };
268 
269 } // END namespace PDU
270 } // END namespace KDIS
271 
unsigned int KUINT32
Definition: KDefines.h:103
KUINT16 m_ui16SrcCommDevID
Definition: Intercom_Control_PDU.h:71
Definition: CommunicationsChannelType.h:46
KUINT8 m_ui8SrcLineID
Definition: Intercom_Control_PDU.h:73
unsigned short int KUINT16
Definition: KDefines.h:101
ControlType
Definition: EnumRadio.h:439
Definition: Intercom_Control_PDU.h:61
KUINT16 m_ui16MstrChannelID
Definition: Intercom_Control_PDU.h:85
KUINT8 m_ui8TransmitLineState
Definition: Intercom_Control_PDU.h:77
KUINT8 m_ui8TransmitPriority
Definition: Intercom_Control_PDU.h:75
KDIS::DATA_TYPE::EntityIdentifier m_SrcEnt
Definition: Intercom_Control_PDU.h:69
Definition: KDefines.h:182
Definition: KDataStream.h:48
KDIS::DATA_TYPE::CommunicationsChannelType m_CommChannelType
Definition: Intercom_Control_PDU.h:67
KDIS::DATA_TYPE::EntityIdentifier m_MstrEntID
Definition: Intercom_Control_PDU.h:81
bool KBOOL
Definition: KDefines.h:119
std::string KString
Definition: KDefines.h:116
TransmitLineState
Definition: EnumRadio.h:496
Definition: EntityIdentifier.h:49
LineStateCommand
Definition: EnumRadio.h:517
KUINT32 m_ui32IntrParamLen
Definition: Intercom_Control_PDU.h:87
Definition: Header7.h:142
KUINT8 m_ui8CtrlTyp
Definition: Intercom_Control_PDU.h:65
unsigned char KUINT8
Definition: KDefines.h:99
KUINT16 m_ui16MstrCommDeviceID
Definition: Intercom_Control_PDU.h:83
#define KDIS_EXPORT
Definition: KDefines.h:82
Definition: IntercomCommunicationParameters.h:49
std::vector< KDIS::DATA_TYPE::IntercomCommunicationParameters > m_vICP
Definition: Intercom_Control_PDU.h:89
KUINT8 m_ui8Command
Definition: Intercom_Control_PDU.h:79