241 lines
		
	
	
		
			6.4 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			241 lines
		
	
	
		
			6.4 KiB
		
	
	
	
		
			C#
		
	
	
	
| 
								 | 
							
								namespace LY.App.Device.Command
							 | 
						|||
| 
								 | 
							
								{
							 | 
						|||
| 
								 | 
							
								    public static class GraphCommand
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 获取打击状态
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <returns></returns>
							 | 
						|||
| 
								 | 
							
								        public static string AttackStatus()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            return @"{
							 | 
						|||
| 
								 | 
							
								             widebandJammer {
							 | 
						|||
| 
								 | 
							
								             band15
							 | 
						|||
| 
								 | 
							
								             band24
							 | 
						|||
| 
								 | 
							
								             band58
							 | 
						|||
| 
								 | 
							
								             }
							 | 
						|||
| 
								 | 
							
								            }";
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 获取无人机
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <returns></returns>
							 | 
						|||
| 
								 | 
							
								        public static string GetFindTarget()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            return @"{drone {
							 | 
						|||
| 
								 | 
							
								              attack_bands,
							 | 
						|||
| 
								 | 
							
								              attack_type,
							 | 
						|||
| 
								 | 
							
								              attacking,
							 | 
						|||
| 
								 | 
							
								              can_attack,
							 | 
						|||
| 
								 | 
							
								              can_takeover,
							 | 
						|||
| 
								 | 
							
								              created_time,
							 | 
						|||
| 
								 | 
							
								              deleted_time,
							 | 
						|||
| 
								 | 
							
								              description,
							 | 
						|||
| 
								 | 
							
								              direction,
							 | 
						|||
| 
								 | 
							
								              distance,
							 | 
						|||
| 
								 | 
							
								              has_duplicate,
							 | 
						|||
| 
								 | 
							
								              id,
							 | 
						|||
| 
								 | 
							
								              initial_location {
							 | 
						|||
| 
								 | 
							
								                lat
							 | 
						|||
| 
								 | 
							
								                lng
							 | 
						|||
| 
								 | 
							
								              },
							 | 
						|||
| 
								 | 
							
								              jamming_conflicts,
							 | 
						|||
| 
								 | 
							
								              lastseen,
							 | 
						|||
| 
								 | 
							
								              latitude,
							 | 
						|||
| 
								 | 
							
								              link_id,
							 | 
						|||
| 
								 | 
							
								              localization {
							 | 
						|||
| 
								 | 
							
								                lat
							 | 
						|||
| 
								 | 
							
								                lng
							 | 
						|||
| 
								 | 
							
								              },
							 | 
						|||
| 
								 | 
							
								              longitude,
							 | 
						|||
| 
								 | 
							
								              name,
							 | 
						|||
| 
								 | 
							
								              height,
							 | 
						|||
| 
								 | 
							
								              distance,
							 | 
						|||
| 
								 | 
							
								              seen_sensor {
							 | 
						|||
| 
								 | 
							
								                detected_freq_khz
							 | 
						|||
| 
								 | 
							
								                noise_dbm
							 | 
						|||
| 
								 | 
							
								                sensor_id
							 | 
						|||
| 
								 | 
							
								                signal_dbm
							 | 
						|||
| 
								 | 
							
								                snr_dB
							 | 
						|||
| 
								 | 
							
								              },
							 | 
						|||
| 
								 | 
							
								              state,
							 | 
						|||
| 
								 | 
							
								              whitelisted
							 | 
						|||
| 
								 | 
							
								            }}";
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 获取设备状态信息
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        public static string GetDeveceStatusInfo()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            return @"{
							 | 
						|||
| 
								 | 
							
								                      devices{
							 | 
						|||
| 
								 | 
							
								                        id
							 | 
						|||
| 
								 | 
							
								                        config
							 | 
						|||
| 
								 | 
							
								                        gps_fixed
							 | 
						|||
| 
								 | 
							
								                        class
							 | 
						|||
| 
								 | 
							
								                      }
							 | 
						|||
| 
								 | 
							
								                    }";
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        public static string GetAdsb()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return @"{
							 | 
						|||
| 
								 | 
							
								  droneAdsB {
							 | 
						|||
| 
								 | 
							
								    support
							 | 
						|||
| 
								 | 
							
								    drone {
							 | 
						|||
| 
								 | 
							
								      id
							 | 
						|||
| 
								 | 
							
								      speed
							 | 
						|||
| 
								 | 
							
								      height
							 | 
						|||
| 
								 | 
							
								      latitude
							 | 
						|||
| 
								 | 
							
								      longitude
							 | 
						|||
| 
								 | 
							
								      yaw_angle
							 | 
						|||
| 
								 | 
							
								      confirmed
							 | 
						|||
| 
								 | 
							
								      registration
							 | 
						|||
| 
								 | 
							
								      typecode
							 | 
						|||
| 
								 | 
							
								      manufacturer
							 | 
						|||
| 
								 | 
							
								      model
							 | 
						|||
| 
								 | 
							
								      owner
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								  }
							 | 
						|||
| 
								 | 
							
								}";
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 获取传感器状态
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <returns></returns>
							 | 
						|||
