Yakındaki cihazları keşfetme
Özellik desteği için app.capabilities, yetkilendirme için app.access ve ana makine izinlerini kontrol edin. Çağrıdan önce örnek değerleri değiştirin.
Sayfa her 2 saniyede tek GraphQL sorgusuyla isDiscovering ve nearbyDevices okur, listeyi günceller ve yalnızca tarama durmuşsa startDiscovery çağırır. Kapanırken diğer sayfalara bakmadan stopDiscovery çağırır. Tarama son başlangıçtan beş dakika sonra durur. BLE bağımsız çalışır.
UDP → 224.0.0.251:5353PTR query
IP yayını değil IPv4 çok noktaya yayını: 224.0.0.251:5353. A her 5 sn tarar; B başlangıçta ve her 60 sn duyuru yapar. PTR yanıtları SRV, TXT ve A içerir. Çözülmüş sentetik DNS kayıtları açılır pencerelerde gösterilir.
Tip Tanımları
type Mutation {
acquireMdnsDebugSession(token: String!): Boolean!
releaseMdnsDebugSession(token: String!): Boolean!
startDiscovery: Boolean!
stopDiscovery: Boolean!
}
type Query {
isDiscovering: Boolean!
mdnsState: MdnsState!
nearbyDevices: [NearbyDevice!]!
parsePairingQrCode(code: String!): NearbyDevice
}
enum DeviceType {
COMPUTER
PHONE
TABLET
TV
NAS
OTHER
}
enum DiscoveryMethod {
LAN
BLE
QR
}
scalar Instant
scalar Long
type MdnsActivity {
time: Instant!
event: String!
detail: String!
}
type MdnsPacket {
time: Instant!
direction: MdnsPacketDirection!
srcIp: String!
srcPort: Int!
dstIp: String!
dstPort: Int!
size: Long!
summary: String!
detail: String!
}
enum MdnsPacketDirection {
IN
OUT
}
type MdnsService {
serviceType: String!
instanceName: String!
instanceFqdn: String!
hostname: String!
port: Int!
txtRecords: [String!]!
ips: [String!]!
ip6s: [String!]!
complete: Boolean!
}
type MdnsState {
runtimeId: String!
packetsIn: [MdnsPacket!]!
packetsOut: [MdnsPacket!]!
revision: Long!
running: Boolean!
scanning: Boolean!
services: [MdnsService!]!
activity: [MdnsActivity!]!
}
type NearbyDevice {
id: ID!
name: String!
ips: [String!]!
port: Int!
remoteAccess: Boolean
signaturePublicKey: String!
deviceType: DeviceType!
version: String!
platform: String!
discoveryMethods: [DiscoveryMethod!]!
bestIp: String!
status: PeerStatus!
lastSeen: Instant!
}
enum PeerStatus {
PAIRED
UNPAIRED
CHANNEL
}İşlemler
acquireMdnsDebugSession
Çağırana ait UUID belirteciyle mDNS hata ayıklama oturumu edinin. HTTP_SERVER gerekir; sayfa kapanırken oturumu serbest bırakın.
mutation acquireMdnsDebugSession($token: String!) {
acquireMdnsDebugSession(token: $token)
}releaseMdnsDebugSession
Eşleşen belirteçle mDNS hata ayıklama oturumunu serbest bırakın. HTTP_SERVER gerekir.
mutation releaseMdnsDebugSession($token: String!) {
releaseMdnsDebugSession(token: $token)
}startDiscovery
Cihaz keşfini başlatır.
mutation startDiscovery {
startDiscovery
}stopDiscovery
Cihaz keşfini durdurur.
mutation stopDiscovery {
stopDiscovery
}isDiscovering
Keşif taramasının şu an çalışıp çalışmadığını belirtir.
query isDiscovering {
isDiscovering
}mdnsState
Mevcut mDNS keşif durumunu ve seçili hizmet veya paket ayrıntılarını okur.
query mdnsState {
mdnsState { runtimeId revision running scanning }
}nearbyDevices
Keşif veya eşleştirme için mevcut, şu an bilinen yakındaki cihazları listeler.
query nearbyDevices {
nearbyDevices { id name ips port remoteAccess signaturePublicKey deviceType version }
}parsePairingQrCode
Geçerli eşleştirme kodunu yakındaki cihaz bağlantı bilgilerine çözer.
query parsePairingQrCode($code: String!) {
parsePairingQrCode(code: $code) { id name ips port remoteAccess signaturePublicKey deviceType version }
}