| 
									
										
										
										
											2016-07-02 12:15:41 +00:00
										 |  |  | program QRA64code
 | 
					
						
							| 
									
										
										
										
											2016-06-22 20:45:29 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | ! Provides examples of message packing, bit and symbol ordering,
 | 
					
						
							| 
									
										
										
										
											2016-07-02 12:15:41 +00:00
										 |  |  | ! QRA (63,12) encoding, and other necessary details of the QRA64
 | 
					
						
							| 
									
										
										
										
											2016-11-21 21:23:48 +00:00
										 |  |  | ! protocol.  
 | 
					
						
							| 
									
										
										
										
											2016-06-23 13:58:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-22 20:45:29 +00:00
										 |  |  |   use packjt
 | 
					
						
							| 
									
										
										
										
											2016-06-29 19:12:46 +00:00
										 |  |  |   character*22 msg,msg0,msg1,decoded,cok*3,msgtype*10,arg*12
 | 
					
						
							|  |  |  |   character*6 mycall
 | 
					
						
							|  |  |  |   logical ltext
 | 
					
						
							| 
									
										
										
										
											2016-06-22 20:45:29 +00:00
										 |  |  |   integer dgen(12),sent(63),dec(12)
 | 
					
						
							| 
									
										
										
										
											2016-11-21 21:23:48 +00:00
										 |  |  |   integer icos7(0:6)
 | 
					
						
							|  |  |  |   data icos7/2,5,6,0,4,1,3/     !Defines a 7x7 Costas array
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-22 20:45:29 +00:00
										 |  |  |   include 'testmsg.f90'
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   nargs=iargc()
 | 
					
						
							| 
									
										
										
										
											2016-06-23 13:58:18 +00:00
										 |  |  |   if(nargs.lt.1) then
 | 
					
						
							| 
									
										
										
										
											2016-11-21 21:23:48 +00:00
										 |  |  |      print*,'Usage: qra64code "message"'
 | 
					
						
							|  |  |  |      print*,'       qra64code -t'
 | 
					
						
							| 
									
										
										
										
											2016-06-22 20:45:29 +00:00
										 |  |  |      go to 999
 | 
					
						
							|  |  |  |   endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   call getarg(1,msg)                     !Get message from command line
 | 
					
						
							|  |  |  |   nmsg=1
 | 
					
						
							| 
									
										
										
										
											2016-11-21 21:23:48 +00:00
										 |  |  |   if(msg(1:2).eq."-t") nmsg=NTEST
 | 
					
						
							| 
									
										
										
										
											2016-06-22 20:45:29 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   write(*,1010)
 | 
					
						
							| 
									
										
										
										
											2016-11-21 21:23:48 +00:00
										 |  |  | 1010 format("     Message                 Decoded                Err? Type"/74("-"))
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   do imsg=1,nmsg
 | 
					
						
							|  |  |  |      if(nmsg.gt.1) msg=testmsg(imsg)
 | 
					
						
							| 
									
										
										
										
											2018-07-10 15:09:42 -04:00
										 |  |  |     call fmtmsg(msg,iz)                     !To upper, collapse mult blanks
 | 
					
						
							| 
									
										
										
										
											2016-11-21 21:23:48 +00:00
										 |  |  |      msg0=msg                               !Input message
 | 
					
						
							|  |  |  |      call chkmsg(msg,cok,nspecial,flip)     !See if it includes "OOO" report
 | 
					
						
							|  |  |  |      msg1=msg                               !Message without "OOO"
 | 
					
						
							| 
									
										
										
										
											2018-07-10 15:09:42 -04:00
										 |  |  |      call packmsg(msg1,dgen,itype)          !Pack message into 12 six-bit bytes
 | 
					
						
							| 
									
										
										
										
											2016-11-21 21:23:48 +00:00
										 |  |  |      msgtype=""
 | 
					
						
							|  |  |  |      if(itype.eq.1) msgtype="Std Msg"
 | 
					
						
							|  |  |  |      if(itype.eq.2) msgtype="Type 1 pfx"
 | 
					
						
							|  |  |  |      if(itype.eq.3) msgtype="Type 1 sfx"
 | 
					
						
							|  |  |  |      if(itype.eq.4) msgtype="Type 2 pfx"
 | 
					
						
							|  |  |  |      if(itype.eq.5) msgtype="Type 2 sfx"
 | 
					
						
							|  |  |  |      if(itype.eq.6) msgtype="Free text"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |      call qra64_enc(dgen,sent)              !Encode using QRA64
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-11 10:13:42 -04:00
										 |  |  |      call unpackmsg(dgen,decoded)           !Unpack the user message
 | 
					
						
							| 
									
										
										
										
											2016-11-21 21:23:48 +00:00
										 |  |  |      call fmtmsg(decoded,iz)
 | 
					
						
							|  |  |  |      ii=imsg
 | 
					
						
							|  |  |  |      write(*,1020) ii,msg0,decoded,itype,msgtype
 | 
					
						
							|  |  |  | 1020 format(i4,1x,a22,2x,a22,4x,i3,": ",a13)
 | 
					
						
							|  |  |  |   enddo
 | 
					
						
							| 
									
										
										
										
											2016-06-22 20:45:29 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-21 21:23:48 +00:00
										 |  |  |   if(nmsg.eq.1) then
 | 
					
						
							|  |  |  |      write(*,1030) dgen
 | 
					
						
							| 
									
										
										
										
											2016-12-09 19:26:45 +00:00
										 |  |  | 1030 format(/'Packed message, 6-bit symbols ',12i3) !Display packed symbols
 | 
					
						
							| 
									
										
										
										
											2016-06-23 13:58:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-21 21:23:48 +00:00
										 |  |  |      write(*,1040) sent
 | 
					
						
							| 
									
										
										
										
											2016-12-09 19:26:45 +00:00
										 |  |  | 1040 format(/'Information-carrying channel symbols'/(i5,29i3))
 | 
					
						
							| 
									
										
										
										
											2016-06-22 20:45:29 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-21 21:23:48 +00:00
										 |  |  |      write(*,1050) 10*icos7,sent(1:32),10*icos7,sent(33:63),10*icos7
 | 
					
						
							| 
									
										
										
										
											2016-12-09 19:26:45 +00:00
										 |  |  | 1050 format(/'Channel symbols including sync'/(i5,29i3))
 | 
					
						
							| 
									
										
										
										
											2016-06-22 20:45:29 +00:00
										 |  |  |   endif
 | 
					
						
							| 
									
										
										
										
											2016-11-21 21:23:48 +00:00
										 |  |  |   
 | 
					
						
							| 
									
										
										
										
											2016-07-02 12:15:41 +00:00
										 |  |  | 999 end program QRA64code
 |