| 
								 | 
							
								        public static string GetSensorStatus()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            return @"{sensor {
							 | 
						|||
| 
								 | 
							
								              config,
							 | 
						|||
| 
								 | 
							
								              faults,
							 | 
						|||
| 
								 | 
							
								              id,
							 | 
						|||
| 
								 | 
							
								              mac,
							 | 
						|||
| 
								 | 
							
								              name,
							 | 
						|||
| 
								 | 
							
								              sensor_status {
							 | 
						|||
| 
								 | 
							
								                built_time
							 | 
						|||
| 
								 | 
							
								                component_type
							 | 
						|||
| 
								 | 
							
								                first_seen
							 | 
						|||
| 
								 | 
							
								                git_hash
							 | 
						|||
| 
								 | 
							
								                ip_address
							 | 
						|||
| 
								 | 
							
								                last_seen
							 | 
						|||
| 
								 | 
							
								                temperature
							 | 
						|||
| 
								 | 
							
								                version
							 | 
						|||
| 
								 | 
							
								              },
							 | 
						|||
| 
								 | 
							
								              state,
							 | 
						|||
| 
								 | 
							
								              ttl
							 | 
						|||
| 
								 | 
							
								            }}";
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 白名单
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <returns></returns>
							 | 
						|||
| 
								 | 
							
								        public static string GetWhitelist()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            return @"{whitelist{dronetype,id}}";
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 系统能力查询
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <returns></returns>
							 | 
						|||
| 
								 | 
							
								        public static string GetSystemCapability()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            return @"{sysCapability}";
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 获取宽带打击的频段
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <returns></returns>
							 | 
						|||
| 
								 | 
							
								        public static string widebanJammer()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            return @"{widebandJammer{
							 | 
						|||
| 
								 | 
							
								                                            band12
							 | 
						|||
| 
								 | 
							
								                                            band14
							 | 
						|||
| 
								 | 
							
								                                            band15
							 | 
						|||
| 
								 | 
							
								                                            band18
							 | 
						|||
| 
								 | 
							
								                                            band24
							 | 
						|||
| 
								 | 
							
								                                            band4
							 | 
						|||
| 
								 | 
							
								                                            band58
							 | 
						|||
| 
								 | 
							
								                                            band9}}";
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 添加白名单
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="droneId"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="droneType"></param>
							 | 
						|||
| 
								 | 
							
								        /// <returns></returns>
							 | 
						|||
| 
								 | 
							
								        public static string AddWhitelist(string droneId, string droneType)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            return "mutation{addWhitelist(id:\"" + droneId + "\"\ndronetype:\"" + droneType + "\"\ntimerange:\"permanent,permanent\")}";
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 删除白名单
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="droneId"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="droneType"></param>
							 | 
						|||
| 
								 | 
							
								        /// <returns></returns>
							 | 
						|||
| 
								 | 
							
								        public static string DeleteWhitelist(string droneId)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            return "mutation{deleteWhitelist(id:\"" + droneId + "\")}";
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 精确打击,flse开始,true停止
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="isAttack"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="droneId"></param>
							 | 
						|||
| 
								 | 
							
								        /// <returns></returns>
							 | 
						|||
| 
								 | 
							
								        public static string AccurateAttack(bool isAttack, string droneId)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            string cmdstr = "mutation{ attack( cancel:true \n takeover:false \n id: \"" + droneId + "\"\n )}";
							 | 
						|||
| 
								 | 
							
								            if (isAttack)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                cmdstr = "mutation{ attack( cancel:false \n takeover:false \n id: \"" + droneId + "\"\n )}";
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                cmdstr = "mutation{ attack( cancel:true \n takeover:false \n id: \"" + droneId + "\"\n )}";
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            return cmdstr;
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 自动打击
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="isAuto"></param>
							 | 
						|||
| 
								 | 
							
								        /// <returns></returns>
							 | 
						|||
| 
								 | 
							
								        public static string AutoAttack(bool isAuto)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            string cmdstr = "mutation{ autoAttack(   on: " + isAuto + " \n  wbEnabled: false ) }";
							 | 
						|||
| 
								 | 
							
								            if (isAuto)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                cmdstr = "mutation{ autoAttack(   on:true \n   wbEnabled: false ) }";
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                cmdstr = "mutation{ autoAttack(   on:false \n   wbEnabled: false ) }";
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            return cmdstr.ToLower();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 宽带打击
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="band">15,24,58</param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="status">true,开启,false,关闭</param>
							 | 
						|||
| 
								 | 
							
								        /// <returns></returns>
							 | 
						|||
| 
								 | 
							
								        public static string WidebandAttack(string band, bool status)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            string cmdstr = "mutation{ wideband_attack( band: \"" + band + "\"\n wb_status:" + status + ")\n" +
							 | 
						|||
| 
								 | 
							
								        "{band15\nband24\nband58\nband9}}";
							 | 
						|||
| 
								 | 
							
								            return cmdstr.ToLower();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								}
							 |