CN112100103A - Communication method and system based on apple operating system - Google Patents
Communication method and system based on apple operating system Download PDFInfo
- Publication number
- CN112100103A CN112100103A CN202011301310.9A CN202011301310A CN112100103A CN 112100103 A CN112100103 A CN 112100103A CN 202011301310 A CN202011301310 A CN 202011301310A CN 112100103 A CN112100103 A CN 112100103A
- Authority
- CN
- China
- Prior art keywords
- apple
- preset
- module
- peripheral
- data
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/38—Information transfer, e.g. on bus
- G06F13/382—Information transfer, e.g. on bus using universal interface adapter
- G06F13/387—Information transfer, e.g. on bus using universal interface adapter for adaptation of different data processing systems to different peripheral devices, e.g. protocol converters for incompatible systems, open system
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Telephonic Communication Services (AREA)
Abstract
The invention discloses a communication method and a communication system based on an apple operating system, and belongs to the field of communication. The method comprises the following steps: the apple application generates data to be processed according to information input by a user, the data to be processed is used as data to be written in, and a system writing function is called according to the data to be written in and an access path of an apple peripheral. And the apple peripheral acquires the data to be processed from the write instruction, and executes preset processing operation on the data to be processed to obtain a processing result and store the processing result. And the apple application calls a system read function according to the address of the received data cache region and the access path of the apple peripheral. And when the apple peripheral receives the reading instruction, generating a reading file response according to the processing result and sending the reading file response to the apple operating system, and acquiring the processing result from the received data cache region by the apple application. The invention enables the apple peripheral which does not support the External access Framework protocol to communicate with the apple mobile equipment.
Description
Technical Field
The invention relates to the field of communication, in particular to a communication method and a communication system based on an apple operating system.
Background
In the prior art, an apple peripheral (a hardware device connected outside the apple mobile device) generally communicates with the apple mobile device through a bluetooth interface or a Lightning interface, and this communication method requires that the apple peripheral should communicate through an External access network (External access network) provided by apple inc. This results in some apple peripherals that do not support External access Framework being unable to communicate with apple mobile devices. Therefore, how to enable the apple peripheral which does not support External access Framework to communicate with the apple mobile device becomes a technical problem to be solved urgently.
Disclosure of Invention
In order to solve the defects of the prior art, a communication method and a communication system based on an apple operating system are provided.
In a first aspect, the present invention provides a communication method based on an apple operating system, which is applicable to a system including an apple mobile device and an apple peripheral, wherein the apple mobile device includes an apple operating system and an apple application, and the method includes the following steps:
step 101: the apple application generates data to be processed according to information input by a user and stores the data;
step 102: the apple application calls a system document selection view controller to obtain an equipment object of the apple peripheral, judges whether the equipment name in the obtained equipment object is the same as a first preset equipment name or not, if so, executes step 103, otherwise, ends;
step 103: the apple application takes the stored data to be processed as data to be written in, takes an access path of an apple peripheral in the equipment object as an incoming parameter of a system write function, and calls the system write function by taking the data to be written in as an object; when the apple peripheral receives a write instruction issued after the apple operating system is called by the apple application, the apple peripheral analyzes the write instruction according to a preset protocol format to obtain data to be written in, performs preset processing operation on the data to be written in to obtain a processing result, stores the processing result in a first preset storage area, generates a write file success response according to a preset protocol format and sends the write file success response to the apple operating system;
step 104: when the apple application receives write file success response data obtained by analyzing a write file success response sent by the apple peripheral by the apple operating system, the apple application takes an access path of the apple peripheral in the equipment object as an incoming parameter of a system read function, and calls the system read function by taking the address of a received data cache region as an object; when the apple peripheral receives a read instruction issued after the apple operating system is called by the apple application, the apple peripheral packages the processing result in the first preset storage area according to a preset protocol format to obtain a read file success response and sends the read file success response to the apple operating system, and the first preset storage area is emptied;
step 105: the apple application acquires a processing result from the received data cache region;
the method further comprises the following steps: when the apple peripheral is plugged into the apple mobile device, reporting to the apple operating system that the device type is a mass storage device.
In a second aspect, the invention provides a communication system based on an apple operating system, which comprises an apple mobile device and an apple peripheral, wherein the apple mobile device comprises an apple operating system and an apple application;
the apple application comprises: the system comprises a first generation module, a first calling module, a first judgment module, a first serving module, a second calling module, a first receiving module, a second serving module, a third calling module, a first acquisition module and a report module;
the first generation module is used for generating and storing data to be processed according to information input by a user;
the first calling module is used for calling the system document selection view controller to obtain an equipment object of the apple peripheral equipment;
the first judging module is used for judging whether the equipment name in the equipment object acquired by the first calling module is the same as a first preset equipment name or not, if so, the first acting module is triggered, and if not, the process is finished;
the first acting module is used for taking the data to be processed stored by the first generating module as data to be written in, and taking an access path of an apple peripheral in the equipment object as an incoming parameter of a system write function;
the second calling module is used for calling a system writing function by taking the data to be written as an object;
the first receiving module is used for receiving write file success response data obtained by analyzing a write file success response sent by the apple peripheral by the apple operating system;
the second acting module is used for taking an access path of an apple peripheral in the equipment object as an incoming parameter of a system read function;
the third calling module is used for calling a system reading function by taking the address of the received data cache region as an object;
the first obtaining module is configured to obtain a processing result from the received data cache region;
the reporting module is used for reporting the device type to the apple operating system as a mass storage device when the apple peripheral is inserted into the apple mobile device;
the apple peripheral device comprises: the system comprises a second receiving module, a first analyzing module, a first processing module, a first saving module, a second generating module, a third receiving module, a first packaging module and a first emptying module;
the second receiving module is used for receiving a write instruction issued after the apple operating system is called by the apple application;
the first analysis module is used for analyzing the write instruction according to a preset protocol format to obtain data to be written when the second receiving module receives the write instruction issued after the apple operating system is called by the apple application;
the first processing module is used for executing preset processing operation on the data to be written to obtain a processing result;
the first storage module is used for storing the processing result in a first preset storage area;
the second generation module is used for generating a successful response of the write file according to a preset protocol format and sending the successful response to the apple operating system;
the third receiving module is configured to receive a read instruction issued after the apple operating system is called by the apple application;
the first encapsulation module is configured to encapsulate, when the third receiving module receives a read instruction issued after the apple operating system is called by the apple application, a processing result in the first preset storage area according to a preset protocol format to obtain a read file success response, and send the read file success response to the apple operating system;
the first emptying module is used for emptying the first preset storage area.
Compared with the prior art, the invention at least has the following advantages:
the invention provides a communication method and a system based on an apple operating system, which adopt an apple file read-write Framework protocol and can enable an apple peripheral which does not support an apple peripheral protocol (also called External access Framework protocol) to be communicated with an apple mobile device.
Drawings
Fig. 1 is a flowchart of a communication method based on an apple operating system according to embodiment 1 of the present invention;
fig. 2 is a flowchart of a communication method based on the apple operating system according to embodiment 2 of the present invention;
fig. 3 is a flowchart of a communication method based on the apple operating system according to embodiment 3 of the present invention;
fig. 4 is a flowchart of a communication method based on the apple operating system according to embodiment 4 of the present invention;
fig. 5 is a block diagram of a communication system based on the apple operating system according to embodiment 5 of the present invention.
Detailed Description
The present application provides a communication method and system based on an apple operating system, and the following detailed description is provided with reference to the accompanying drawings. Examples of which are illustrated in the accompanying drawings. The embodiments described below with reference to the drawings are exemplary only for the purpose of explaining the present application and are not to be construed as limiting the present application.
It will be understood by those within the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the prior art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention are described in further detail below with reference to the accompanying drawings.
It should be noted that the apple operating system referred to in the present invention is an apple iOS operating system.
Example 1
An embodiment 1 of the present invention provides a communication method based on an apple operating system, which is applicable to a system including an apple mobile device and an apple peripheral, where the apple mobile device includes an apple operating system and an apple application, and as shown in fig. 1, the method includes the following steps:
step 101: the apple application generates and stores data to be processed according to the information input by the user;
step 102: the apple application calls a system document selection view controller to obtain an equipment object of the apple peripheral, judges whether the equipment name in the obtained equipment object is the same as the first preset equipment name or not, if so, executes the step 103, otherwise, ends;
step 103: the apple application takes the stored data to be processed as data to be written in, takes an access path of an apple peripheral in the equipment object as an incoming parameter of a system write function, and calls the system write function by taking the data to be written in as an object; when the apple peripheral receives a write instruction issued after the apple operating system is called by an apple application, the apple peripheral analyzes the write instruction according to a preset protocol format to obtain data to be written, executes preset processing operation on the data to be written to obtain a processing result, stores the processing result in a first preset storage area, generates a write file success response according to the preset protocol format and sends the write file success response to the apple operating system;
step 104: when the apple application receives write file success response data obtained by analyzing a write file success response sent by the apple peripheral by the apple operating system, the apple application takes an access path of the apple peripheral in the equipment object as an incoming parameter of a system read function, and calls the system read function by taking the address of the received data cache area as an object; when the apple peripheral receives a read instruction issued after the apple operating system is called by an apple application, the apple peripheral packages the processing result in the first preset storage area according to a preset protocol format to obtain a read file success response and sends the read file success response to the apple operating system, and the first preset storage area is emptied;
step 105: the apple application acquires a processing result from the received data cache region;
the method further comprises the following steps: when the apple peripheral is plugged into the apple mobile device, the device type is reported to the apple operating system as a mass storage device.
Optionally, in this embodiment, step 102 further includes: the apple application saves the access path of the apple peripheral in the device object as a bookmark.
Optionally, in this embodiment, before the step 102, the method further includes: the apple application judges whether the apple application stores an access path of an apple peripheral, if so, step 103 is executed, otherwise, step 102 is executed;
the specific steps of judging whether the access path of the apple peripheral is stored by the apple application are as follows: the method comprises the steps that the apple application obtains a bookmark stored by the apple mobile device, whether the bookmark is obtained or not is judged, if yes, the apple application is judged to store an access path of the apple peripheral, and otherwise, the apple application is judged not to store the access path of the apple peripheral.
Optionally, in this embodiment, step 102 specifically includes:
step M1: the apple application calls a system document selection view controller and sets the file type supported by the system document selection view controller;
step M2: the apple application sets a preset main view controller as an agent of a system document selection view controller;
step M3: the apple application sets the pop-up mode of the system document selection view controller as a mode;
step M4: when the main view controller of the apple application receives the device object of the apple peripheral and the access right to the apple peripheral returned by the system document selection view controller, judging whether the device name in the device object is the same as the first preset device name, if so, executing the step 103, otherwise, ending.
Optionally, in this embodiment, in step M1, the file types supported by the system document selection view controller are specifically set as follows: the apple application sets the file type supported by the system document selection view controller to text.
Optionally, in this embodiment, in step 103, taking the stored data to be processed as the data to be written in by the apple application, and taking the access path of the apple peripheral in the device object as an incoming parameter of the system write function specifically includes: the apple application takes the stored data to be processed as data to be written in, and takes an access path, a first preset parameter value, a second preset parameter value and a third preset parameter value of the apple peripheral in the equipment object as a first incoming parameter, a second incoming parameter, a third incoming parameter and a fourth incoming parameter of a system write function respectively.
Optionally, in this embodiment, in step 103, the write instruction includes a preset write instruction code, data to be written, and a check code; the specific steps of the apple peripheral analyzing the write command according to the preset protocol format to obtain the data to be written are as follows: and the apple peripheral analyzes the write instruction according to a preset protocol format to obtain a preset write instruction code, data to be written and a check code.
Optionally, in this embodiment, in step 104, the apple application uses an access path of an apple peripheral in the device object as an incoming parameter of the system read function, and calls the system read function by using the address of the received data cache area as the object, specifically: the apple peripheral takes the access path, the fourth preset parameter value and the fifth preset parameter value of the apple peripheral as a first incoming parameter, a second incoming parameter and a third incoming parameter of a system read function respectively, and calls the system read function by taking the address of the received data cache region as an object.
Optionally, in this embodiment, in step 104, the apple peripheral encapsulates the processing result in the first preset storage area according to a preset protocol format to obtain a read file success response, and sends the read file success response to the apple operating system, specifically: the apple peripheral acquires a preset file reading success response instruction code, generates a check code, sequentially splices the preset file reading success response instruction code, the processing result in the first preset storage area and the check code to obtain a file reading success response, and sends the file reading success response to the apple operating system.
Optionally, in this embodiment, before step 103, the method further includes: the apple application calls a system file coordinator to acquire the write permission of the apple peripheral;
in step 104, before calling the system read function with the address of the received data cache region as an object, the method further includes: and the apple application calls the system file coordinator to acquire the read permission of the apple peripheral.
Optionally, in this embodiment, the data to be written is specifically data to be signed; in step 103, performing a preset processing operation on the data to be written to obtain a processing result, and storing the processing result in a first preset storage area, where the preset processing operation is specifically: the apple peripheral signs the data to be signed by using the device private key to obtain a signature result, and stores the signature result in a first preset storage area.
Optionally, in this embodiment, the data to be written is specifically an instruction to acquire a random number; in step 103, performing a preset processing operation on the data to be written to obtain a processing result, and storing the processing result in a first preset storage area, where the preset processing operation is specifically: the apple peripheral generates a first random number, and stores the first random number in a first preset storage area.
Optionally, in this embodiment, the data to be written specifically includes a PIN verification instruction and a first PIN code; in step 103, performing a preset processing operation on the data to be written to obtain a processing result, and storing the processing result in a first preset storage area, where the preset processing operation is specifically: the apple peripheral acquires the stored second PIN code, judges whether the first PIN code is the same as the second PIN code or not, generates a PIN checking success result and stores the PIN checking success result in the first preset storage area if the first PIN code is the same as the second PIN code, and generates a PIN checking failure result and stores the PIN checking failure result in the first preset storage area if the second PIN code is not the same as the first PIN code.
Optionally, in this embodiment, before step 103, the method further includes:
step C1: the apple application takes the negotiation session key request as data to be written in, takes an access path of an apple peripheral in the equipment object as an incoming parameter of a system write function, and calls the system write function by taking the data to be written in as an object; when the apple peripheral receives a write instruction issued after the apple operating system is called by an apple application, the apple peripheral analyzes the write instruction sent by the apple operating system according to a preset protocol format to obtain a session key negotiation request, generates a session key and stores the session key in a first preset storage area, generates a write file success response according to the preset protocol format and sends the write file success response to the apple operating system;
step C2: when the apple application receives write file success response data obtained by analyzing a write file success response sent by the apple peripheral by the apple operating system, the apple application takes an access path of the apple peripheral in the equipment object as an incoming parameter of a system read function, and calls the system read function by taking the address of a received data cache region as an object; when the apple peripheral receives a read instruction issued after the apple operating system is called by an apple application, the apple peripheral packages the session key in the first preset storage area according to a preset protocol format to obtain a read file success response and sends the read file success response to the apple operating system, and the first preset storage area is emptied;
step C3: the apple application acquires and stores the session key from the received data cache region;
the specific steps of the apple application, taking the stored data to be processed as the data to be written in, are as follows: the apple application encrypts the PIN checking instruction and the first PIN code by using the session key to obtain a first ciphertext, and the first ciphertext is used as data to be written;
the preset processing operation is executed on the data to be written to obtain a processing result which is specifically as follows: the apple peripheral decrypts the first ciphertext by using the stored session key to obtain a PIN checking instruction and a first PIN code, acquires a stored second PIN code, judges whether the first PIN code is the same as the second PIN code, generates a PIN checking success result and stores the PIN checking success result in a first preset storage area if the first PIN code is the same as the second PIN code, and generates a PIN checking failure result and stores the PIN checking failure result in the first preset storage area if the first PIN code is not the same as the second PIN code.
Optionally, in this embodiment, before step 103, the method further includes:
step B1: the apple application takes the obtained equipment identification instruction as data to be written in, takes an access path of an apple peripheral in the equipment object as an incoming parameter of a system write function, and calls the system write function by taking the data to be written in as an object; when the apple peripheral receives a write instruction issued after the apple operating system is called by an apple application, the apple peripheral analyzes the write instruction sent by the apple operating system according to a preset protocol format to obtain an equipment identification acquisition instruction, acquires a first equipment identification and stores the first equipment identification in a first preset storage area, generates a write file success response according to the preset protocol format and sends the write file success response to the apple operating system;
step B2: when the apple application receives write file success response data obtained by analyzing a write file success response sent by the apple peripheral by the apple operating system, the apple application takes an access path of the apple peripheral in the equipment object as an incoming parameter of a system read function, and calls the system read function by taking the address of the received data cache area as an object; when the apple peripheral receives a read instruction issued after the apple operating system is called by an apple application, the apple peripheral packages a first device identifier in a first preset storage area according to a preset protocol format to obtain a read file success response and sends the read file success response to the apple operating system, and the first preset storage area is emptied;
step B3: and the apple application acquires the first equipment identifier from the received data cache region, judges whether the first equipment identifier is the same as a preset second equipment identifier or not, if so, executes the step 103, and otherwise, ends.
The embodiment provides a communication method based on an apple operating system, which adopts an apple file read-write Framework protocol, so that an apple peripheral which does not support an External access Framework protocol can communicate with an apple mobile device.
Example 2
An embodiment 2 of the present invention provides a communication method based on an apple operating system, which is applicable to a system including an apple mobile device and an apple peripheral, where the apple mobile device includes an apple operating system and an apple application, and as shown in fig. 2, the method includes the following steps:
step 200: the apple application receives the information required by the signature input by the user, generates and stores the data to be signed according to the information required by the signature;
optionally, in this embodiment, the apple application runs on an apple mobile device, and the apple mobile device includes a USB interface;
specifically, in this embodiment, the apple mobile device specifically is: iPad Pro;
optionally, in this embodiment, step 200 specifically includes: when the apple application is clicked by a user, the apple application displays a user operation interface and waits for the user to input information required by signature on the user operation interface; and when the apple application receives the information required by the signature input by the user, generating the data to be signed according to the information required by the signature and storing the data.
For example: in this embodiment, the information required for the signature input by the user is specifically:
serial number 500000000001
Transfer account number 5222222222222221
Transferred account name Lifours
Transfer amount (lower case) 10000.00
Transfer-out account number 5222222222222222
Transferring out the account name Zhang III;
the generated data to be signed is as follows: 00013E303030303030303030303030303030333030534E303130303133E4BAA4E69893E5908DE7A7B03a5356303130303135E 5908 BE69CBAE58FB7E8BDACE8B4a6534E303230303133E8BDACE585A5E8B4A6E688B73a535630323030313936323238323330303230303435383935323137534E303330303139E 8E BDACE585A5E8B4A6E688B7E5a793E5908D3a5356303330303036E5B1A0E6B7B 34E303430303133E8B 4A6E98791E 29D3a53563034303030323132444E303530303133E8BDACE587BAE8B4A6E688B73a445630353030313936323238343530303236303030323730343633444E303630303139E8BDACE587BAE8B4A6E688B7E 963 a 59793E 593D 5908E 36 4456303630303039E 5E 699E 649E 35357335357338E 35353133536313369 a 3536313369 a 353631336313369 a 35369B 3a 3536313353631335369E 3a 353631335369E 3a 353631347B 3a 3536;
step 201: the apple application calls a system document selection view controller and sets the file type supported by the system document selection view controller;
optionally, in this embodiment, the system document selection view controller is a component provided by the apple operating system, and when being called, the system document selection view controller controls the apple operating system to pop up a document view frame;
preferably, in this embodiment, the apple application sets the file type supported by the system document selection view controller as a text;
optionally, in this embodiment, before step 201, the method further includes:
step A1: the apple application judges whether the apple application stores an access path of an apple peripheral, if so, the step A2 is executed, otherwise, the step 201 is executed;
step A2: and the apple application takes the stored access path of the apple peripheral as an incoming parameter of a third preset function, calls the third preset function to acquire the access authority of the apple peripheral corresponding to the access path of the apple peripheral, and judges whether the access authority is acquired, if so, the step 205 is executed, otherwise, the operation is finished.
Optionally, in this embodiment, step a1 specifically includes: and judging whether the bookmark is stored or not by the apple application, if so, judging that the access path of the apple peripheral is stored by the apple application, and otherwise, judging that the access path of the apple peripheral is not stored by the apple application.
For example: the system document selection view controller specifically comprises: UIDocumentPickerViewController;
the third preset function is: self. url public = urls. firstobject;
step 202: the apple application sets a preset main view controller as an agent of a system document selection view controller;
optionally, in this embodiment, a main view controller is preset in the apple application;
optionally, in this embodiment, step 202 specifically includes: the apple application calls a first preset function to set a preset main view controller as an agent of a system document selection view controller;
for example: the preset front view controller specifically comprises: documentPickerVC;
the first preset function is specifically: delegate = self;
step 203: the apple application sets the pop-up mode of the system document selection view controller as a mode;
optionally, in this embodiment, step 203 specifically includes: the apple application calls a second preset function to set the pop-up mode of the system document selection view controller as a mode;
optionally, in this embodiment, the method further includes: when the apple peripheral is inserted into the apple mobile device, reporting the device type to an apple operating system; the device type is a mass storage device.
Specifically, in this embodiment, the apple operating system specifically includes: an apple iOS system;
specifically, in this embodiment, step 203 is followed by: popping up a document view frame for displaying the name of the apple peripheral by the apple operating system, waiting for a user to select the apple peripheral in the document view frame, and calling back a device object of the apple peripheral selected by the user and an access right to the apple peripheral to a main view controller of the apple application by a system document selection view controller when receiving the apple peripheral selected by the user;
for example: the second preset function is specifically: modelpresentationstyle;
step 204: when the main view controller of the apple application receives the device object of the apple peripheral and the access right to the apple peripheral returned by the system document selection view controller, judging whether the device name in the device object is the same as the first preset device name, if so, executing the step 205, otherwise, ending;
specifically, in this embodiment, the step of determining whether the device name in the device object is the same as the first preset device name specifically includes: the apple application acquires an equipment name from the received equipment object and judges whether the acquired equipment name is the same as a first preset name or not;
for example, in this embodiment, the device objects received by the apple application are specifically: @ file:///private/var/mobile/Library/live files/com. app. files. userfsd/IR301/test. txt, and the device name is specifically obtained from the received device object as IR 301;
step 205: the method comprises the steps that an apple application calls a system file coordinator to obtain writing authority of an apple peripheral, an equipment identification obtaining instruction is used as first data to be written, an access path, a first preset parameter value, a second preset parameter value and a third preset parameter value of the apple peripheral in an equipment object of the apple peripheral are respectively used as a first incoming parameter, a second incoming parameter, a third incoming parameter and a fourth incoming parameter of a system writing function, and the first data to be written is used as an object to call the system writing function;
optionally, in this embodiment, taking the access path, the first preset parameter value, the second preset parameter value, and the third preset parameter value of the apple peripheral in the device object of the apple peripheral as the first incoming parameter, the second incoming parameter, the third incoming parameter, and the fourth incoming parameter of the system write function respectively specifically: the method comprises the steps that an apple application obtains an access path of an apple peripheral from an equipment object of the apple peripheral, obtains a first preset parameter value, a second preset parameter value and a third preset parameter value which are stored, and respectively uses the obtained access path, the first preset parameter value, the second preset parameter value and the third preset parameter value of the apple peripheral as a first transfer-in parameter, a second transfer-in parameter, a third transfer-in parameter and a fourth transfer-in parameter of a system write function;
optionally, in this embodiment, the system file coordinator is: filecoordorantecto writingitemtatturl;
the obtaining of the device identification instruction specifically includes: 2a 0400000002000080000 a 2800000B 364000000100000000000000;
the access path of the apple peripheral acquired by the apple application from the equipment object of the apple peripheral is specifically as follows: com. apple. files. userfsd;
the first preset parameter value is specifically as follows: YES;
the second preset parameter value is specifically: NSUTF8 StringEncoding;
the third preset parameter value is specifically: nil;
the first input parameter of the system write function is specifically: a URL;
the second incoming parameter of the system write function is specifically: atomicaly;
the third incoming parameter of the system write function is specifically: encoding;
the fourth incoming parameter of the system write function is specifically: an error;
for example: the method comprises the steps that an apple application calls a fileCoordinateWritingItemAttURL to acquire the writing authority of the apple peripheral, 2A 0400000002000080000A 2800000B 364000000100000000000000 is used as first data to be written, and @ file:///private/var/mobile/Library/live files/com.applet.filesystems.user/IR 301/test.txt is used as the com.applet.filesystems.user, saved YES, NSUTF8StringEncoding and nil of a system writing function are respectively used as the URL parameter, atomic parameter, coding parameter and error parameter of the system writing function, and En 0400000002000080000A 2800000B 364000000100000000000000 is used as an object to call "2A 0400000002000080000A 2800000B 364000000100000000000000" writeToToComponeURL.Applefile.usenS 8:StringStringS8;
step 206: the method comprises the steps that the apple peripheral receives a first writing instruction sent by an apple operating system, analyzes the first writing instruction according to a preset protocol format to obtain an equipment identification obtaining instruction, obtains a first equipment identification and stores the first equipment identification in a first preset storage area, generates a successful writing file response according to the preset protocol format and sends the successful writing file response to the apple operating system;
optionally, in this embodiment, between step 205 and step 206, further includes: the apple operating system organizes first data to be written, which are transmitted by a system write function, according to a preset protocol to obtain a first write instruction, and transmits the first write instruction to the apple peripheral;
optionally, in this embodiment, the write instruction includes: writing an instruction code, data to be written and a check code;
optionally, in step 206, the write instruction is specifically a first write instruction; the method for organizing the first to-be-written data transmitted by the system write function according to the preset protocol by the apple operating system to obtain the first write instruction specifically comprises the following steps: the apple operating system generates a first check code, acquires a stored preset writing instruction code, and sequentially splices the preset writing instruction code, first data to be written and the first check code to obtain a first writing instruction;
optionally, in this embodiment, the step of analyzing the first write instruction according to the preset protocol format to obtain the device identifier instruction is specifically: the apple peripheral removes the preset writing instruction code and the first check code in the first writing instruction to obtain an equipment identification acquiring instruction.
Optionally, in this embodiment, the generating of the write file success response according to the preset protocol format and sending the write file success response to the apple operating system specifically includes: the apple peripheral acquires the stored write file success response codes and the stored write file success response data, sequentially splices the write file success response codes and the write file success response data to obtain write file success responses, and sends the write file success responses to the apple operating system.
Optionally, in this embodiment, the apple operating system and the apple peripheral communicate with each other according to a SCSI protocol;
further, in this embodiment, the preset write command code specifically includes: writing command codes in SCSI format;
for example: the first write command is: 55532A 0400000002000080000A 28; analyzing 55532A 0400000002000080000A 28 according to a preset protocol format to obtain an obtained equipment identification command of 2A 0400000002000080000A;
the successful response of writing the file is specifically as follows: 2E 2020202020; wherein 2E 20 is a write file success response code, and 20202020 is write file success response data;
step 207: the apple application receives successful response data of a write file sent by an apple operating system, calls a system file coordinator to open a read right of an apple peripheral, respectively uses an access path, a fourth preset parameter value and a fifth preset parameter value of the apple peripheral as a first incoming parameter, a second incoming parameter and a third incoming parameter of a system read function, and calls the system read function by taking an address of a first received data cache region as an object;
optionally, in this embodiment, between step 206 and step 207, further including: the apple operating system analyzes the successful response of the write file according to a preset protocol to obtain a successful response code of the write file and successful response data of the write file, and the successful response data of the write file is returned to the apple application;
optionally, in this embodiment, before calling the system read function by using the address of the first received data cache area as an object, the method further includes: the apple application creates a first received data cache region;
the first received data cache region is used as a storage region created by the apple application for calling a system reading function and used for storing a first device identifier read by the system reading function;
for example: the system file coordinator is as follows: filecoordorantecto writingitemtatturl;
the access path of the apple peripheral is specifically as follows: com. apple. files. userfsd;
the fourth preset parameter value is specifically: nsdatareading medifsafe;
the fifth preset parameter value is specifically as follows: & error;
the first input parameter of the system read function is specifically: datawithcontentsofosurl;
the second incoming parameter of the system read function is specifically: options;
the third incoming parameter of the system read function is specifically: an error;
the apple application receives 20202020 sent by an apple operating system, calls a fileroundmanager coordinator WritingItemAtURL to open the read authority of the apple peripheral, and calls NSDataWithContentOfURL parameter, options parameter and error parameter of a system read function by taking the address of a first receiving data cache area as an object to call NSDataWithContentOfURL, com.
Step 208: the method comprises the steps that the apple peripheral receives a reading instruction sent by an apple operating system, obtains a stored first device identification, packages the stored first device identification according to a preset protocol format to obtain a first reading file success response, and sends the first reading file success response to the apple operating system;
optionally, in this embodiment, the step of packaging the stored first device identifier according to the preset protocol format to obtain the successful response of the first read file specifically includes: the apple peripheral acquires a preset file reading success response instruction code, generates a second check code, and sequentially splices the preset file reading success response instruction code, the first equipment identification and the second check code to obtain a first file reading success response;
optionally, in this embodiment, between step 207 and step 208, further includes: the apple operating system organizes the incoming parameters of the system read function according to a preset protocol format to obtain a read instruction, and sends the read instruction to the apple peripheral;
optionally, in this embodiment, the step of organizing, by the apple operating system according to the preset protocol, the incoming parameter of the system read function to obtain the read instruction specifically includes: the apple operating system acquires the stored read instruction codes and read instruction data, and sequentially splices the read instruction codes and the read instruction data to obtain a read instruction;
for example: the read instruction sent by the apple operating system and received by the apple peripheral is as follows: 55530542200049006E;
step 209: the apple application acquires a first device identifier from the first received data cache region, acquires a stored second device identifier, compares the first device identifier with the second device identifier, and if the comparison is consistent, executes step 210;
optionally, in this embodiment, between step 208 and step 209, further includes: the apple operating system analyzes a first read file success response sent by the apple peripheral according to a preset protocol format to obtain a preset read file success response instruction code, a first equipment identifier and a second check code;
for example: the first read file success response is: 2F 465433303120; wherein 2F 46 is the default read file success response command code, 54333031 is the first device id, and 20 is the second check code.
Step 210: the apple application acquires the stored data to be signed, takes the data to be signed as second data to be written, respectively takes an access path, a first preset parameter value, a second preset parameter value and a third preset parameter value of the external apple as a first incoming parameter, a second incoming parameter, a third incoming parameter and a fourth incoming parameter of a system write function, and calls the system write function by taking the second data to be written as an object;
for example: the second data to be written is: 00013E303030303030303030303030303030333030534E303130303133E4BAA4E69893E5908DE7A7B03a5356303130303135E 5908 BE69CBAE58FB7E8BDACE8B4a6534E303230303133E8BDACE585A5E8B4A6E688B73a535630323030313936323238323330303230303435383935323137534E303330303139E 8E BDACE585A5E8B4A6E688B7E5a793E5908D3a5356303330303036E5B1A0E6B7B 34E303430303133E8B 4A6E98791E 29D3a53563034303030323132444E303530303133E8BDACE587BAE8B4A6E688B73a445630353030313936323238343530303236303030323730343633444E303630303139E8BDACE587BAE8B4A6E688B7E 963 a 59793E 593D 5908E 36 4456303630303039E 5E 699E 649E 35357335357338E 35353133536313369 a 3536313369 a 353631336313369 a 35369B 3a 3536313353631335369E 3a 353631335369E 3a 353631347B 3a 3536;
step 211: the apple peripheral receives a second write instruction sent by the apple operating system, analyzes the second write instruction according to a preset protocol format to obtain data to be signed, signs the data to be signed by using an equipment private key to obtain a signature result, stores the signature result in a first preset storage area, generates a write file success response according to the preset protocol format and sends the write file success response to the apple operating system;
optionally, in this embodiment, the analyzing the second write instruction according to the preset protocol format to obtain the data to be signed specifically includes: and the apple peripheral analyzes the second write instruction according to a preset protocol format to obtain a preset write instruction code, second data to be written and a third check code.
Optionally, in this embodiment, between step 210 and step 211, further includes: the apple operating system organizes second to-be-written data transmitted by the system write function according to a preset protocol to obtain a second write instruction, and the second write instruction is sent to the apple peripheral;
optionally, in this embodiment, the step of organizing, by the apple operating system according to the preset protocol, the second to-be-written data transmitted by the system write function to obtain the second write instruction specifically includes: the apple operating system generates a third check code, obtains a stored preset writing instruction code, and sequentially splices the preset writing instruction code, the second data to be written and the third check code to obtain a second writing instruction;
for example: the second write command is: 555300013E 303030303030303030303030303030333030534E303130303133E4BAA4E69893E5908DE7A7B03A5356303130303135E6898BE69CBAE58FB7E8BDACE8B4A6534E303230303133E8BDACE585A5E8B4A6E688B73A535630323030313936323238323330303230303435383935323137534E303330303139E8BDACE585A5E8B4A6E688B7E5A793E5908D3A5356303330303036E5B1A0E6B7B 34E303430303133E8 ACE8B4A6E98791E 29D3A53563034303030323132444E303530303133E8BDACE587BAE8B4A6E688B73A445630353030313936323238343530303236303030323730343633444E303630303139E8BDACE587BAE8B4A6E688B 688B7E5A 59793D 583A 4456303630303039E 58 98391E 5E 699E 353535353535733531335353535739A 03036313353631347E 3535353535369E 35369E 35353631347E 8B 6E 353535353535369E 3A 353133E 353631347E 3E8B 6E 3E 35313; wherein 5553 is a predetermined write command code, 00013E303030303030303030303030303030333030534E303130303133E4BAA4E69893E5908DE7A7B03a5356303130303135E6898BE69CBAE58FB7E8BDACE8B4a6534E303230303133E8BDACE585A5E8B4A6E688B73a535630323030313936323238323330303230303435383935323137534E303330303139E8BDACE585A5E8B4A6E688B7E5a793E5908D3a5356303330303036E5B1A0E6B7B3534E303430303133E8BDACE8B4A6E98791E9a29D3a53563034303030323132444E303530303133E8BDACE587BAE8B4A6E688B73a445630353030313936323238343530303236303030323730343633444E303630303139E 598E 5356303330303036B 8B4A6E B688B 7E 353139B 3531319B 369 a 3631341369 a 3669369B 369 a 3641369B 369 a 3631341369B 369 a 369B 36593E 366931341369B 369 a 363139B 369B 363139B 369 is a 323631341369B 3631341369B 369.
Step 212: the apple application receives write file success response data in the write file success response sent by the apple operating system, an access path, a fourth preset parameter value and a fifth preset parameter value of the apple peripheral are respectively used as a first incoming parameter, a second incoming parameter and a third incoming parameter of a system read function, and the address of a second received data cache area is used as an object to call the system read function;
optionally, in this embodiment, between step 211 and step 212, further includes: the apple operating system analyzes the successful response of the write file according to a preset protocol to obtain a successful response code of the write file and successful response data of the write file, and the successful response data of the write file is returned to the apple application;
optionally, in this embodiment, before calling the system read function by using the address of the second received data cache area as the object, the method further includes: the apple application creates a second received data cache region;
optionally, in this embodiment, the second received data cache area is used as a storage address created by the apple application for calling the system read function, and is used for storing the signature result read by the system read function;
step 213: the method comprises the steps that the apple peripheral receives a reading instruction sent by an apple operating system, obtains a signature result in a first preset storage area, packages the signature result in the first preset storage area according to a preset protocol format to obtain a second read file successful response, and sends the second read file successful response to the apple operating system;
optionally, in this embodiment, the step of packaging the signature result in the first preset storage area according to a preset protocol format to obtain a successful response of the second read file specifically includes: the apple peripheral acquires a preset file reading success response instruction code, generates a fourth check code, and sequentially splices the preset file reading success response instruction code, the signature result and the fourth check code to obtain a second file reading success response;
optionally, in this embodiment, between step 212 and step 213, further includes: the apple operating system organizes the incoming parameters of the system read function according to a preset protocol format to obtain a read instruction, and sends the read instruction to the apple peripheral;
for example: the read instruction is: 55530542200049006E; here, 5553 denotes a read command code, and 0542200049006E denotes read command data.
The signature result specifically comprises: BDACE585A5E8B4A6E688B73a535630323030313936323238323330303230303435383935323137534E303330303139E8BDACE585A5E8B4A6E688B7E5a793E5908D3a5356303330303036E5B1A0E6B7B3534E303430303133E8BDACE8B4A6E98791E9a29D3a53563034303030323132444E303530303133E8BDACE587BAE8B 4A;
the successful response of the second read file is specifically as follows: 2FBDACE585A5E8B4A6E688B73a535630323030313936323238323330303230303435383935323137534E303330303139E8BDACE585A5E8B4A6E688B7E5a793E5908D3a5356303330303036E5B1A0E6B7B3534E303430303133E8BDACE8B4A6E98791E9a29D3a53563034303030323132444E303530303133E8BDACE587BAE8B4A 37; the 2F BD is a read command code, BDACE585A5E8B4A6E688B73A535630323030313936323238323330303230303435383935323137534E303330303139E8BDACE585A5E8B4A6E688B7E5A793E5908D3A5356303330303036E5B1A0E6B7B3534E303430303133E8BDACE8B4A6E98791E9A29D3A53563034303030323132444E303530303133E8BDACE587BAE8B4A is a signature result, and 37 is a fourth parity code.
Step 214: the apple application acquires a signature result from the second received data cache region;
step 215: and the apple application calls a fourth preset function to finish the access to the apple peripheral.
For example: the fourth preset function is: newURL stock Access SecurityScopedResource;
the embodiment provides a communication method based on an apple operating system, which adopts an apple file read-write Framework protocol, so that an apple peripheral which does not support an External access Framework protocol can communicate with an apple mobile device.
Example 3
An embodiment 3 of the present invention provides a communication method based on an apple operating system, which is applicable to a system including an apple mobile device and an apple peripheral, where the apple mobile device includes an apple operating system and an apple application, and as shown in fig. 3, the method includes the following steps:
step 300: the apple application receives request information for acquiring the random number input by a user, generates a command for acquiring the random number according to the request information for acquiring the random number and stores the command;
step 301: the apple application calls a system document selection view controller and sets the file type supported by the system document selection view controller;
preferably, in this embodiment, the apple application sets the file type supported by the system document selection view controller as a text;
step 302: the apple application sets a preset main view controller as an agent of a system document selection view controller;
step 303: the apple application sets the pop-up mode of the system document selection view controller as a mode;
optionally, in this embodiment, the method further includes: when the apple peripheral is inserted into the apple mobile device, reporting the device type to an apple operating system; the device type is a mass storage device.
Specifically, in this embodiment, after step 303, the method further includes: popping up a document view frame for displaying the name of the apple peripheral by the apple operating system, waiting for a user to select the apple peripheral in the document view frame, and calling back a device object of the apple peripheral selected by the user and an access right to the apple peripheral to a main view controller of the apple application by a system document selection view controller when receiving the apple peripheral selected by the user;
step 304: when the main view controller of the apple application receives the device object of the apple peripheral and the access right to the apple peripheral returned by the system document selection view controller, judging whether the device name in the device object is the same as the first preset device name or not, if so, executing the step 305, otherwise, ending;
step 305: the method comprises the steps that an apple application calls a system file coordinator to obtain writing authority of an apple peripheral, an equipment identification obtaining instruction is used as first data to be written, an access path, a first preset parameter value, a second preset parameter value and a third preset parameter value of the apple peripheral in an equipment object of the apple peripheral are respectively used as a first incoming parameter, a second incoming parameter, a third incoming parameter and a fourth incoming parameter of a system writing function, and the first data to be written is used as an object to call the system writing function;
step 306: the method comprises the steps that the apple peripheral receives a first writing instruction sent by an apple operating system, analyzes the first writing instruction according to a preset protocol format to obtain an equipment identification obtaining instruction, obtains a first equipment identification and stores the first equipment identification in a first preset storage area, generates a successful writing file response according to the preset protocol format and sends the successful writing file response to the apple operating system;
optionally, in this embodiment, between step 305 and step 306, further includes: the apple operating system organizes first data to be written, which are transmitted by a system write function, according to a preset protocol to obtain a first write instruction, and transmits the first write instruction to the apple peripheral;
step 307: the apple application receives successful response data of a write file sent by an apple operating system, calls a system file coordinator to open a read right of an apple peripheral, respectively uses an access path, a fourth preset parameter value and a fifth preset parameter value of the apple peripheral as a first incoming parameter, a second incoming parameter and a third incoming parameter of a system read function, and calls the system read function by taking an address of a first received data cache region as an object;
optionally, in this embodiment, between step 306 and step 307, further including: the apple operating system analyzes the successful response of the write file according to a preset protocol to obtain a successful response code of the write file and successful response data of the write file, and the successful response data of the write file is returned to the apple application;
step 308: the method comprises the steps that the apple peripheral receives a reading instruction sent by an apple operating system, obtains a stored first device identification, packages the stored first device identification according to a preset protocol format to obtain a first reading file success response, and sends the first reading file success response to the apple operating system;
optionally, in this embodiment, between step 307 and step 308, further including: the apple operating system organizes the incoming parameters of the system read function according to a preset protocol format to obtain a read instruction, and sends the read instruction to the apple peripheral;
step 309: the apple application acquires a first device identifier from the first received data cache region, acquires a stored second device identifier, compares the first device identifier with the second device identifier, and if the comparison is consistent, executes step 310;
step 310: the apple application acquires a stored random number acquisition instruction, the random number acquisition instruction is used as third data to be written, an access path, a first preset parameter, a second preset parameter and a third preset parameter of the apple peripheral are respectively used as a first incoming parameter, a second incoming parameter, a third incoming parameter and a fourth incoming parameter of a system write function, and the third data to be written is used as an object to call the system write function;
step 311: the apple peripheral receives a third write instruction sent by the apple operating system, analyzes the third write instruction according to a preset protocol format to obtain a random number obtaining instruction, generates a first random number, stores the first random number in a first preset storage area, generates a write file success response according to the preset protocol format and sends the write file success response to the apple operating system;
optionally, in this embodiment, between step 310 and step 311, further including: the apple operating system organizes third data to be written, which are transmitted by the system write function, according to a preset protocol to obtain a third write instruction, and the third write instruction is transmitted to the apple peripheral;
step 312: the apple application receives write file success response data in the write file success response sent by the apple operating system, an access path, a fourth preset parameter and a fifth preset parameter of the apple peripheral are respectively used as a first incoming parameter, a second incoming parameter and a third incoming parameter of a system read function, and the address of a third cache area is used as an object to call the system read function;
optionally, in this embodiment, between step 311 and step 312, further including: the apple operating system analyzes the successful response of the write file according to a preset protocol to obtain a successful response code of the write file and successful response data of the write file, and the successful response data of the write file is returned to the apple application;
optionally, in this embodiment, before calling the system read function by using the address of the third received data cache area as the object, the method further includes: the apple application creates a third received data cache region;
optionally, in this embodiment, the third received data cache area is used for storing a first random number read by the system read function, where the storage address is created by the apple application for calling the system read function;
step 313: the method comprises the steps that the apple peripheral receives a reading instruction sent by an apple operating system, obtains a first random number in a first preset storage area, packages the first random number in the first preset storage area according to a preset protocol format to obtain a third read file successful response, and sends the third read file successful response to the apple operating system;
optionally, in this embodiment, between step 312 and step 313, further including: the apple operating system organizes the incoming parameters of the system read function according to a preset protocol format to obtain a read instruction, and sends the read instruction to the apple peripheral;
step 314: the apple application acquires a first random number from the third received data cache region;
step 315: and the apple application calls a fourth preset function to finish the access to the apple peripheral.
For example: the fourth preset function is: newURL stock Access SecurityScopedResource;
the embodiment provides a communication method based on an apple operating system, which adopts an apple file read-write Framework protocol, so that an apple peripheral which does not support an External access Framework protocol can communicate with an apple mobile device.
Example 4
An embodiment 4 of the present invention provides a communication method based on an apple operating system, which is applicable to a system including an apple mobile device and an apple peripheral, where the apple mobile device includes an apple operating system and an apple application, and as shown in fig. 4, the method includes the following steps:
step 400: the apple application receives and stores a first PIN code input by a user;
step 401: the apple application calls a system document selection view controller and sets the file type supported by the system document selection view controller;
preferably, in this embodiment, the apple application sets the file type supported by the system document selection view controller as a text;
step 402: the apple application sets a preset main view controller as an agent of a system document selection view controller;
step 403: the apple application sets the pop-up mode of the system document selection view controller as a mode;
optionally, in this embodiment, the method further includes: when the apple peripheral is inserted into the apple mobile device, reporting the device type to an apple operating system; the device type is a mass storage device.
Specifically, in this embodiment, after step 403, the method further includes: popping up a document view frame for displaying the name of the apple peripheral by the apple operating system, waiting for a user to select the apple peripheral in the document view frame, and calling back a device object of the apple peripheral selected by the user and an access right to the apple peripheral to a main view controller of the apple application by a system document selection view controller when receiving the apple peripheral selected by the user;
step 404: when the main view controller of the apple application receives the equipment object of the apple peripheral and the access right to the apple peripheral returned by the system document selection view controller, judging whether the equipment name in the equipment object is the same as the first preset equipment name or not, if so, executing the step 405, otherwise, ending;
step 405: the method comprises the steps that an apple application calls a system file coordinator to open write permission of an apple peripheral, a saved request for obtaining a negotiation session key is obtained, the negotiation session key request is used as fourth data to be written, an access path, a first preset parameter, a second preset parameter and a third preset parameter of the apple peripheral are respectively used as a first incoming parameter, a second incoming parameter, a third incoming parameter and a fourth incoming parameter of a system write function, and the fourth data to be written are used as objects to call the system write function;
optionally, in this embodiment, before step 405, the method further includes:
step a 1: the method comprises the steps that an apple application calls a system file coordinator to obtain the writing authority of an apple peripheral, an equipment identification obtaining instruction is used as first data to be written, an access path, a first preset parameter value, a second preset parameter value and a third preset parameter value of the apple peripheral are respectively used as a first incoming parameter, a second incoming parameter, a third incoming parameter and a fourth incoming parameter of a system writing function, and the first data to be written is used as an object to call the system writing function;
step a 2: the method comprises the steps that the apple peripheral receives a first writing instruction sent by an apple operating system, analyzes the first writing instruction according to a preset protocol format to obtain an equipment identification obtaining instruction, obtains a first equipment identification and stores the first equipment identification in a first preset storage area, generates a successful writing file response according to the preset protocol format and sends the successful writing file response to the apple operating system;
optionally, in this embodiment, between step a1 and step a2, further includes: the apple operating system organizes first data to be written, which are transmitted by a system write function, according to a preset protocol to obtain a first write instruction, and transmits the first write instruction to the apple peripheral;
step a 3: the apple application receives successful response data of a write file sent by an apple operating system, calls a system file coordinator to open a read right of an apple peripheral, respectively uses an access path, a fourth preset parameter value and a fifth preset parameter value of the apple peripheral as a first incoming parameter, a second incoming parameter and a third incoming parameter of a system read function, and calls the system read function by taking an address of a first received data cache region as an object;
optionally, in this embodiment, between step a2 and step a3, further includes: the apple operating system analyzes the successful response of the write file according to a preset protocol to obtain a successful response code of the write file and successful response data of the write file, and the successful response data of the write file is returned to the apple application;
step a 4: the method comprises the steps that the apple peripheral receives a reading instruction sent by an apple operating system, obtains a stored first device identification, packages the stored first device identification according to a preset protocol format to obtain a first reading file success response, and sends the first reading file success response to the apple operating system;
optionally, in this embodiment, between step a3 and step a4, further includes: the apple operating system organizes the incoming parameters of the system read function according to a preset protocol format to obtain a read instruction, and sends the read instruction to the apple peripheral;
step a 5: the apple application acquires a first device identifier from the first received data cache region, acquires a stored second device identifier, compares the first device identifier with the second device identifier, and if the first device identifier and the second device identifier are consistent, executes step 405;
step 406: the apple peripheral receives a fourth write instruction sent by the system, analyzes the fourth write instruction according to a preset protocol format to obtain a session key negotiation request, generates a session key, stores the session key in a first preset storage area, generates a write file success response according to the preset protocol format and sends the write file success response to the apple operating system;
optionally, in this embodiment, between step 405 and step 406, further including: the apple operating system organizes fourth data to be written, which are transmitted by the system write function, according to a preset protocol to obtain a fourth write instruction, and the fourth write instruction is sent to the apple peripheral;
step 407: the apple application receives write file success response data in the write file success response sent by the apple operating system, an access path, a fourth preset parameter and a fifth preset parameter of the apple peripheral are respectively used as a first incoming parameter, a second incoming parameter and a third incoming parameter of a system read function, and the address of a fourth received data cache area is used as an object to call the system read function;
optionally, in this embodiment, between step 406 and step 407, further including: the apple operating system analyzes the successful response of the write file according to a preset protocol to obtain a successful response code of the write file and successful response data of the write file, and the successful response data of the write file is returned to the apple application;
optionally, in this embodiment, before calling the system read function by using the address of the fourth received data cache area as the object, the method further includes: the apple application creates a fourth received data cache region;
optionally, in this embodiment, the fourth received data cache area is used to store a session key read by the system read function, where the storage address is created by the apple application for calling the system read function;
step 408: the method comprises the steps that the apple peripheral receives a reading instruction sent by an apple operating system, obtains a session key in a first preset storage area, packages the session key in the first preset storage area according to a preset protocol format to obtain a fourth read file successful response, and sends the fourth read file successful response to the apple operating system;
optionally, in this embodiment, between step 407 and step 408, further including: the apple operating system organizes the incoming parameters of the system read function according to a preset protocol format to obtain a read instruction, and sends the read instruction to the apple peripheral;
step 409: the apple application acquires and stores the session key from the fourth received data cache region;
step 410: the apple application acquires a stored PIN checking instruction and a first PIN code, encrypts the PIN checking instruction and the first PIN code by using a stored session key to obtain a first ciphertext, uses the first ciphertext as fifth data to be written in, respectively uses an access path, a first preset parameter, a second preset parameter and a third preset parameter of the apple peripheral as a first incoming parameter, a second incoming parameter, a third incoming parameter and a fourth incoming parameter of a system write function, and calls the system write function by using the fifth data to be written as an object;
step 411: the apple peripheral receives a fifth write instruction sent by the apple operating system, analyzes the fifth write instruction according to a preset protocol format to obtain a first ciphertext, decrypts the first ciphertext by using a stored session key to obtain a PIN checking instruction and a first PIN code, checks the first PIN code to obtain a PIN checking result, stores the PIN checking result in a first preset storage area, generates a write file success response according to the preset protocol format and sends the write file success response to the apple operating system;
optionally, in this embodiment, verifying the first PIN code to obtain a PIN verification result and storing the PIN verification result specifically includes: the apple peripheral acquires the stored second PIN code, judges whether the first PIN code is the same as the second PIN code or not, generates a PIN checking success result and stores the PIN checking success result in a first preset storage area if the first PIN code is the same as the second PIN code, and generates a PIN checking failure result and stores the PIN checking failure result in the first preset storage area if the first PIN code is not the same as the second PIN code;
optionally, in this embodiment, between step 410 and step 411, further includes: the apple operating system organizes fifth to-be-written data transmitted by the system write function according to a preset protocol to obtain a fifth write instruction, and the fifth write instruction is sent to the apple peripheral;
step 412: the apple application receives write file success response data in the write file success response sent by the apple operating system, an access path, a fourth preset parameter and a fifth preset parameter of the apple peripheral are respectively used as a first incoming parameter, a second incoming parameter and a third incoming parameter of a system read function, and the address of a fifth received data cache area is used as an object to call the system read function;
optionally, in this embodiment, between step 411 and step 412, further including: the apple operating system analyzes the successful response of the write file according to a preset protocol to obtain a successful response code of the write file and successful response data of the write file, and the successful response data of the write file is returned to the apple application;
optionally, in this embodiment, before calling the system read function by using the address of the fifth receive data cache area as the object, the method further includes: the apple application creates a fifth received data cache region;
optionally, in this embodiment, the fifth received data cache area is used as a storage address created by the apple application for calling the system read function, and is used for storing the PIN verification result read by the system read function;
step 413: the method comprises the steps that the apple peripheral receives a reading instruction sent by an apple operating system, obtains a PIN checking result in a first preset storage area, packages the PIN checking result in the first preset storage area according to a preset protocol format to obtain a fifth read file successful response, and sends the fifth read file successful response to the apple operating system;
optionally, in this embodiment, between step 412 and step 413, further including: the apple operating system organizes the incoming parameters of the system read function according to a preset protocol format to obtain a read instruction, and sends the read instruction to the apple peripheral;
step 414: the apple application acquires a PIN checking result from the fifth received data cache region;
step 415: and the apple application calls a fourth preset function to finish the access to the apple peripheral.
For example: the fourth preset function is: newURL stock Access SecurityScopedResource;
the embodiment provides a communication method based on an apple operating system, which adopts an apple file read-write Framework protocol, so that an apple peripheral which does not support an External access Framework protocol can communicate with an apple mobile device.
Example 5
Embodiment 5 of the present invention provides a communication system based on an apple operating system, as shown in fig. 5, including an apple mobile device 50 and an apple peripheral 60, where the apple mobile device 50 includes an apple application 501 and an apple operating system 502;
the apple application 501 includes: the first generating module 5011, the first calling module 5012, the first judging module 5013, the first acting module 5014, the second calling module 5015, the first receiving module 5016, the second acting module 5017, the third calling module 5018, the first acquiring module 5019 and the reporting module 5020;
the first generation module 5011 is configured to generate and store data to be processed according to information input by a user;
the first calling module 5012 is configured to call a system document selection view controller to obtain a device object of the apple peripheral 60;
the first judging module 5013 is configured to judge whether the device name in the device object acquired by the first calling module 5012 is the same as a first preset device name, if so, trigger the first serving module 5014, and otherwise, end the process;
a first acting module 5014, configured to use the to-be-processed data stored in the first generating module 5011 as to-be-written data, and use an access path of the apple peripheral 60 in the device object as an incoming parameter of a system write function;
the second calling module 5015 is configured to call a system write function by using data to be written as an object;
the first receiving module 5016 is configured to receive write file success response data obtained by the apple operating system 502 analyzing a write file success response sent by the apple peripheral 60;
a second as module 5017, configured to use the access path of the apple peripheral 60 in the device object as an incoming parameter of the system read function;
the third calling module 5018 is configured to call a system read function with the address of the received data cache as an object;
a first obtaining module 5019, configured to obtain a processing result from the received data buffer;
a reporting module 5020 for reporting to the apple operating system 502 that the device type is a mass storage device when the apple peripheral 60 is plugged into the apple mobile device 50;
the apple peripheral 60 includes: a second receiving module 601, a first parsing module 602, a first processing module 603, a first saving module 604, a second generating module 605, a third receiving module 606, a first encapsulating module 607 and a first emptying module 608;
a second receiving module 601, configured to receive a write instruction issued after the apple operating system 502 is called by the apple application 501;
the first parsing module 602 is configured to, when the second receiving module 601 receives a write instruction issued after the apple operating system 502 is called by the apple application 501, parse the write instruction according to a preset protocol format to obtain data to be written in;
the first processing module 603 is configured to perform a preset processing operation on data to be written to obtain a processing result;
a first saving module 604, configured to save the processing result in a first preset storage area;
a second generating module 605, configured to generate a write file success response according to a preset protocol format and send the write file success response to the apple operating system 502;
a third receiving module 606, configured to receive a read instruction issued after the apple operating system 502 is called by the apple application 501;
the first encapsulating module 607 is configured to, when the third receiving module 606 receives a read instruction issued after the apple operating system 502 is called by the apple application 501, encapsulate the processing result in the first preset storage area according to the preset protocol format to obtain a read file success response, and send the read file success response to the apple operating system 502;
a first emptying module 608, configured to empty the first preset storage area.
Optionally, in this embodiment, the apple application 501 further includes: a second saving module;
and a second saving module, configured to save the access path of the apple peripheral 60 in the device object as a bookmark.
Optionally, in this embodiment, the apple application 501 further includes: a second judgment module;
a second judging module, configured to judge whether the apple application 501 stores an access path of the apple peripheral 60, if so, trigger the first serving module 5014, otherwise, trigger the first calling module 5012;
the second judging module specifically comprises: a first obtaining unit and a first judging unit;
a first obtaining unit, configured to obtain a bookmark stored in the apple application 501;
and the first judging unit is used for judging whether the first acquiring unit acquires the bookmark or not, if so, judging that the second storage module stores the access path of the apple peripheral 60, and otherwise, judging that the second storage module does not store the access path of the apple peripheral 60.
Optionally, in this embodiment, the first calling module 5012 specifically includes: a first setting unit, a second setting unit and a third setting unit;
the first setting unit is used for calling the system document selection view controller and setting the file types supported by the system document selection view controller;
the second setting unit is used for setting the preset main view controller as the agent of the system document selection view controller;
the third setting unit is used for setting the popup mode of the system document selection view controller as a modal;
the first determining module 5013 specifically includes: a first receiving unit and a second judging unit;
a first receiving unit, configured to receive, through the master view controller, the device object of the apple peripheral 60 and the access right to the apple peripheral 60, which are returned by the system document selection view controller;
and a second judging unit, configured to, when the first receiving unit receives, through the master view controller, the device object of the apple peripheral 60 and the access right to the apple peripheral 60, which are returned by the system document selection view controller, judge whether the device name in the device object is the same as the first preset device name, if so, trigger the first setting module 5014, and otherwise, end.
Optionally, in this embodiment, the first setting unit is specifically configured to set a file type supported by the system document selection view controller as a text.
Optionally, in this embodiment, the first determining module 5014 is specifically configured to use the stored to-be-processed data as to-be-written data, and use an access path, a first preset parameter value, a second preset parameter value, and a third preset parameter value of the apple peripheral 60 in the device object as a first incoming parameter, a second incoming parameter, a third incoming parameter, and a fourth incoming parameter of the system write function, respectively.
Optionally, in this embodiment, the write instruction includes a preset write instruction code, data to be written, and a check code;
the first parsing module 602 is specifically configured to parse the write instruction according to a preset protocol format to obtain a preset write instruction code, data to be written, and a check code.
Optionally, in this embodiment, the second acting module 5017 is specifically configured to use the access path, the fourth preset parameter value, and the fifth preset parameter value of the apple peripheral 60 as the first incoming parameter, the second incoming parameter, and the third incoming parameter of the system read function, respectively.
Optionally, in this embodiment, the first encapsulation module 607 is specifically configured to obtain a preset file reading success response instruction code, generate a check code, sequentially splice the preset file reading success response instruction code, the processing result in the first preset storage area, and the check code to obtain a file reading success response, and send the file reading success response to the apple operating system 502.
Optionally, in this embodiment, the apple application 501 further includes: a fourth calling module and a fifth calling module;
the fourth calling module is used for calling the system file coordinator to acquire the write permission of the apple peripheral 60;
and the fifth calling module is used for calling the system file coordinator to acquire the read permission of the apple peripheral 60.
Optionally, in this embodiment, the data to be written is specifically data to be signed;
the first processing module 603 is specifically configured to sign data to be signed by using an equipment private key to obtain a signature result;
the first saving module 604 is specifically configured to save the signature result in a first preset storage area.
Optionally, in this embodiment, the data to be written is specifically an instruction to acquire a random number;
a first processing module 603, specifically configured to generate a first random number;
the first saving module 604 is specifically configured to save the first random number in the first preset memory area.
Optionally, in this embodiment, the data to be written specifically includes a PIN verification instruction and a first PIN code;
the first processing module 603 is specifically configured to obtain the stored second PIN code, determine whether the first PIN code is the same as the second PIN code, if so, generate a PIN verification success result, and trigger the first storing module 604, and otherwise, generate a PIN verification failure result, and trigger the first storing module 604;
the first saving module 604 is specifically configured to save the PIN verification success result or the PIN verification failure result generated by the first processing module 603 in a first preset storage area.
Optionally, in this embodiment, the apple application 501 further includes: the first calling module, the first receiving calling module and the second obtaining module;
the first is a calling module, configured to use the negotiation session key request as data to be written in, use an access path of the apple peripheral 60 in the device object as an incoming parameter of a system write function, and call the system write function with the data to be written as an object;
the first receiving and calling module is configured to receive write file success response data obtained by analyzing a write file success response sent by the apple operating system 502 by the apple peripheral 60, and when the write file success response data is received, take an access path of the apple peripheral 60 in an equipment object as an incoming parameter of a system read function, and call the system read function with an address of a received data cache region as an object;
the second acquisition module is used for acquiring and storing the session key from the received data cache region;
the apple peripheral device 60 further includes: the system comprises a first analysis generation module and a first encapsulation sending module;
the first analysis generation module is used for receiving a write instruction issued after the apple operating system 502 is called by the apple application 501, when the write instruction is received, analyzing the write instruction sent by the apple operating system 502 according to a preset protocol format to obtain a session key negotiation request, generating a session key and storing the session key in a first preset storage area, generating a write file success response according to the preset protocol format and sending the write file success response to the apple operating system 502;
the first encapsulation sending module is configured to receive a read instruction issued after the apple operating system 502 is called by the apple application 501, and when the read instruction is received, encapsulate the session key in the first preset storage area according to a preset protocol format to obtain a read file success response and send the read file success response to the apple operating system 502, and empty the first preset storage area;
the first module 5014 is configured to use the stored to-be-processed data as to-be-written data, and specifically includes: the first acting module 5014 is configured to encrypt the PIN verification instruction and the first PIN code using the session key to obtain a first ciphertext, and use the first ciphertext as data to be written;
the first processing module 603 is specifically configured to decrypt the first ciphertext with the stored session key to obtain a PIN verification instruction and a first PIN code, obtain a stored second PIN code, determine whether the first PIN code is the same as the second PIN code, generate a PIN verification success result and store the PIN verification success result in the first preset storage area if the first PIN code is the same as the second PIN code, and otherwise, generate a PIN verification failure result and store the PIN verification failure result in the first preset storage area.
Optionally, in this embodiment, the apple application 501 further includes: the second calling module, the second receiving calling module and the third acquiring module;
the second is used as a calling module, which is used for taking the instruction for obtaining the device identifier as data to be written, taking the access path of the apple peripheral 60 in the device object as an incoming parameter of the system write function, and calling the system write function by taking the data to be written as the object;
the second receiving and calling module is configured to receive write file success response data obtained by analyzing a write file success response sent by the apple operating system 502 by the apple peripheral 60, and when the write file success response data is received, take an access path of the apple peripheral 60 in an equipment object as an incoming parameter of a system read function, and call the system read function with an address of a received data cache region as an object;
a third obtaining module, configured to obtain the first device identifier from the received data cache, determine whether the first device identifier is the same as a preset second device identifier, if so, trigger the first determining module 5014, otherwise, end the process;
the apple peripheral device 60 further includes: the second analysis generation module and the second encapsulation sending module;
the second analysis generation module is used for receiving a write instruction issued after the apple operating system 502 is called by the apple application 501, when the write instruction is received, analyzing the write instruction sent by the apple operating system 502 according to a preset protocol format to obtain an equipment identification acquisition instruction, acquiring a first equipment identification and storing the first equipment identification in a first preset storage area, generating a write file success response according to the preset protocol format and sending the write file success response to the apple operating system 502;
and the second encapsulation sending module is configured to, when receiving a read instruction issued after the apple operating system 502 is called by the apple application 501, encapsulate the first device identifier in the first preset storage area according to a preset protocol format to obtain a successful response of the read file and send the successful response to the apple operating system 502, and empty the first preset storage area.
The embodiment provides a communication system based on an apple operating system, which adopts an apple file read-write Framework protocol, so that an apple peripheral which does not support an External access Framework protocol can communicate with an apple mobile device.
The above description is only for the preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all such changes or substitutions should be covered by the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims (30)
1. A communication method based on an apple operating system is applicable to a system comprising an apple mobile device and an apple peripheral, wherein the apple mobile device comprises an apple operating system and an apple application, and the method comprises the following steps:
step 101: the apple application generates data to be processed according to information input by a user and stores the data;
step 102: the apple application calls a system document selection view controller to obtain an equipment object of the apple peripheral, judges whether the equipment name in the obtained equipment object is the same as a first preset equipment name or not, if so, executes step 103, otherwise, ends;
step 103: the apple application takes the stored data to be processed as data to be written in, takes an access path of an apple peripheral in the equipment object as an incoming parameter of a system write function, and calls the system write function by taking the data to be written in as an object; when the apple peripheral receives a write instruction issued after the apple operating system is called by the apple application, the apple peripheral analyzes the write instruction according to a preset protocol format to obtain data to be written in, performs preset processing operation on the data to be written in to obtain a processing result, stores the processing result in a first preset storage area, generates a write file success response according to a preset protocol format and sends the write file success response to the apple operating system;
step 104: when the apple application receives write file success response data obtained by analyzing a write file success response sent by the apple peripheral by the apple operating system, the apple application takes an access path of the apple peripheral in the equipment object as an incoming parameter of a system read function, and calls the system read function by taking the address of a received data cache region as an object; when the apple peripheral receives a read instruction issued after the apple operating system is called by the apple application, the apple peripheral packages the processing result in the first preset storage area according to a preset protocol format to obtain a read file success response and sends the read file success response to the apple operating system, and the first preset storage area is emptied;
step 105: the apple application acquires a processing result from the received data cache region;
the method further comprises the following steps: when the apple peripheral is plugged into the apple mobile device, reporting to the apple operating system that the device type is a mass storage device.
2. The method of claim 1, wherein the step 102 further comprises: and the apple application saves the access path of the apple peripheral in the equipment object as a bookmark.
3. The method of claim 2, wherein step 102 is preceded by: the apple application judges whether the apple application stores an access path of an apple peripheral, if so, step 103 is executed, otherwise, step 102 is executed;
the specific steps of judging whether the access path of the apple peripheral is stored by the apple application are as follows: the apple application acquires the bookmark stored by the apple mobile device, whether the bookmark is acquired is judged, if yes, the apple application is judged to store the access path of the apple peripheral, and if not, the apple application is judged not to store the access path of the apple peripheral.
4. The method according to claim 1, wherein the step 102 is specifically:
step M1: the apple application calls a system document selection view controller and sets the file type supported by the system document selection view controller;
step M2: the apple application sets a preset main view controller as an agent of the system document selection view controller;
step M3: the apple application sets a popup mode of the system document selection view controller to be a mode;
step M4: when the main view controller of the apple application receives the device object of the apple peripheral and the access right to the apple peripheral returned by the system document selection view controller, judging whether the device name in the device object is the same as a first preset device name, if so, executing step 103, otherwise, ending.
5. The method according to claim 4, wherein in step M1, the file types supported by the system document selection view controller are specifically set as: and the apple application sets the file type supported by the system document selection view controller as a text.
6. The method of claim 1, wherein in step 103, the apple application takes the stored data to be processed as data to be written, and taking an access path of an apple peripheral in the device object as an incoming parameter of a system write function specifically includes: the apple application takes the stored data to be processed as data to be written in, and takes an access path, a first preset parameter value, a second preset parameter value and a third preset parameter value of the apple peripheral in the equipment object as a first incoming parameter, a second incoming parameter, a third incoming parameter and a fourth incoming parameter of the system write function respectively.
7. The method according to claim 1, wherein in step 103, the write command includes a preset write command code, data to be written, and a check code; the specific steps of the apple peripheral analyzing the write command according to a preset protocol format to obtain data to be written are as follows: and the apple peripheral analyzes the write instruction according to a preset protocol format to obtain a preset write instruction code, data to be written and a check code.
8. The method of claim 1, wherein in step 104, the apple application takes an access path of an apple peripheral in the device object as an incoming parameter of a system read function, and calls the system read function with an address of a received data buffer as an object, specifically: and the apple peripheral takes the access path, the fourth preset parameter value and the fifth preset parameter value of the apple peripheral as a first incoming parameter, a second incoming parameter and a third incoming parameter of the system read function respectively, and calls the system read function by taking the address of the received data cache region as an object.
9. The method of claim 1, wherein in step 104, the apple peripheral encapsulates the processing result in the first preset storage area according to a preset protocol format to obtain a read file success response, and sends the read file success response to the apple operating system, specifically: the apple peripheral acquires a preset file reading success response instruction code, generates a check code, sequentially splices the preset file reading success response instruction code, the processing result in the first preset storage area and the check code to obtain a file reading success response, and sends the file reading success response to the apple operating system.
10. The method of claim 1, wherein step 103 is preceded by: the apple application calls the system file coordinator to acquire the write permission of the apple peripheral;
in step 104, before calling the system read function with the address of the received data cache region as an object, the method further includes: and the apple application calls the system file coordinator to acquire the read permission of the apple peripheral.
11. The method according to claim 1, wherein the data to be written is specifically data to be signed; in step 103, performing a preset processing operation on the data to be written to obtain a processing result, and storing the processing result in a first preset storage area, where the specific steps are: and the apple peripheral signs the data to be signed by using an equipment private key to obtain a signature result, and stores the signature result in a first preset storage area.
12. The method according to claim 1, wherein the data to be written is specifically a get random number instruction; in step 103, performing a preset processing operation on the data to be written to obtain a processing result, and storing the processing result in a first preset storage area, where the specific steps are: the apple peripheral generates a first random number, and stores the first random number in a first preset storage area.
13. The method according to claim 1, wherein the data to be written is specifically a PIN checking instruction and a first PIN code; in step 103, performing a preset processing operation on the data to be written to obtain a processing result, and storing the processing result in a first preset storage area, where the specific steps are: the apple peripheral acquires a stored second PIN code, judges whether the first PIN code is the same as the second PIN code or not, generates a PIN checking success result and stores the PIN checking success result in a first preset storage area if the first PIN code is the same as the second PIN code, and generates a PIN checking failure result and stores the PIN checking failure result in the first preset storage area if the first PIN code is not the same as the second PIN code.
14. The method of claim 13, wherein step 103 is preceded by:
step C1: the apple application takes the negotiation session key request as data to be written in, takes an access path of an apple peripheral in the equipment object as an incoming parameter of a system write function, and calls the system write function by taking the data to be written in as an object; when the apple peripheral receives a write instruction issued after the apple operating system is called by the apple application, the apple peripheral analyzes the write instruction sent by the apple operating system according to a preset protocol format to obtain a session key negotiation request, generates a session key and stores the session key in a first preset storage area, generates a write file success response according to a preset protocol format and sends the write file success response to the apple operating system;
step C2: when the apple application receives write file success response data obtained by analyzing a write file success response sent by the apple peripheral by the apple operating system, the apple application takes an access path of the apple peripheral in the equipment object as an incoming parameter of a system read function, and calls the system read function by taking an address of a received data cache region as an object; when the apple peripheral receives a read instruction issued after the apple operating system is called by the apple application, the apple peripheral packages the session key in the first preset storage area according to a preset protocol format to obtain a read file success response and sends the read file success response to the apple operating system, and the first preset storage area is emptied;
step C3: the apple application acquires and stores the session key from the received data cache region;
the specific steps of the apple application, taking the stored data to be processed as the data to be written in, are as follows: the apple application encrypts the PIN checking instruction and the first PIN code by using the session key to obtain a first ciphertext, and the first ciphertext is used as data to be written;
the specific processing result obtained by executing the preset processing operation on the data to be written is as follows: the apple peripheral decrypts the first ciphertext by using the stored session key to obtain the PIN checking instruction and the first PIN code, acquires the stored second PIN code, judges whether the first PIN code is the same as the second PIN code, generates a PIN checking success result and stores the PIN checking success result in the first preset storage area if the first PIN code is the same as the second PIN code, and generates a PIN checking failure result and stores the PIN checking failure result in the first preset storage area if the first PIN code is not the same as the second PIN code.
15. The method of claim 1, wherein step 103 is preceded by:
step B1: the apple application takes an acquisition device identification instruction as data to be written in, takes an access path of an apple peripheral in the device object as an incoming parameter of a system write function, and calls the system write function by taking the data to be written in as an object; when the apple peripheral receives a write instruction issued after the apple operating system is called by the apple application, the apple peripheral analyzes the write instruction sent by the apple operating system according to a preset protocol format to obtain an equipment identification acquisition instruction, acquires a first equipment identification and stores the first equipment identification in a first preset storage area, generates a write file success response according to a preset protocol format and sends the write file success response to the apple operating system;
step B2: when the apple application receives write file success response data obtained by analyzing a write file success response sent by the apple peripheral by the apple operating system, the apple application takes an access path of the apple peripheral in the equipment object as an incoming parameter of a system read function, and calls the system read function by taking the address of a received data cache region as an object; when the apple peripheral receives a read instruction issued after the apple operating system is called by the apple application, the apple peripheral packages a first device identifier in the first preset storage area according to a preset protocol format to obtain a read file success response and sends the read file success response to the apple operating system, and the first preset storage area is emptied;
step B3: and the apple application acquires a first equipment identifier from the received data cache region, judges whether the first equipment identifier is the same as a preset second equipment identifier or not, if so, executes the step 103, and otherwise, finishes the step.
16. The communication system based on the apple operating system is characterized by comprising an apple mobile device and an apple peripheral, wherein the apple mobile device comprises an apple operating system and an apple application;
the apple application comprises: the system comprises a first generation module, a first calling module, a first judgment module, a first serving module, a second calling module, a first receiving module, a second serving module, a third calling module, a first acquisition module and a report module;
the first generation module is used for generating and storing data to be processed according to information input by a user;
the first calling module is used for calling the system document selection view controller to obtain an equipment object of the apple peripheral equipment;
the first judging module is used for judging whether the equipment name in the equipment object acquired by the first calling module is the same as a first preset equipment name or not, if so, the first acting module is triggered, and if not, the process is finished;
the first acting module is used for taking the data to be processed stored by the first generating module as data to be written in, and taking an access path of an apple peripheral in the equipment object as an incoming parameter of a system write function;
the second calling module is used for calling a system writing function by taking the data to be written as an object;
the first receiving module is used for receiving write file success response data obtained by analyzing a write file success response sent by the apple peripheral by the apple operating system;
the second acting module is used for taking an access path of an apple peripheral in the equipment object as an incoming parameter of a system read function;
the third calling module is used for calling a system reading function by taking the address of the received data cache region as an object;
the first obtaining module is configured to obtain a processing result from the received data cache region;
the reporting module is used for reporting the device type to the apple operating system as a mass storage device when the apple peripheral is inserted into the apple mobile device;
the apple peripheral device comprises: the system comprises a second receiving module, a first analyzing module, a first processing module, a first saving module, a second generating module, a third receiving module, a first packaging module and a first emptying module;
the second receiving module is used for receiving a write instruction issued after the apple operating system is called by the apple application;
the first analysis module is used for analyzing the write instruction according to a preset protocol format to obtain data to be written when the second receiving module receives the write instruction issued after the apple operating system is called by the apple application;
the first processing module is used for executing preset processing operation on the data to be written to obtain a processing result;
the first storage module is used for storing the processing result in a first preset storage area;
the second generation module is used for generating a successful response of the write file according to a preset protocol format and sending the successful response to the apple operating system;
the third receiving module is configured to receive a read instruction issued after the apple operating system is called by the apple application;
the first encapsulation module is configured to encapsulate, when the third receiving module receives a read instruction issued after the apple operating system is called by the apple application, a processing result in the first preset storage area according to a preset protocol format to obtain a read file success response, and send the read file success response to the apple operating system;
the first emptying module is used for emptying the first preset storage area.
17. The system of claim 16, wherein the apple application further comprises: a second saving module;
and the second storage module is used for storing the access path of the apple peripheral in the equipment object as a bookmark.
18. The system of claim 17, wherein the apple application further comprises: a second judgment module;
the second judging module is used for judging whether the apple application stores an access path of an apple peripheral, if so, the first serving module is triggered, and otherwise, the first calling module is triggered;
the second judging module specifically includes: a first obtaining unit and a first judging unit;
the first obtaining unit is used for obtaining the bookmark stored by the apple application;
the first judging unit is used for judging whether the first obtaining unit obtains the bookmark or not, if so, judging that the second storage module stores the access path of the apple peripheral, and if not, judging that the second storage module does not store the access path of the apple peripheral.
19. The system of claim 16, wherein the first calling module specifically comprises: a first setting unit, a second setting unit and a third setting unit;
the first setting unit is used for calling a system document selection view controller and setting the file types supported by the system document selection view controller;
the second setting unit is used for setting a preset main view controller as an agent of the system document selection view controller;
the third setting unit is used for setting the pop-up mode of the system document selection view controller as a modal;
the first judging module specifically comprises: a first receiving unit and a second judging unit;
the first receiving unit is used for receiving the device object of the apple peripheral and the access right to the apple peripheral returned by the system document selection view controller through the main view controller;
the second judging unit is configured to, when the first receiving unit receives, through the master view controller, the device object of the apple peripheral and the access right to the apple peripheral returned by the system document selection view controller, judge whether a device name in the device object is the same as a first preset device name, if so, trigger the first acting module, and otherwise, end the process.
20. The system according to claim 19, wherein the first setting unit is specifically configured to set a file type supported by the system document selection view controller to text.
21. The system according to claim 16, wherein the first acting module is specifically configured to use the stored data to be processed as data to be written, and use an access path, a first preset parameter value, a second preset parameter value, and a third preset parameter value of an apple peripheral in the device object as a first incoming parameter, a second incoming parameter, a third incoming parameter, and a fourth incoming parameter of the system write function, respectively.
22. The system of claim 16, wherein the write command includes a preset write command code, data to be written, and a check code;
the first parsing module is specifically configured to parse the write command according to a preset protocol format to obtain a preset write command code, data to be written, and a check code.
23. The system of claim 16, wherein the second acting module is specifically configured to take the access path of the apple peripheral, a fourth preset parameter value, and a fifth preset parameter value as a first incoming parameter, a second incoming parameter, and a third incoming parameter of the system read function, respectively.
24. The system of claim 16, wherein the first encapsulation module is specifically configured to obtain a preset read file success response instruction code, generate a check code, sequentially splice the preset read file success response instruction code, the processing result in the first preset storage area, and the check code to obtain a read file success response, and send the read file success response to the apple operating system.
25. The system of claim 16, wherein the apple application further comprises: a fourth calling module and a fifth calling module;
the fourth calling module is used for calling the system file coordinator to acquire the write permission of the apple peripheral;
and the fifth calling module is used for calling the system file coordinator to acquire the read permission of the apple peripheral.
26. The system of claim 16, wherein the data to be written is specifically data to be signed;
the first processing module is specifically configured to sign the data to be signed by using an equipment private key to obtain a signature result;
the first saving module is specifically configured to save the signature result in a first preset storage area.
27. The system of claim 16, wherein the data to be written is specifically a get random number instruction;
the first processing module is specifically configured to generate a first random number;
the first saving module is specifically configured to save the first random number in a first preset storage area.
28. The system according to claim 16, wherein the data to be written is specifically a PIN checking instruction and a first PIN code;
the first processing module is specifically configured to obtain a stored second PIN code, determine whether the first PIN code is the same as the second PIN code, if so, generate a PIN verification success result, and trigger the first storage module, otherwise, generate a PIN verification failure result, and trigger the first storage module;
the first storage module is specifically configured to store the PIN verification success result or the PIN verification failure result generated by the first processing module in a first preset storage area.
29. The system of claim 28, wherein the apple application further comprises: the first calling module, the first receiving calling module and the second obtaining module;
the first calling module is used for taking the negotiation session key request as data to be written, taking an access path of the apple peripheral in the equipment object as an incoming parameter of a system write function, and calling the system write function by taking the data to be written as an object;
the first receiving and calling module is used for receiving write file success response data obtained by analyzing a write file success response sent by the apple peripheral by the apple operating system, taking an access path of the apple peripheral in the equipment object as an incoming parameter of a system read function when the write file success response data is received, and calling the system read function by taking an address of a received data cache region as an object;
the second obtaining module is configured to obtain and store the session key from the received data cache region;
the apple peripheral further comprises: the system comprises a first analysis generation module and a first encapsulation sending module;
the first analysis generation module is used for receiving a write instruction issued after the apple operating system is called by the apple application, when the write instruction is received, analyzing the write instruction sent by the apple operating system according to a preset protocol format to obtain a session key negotiation request, generating a session key and storing the session key in a first preset storage area, and generating a write file success response according to the preset protocol format and sending the write file success response to the apple operating system;
the first encapsulation sending module is used for receiving a read instruction issued after the apple operating system is called by the apple application, and when the read instruction is received, encapsulating the session key in the first preset storage area according to a preset protocol format to obtain a read file success response and sending the read file success response to the apple operating system, and emptying the first preset storage area;
the first acting module is used for taking the stored data to be processed as data to be written, and specifically comprises the following steps: the first serving module is used for encrypting the PIN checking instruction and the first PIN code by using the session key to obtain a first ciphertext, and the first ciphertext is used as data to be written;
the first processing module is specifically configured to decrypt the first ciphertext by using the stored session key to obtain the PIN verification instruction and the first PIN code, obtain the stored second PIN code, determine whether the first PIN code is the same as the second PIN code, generate a PIN verification success result and store the PIN verification success result in the first preset storage area if the first PIN code is the same as the second PIN code, and otherwise, generate a PIN verification failure result and store the PIN verification failure result in the first preset storage area.
30. The system of claim 16, wherein the apple application further comprises: the second calling module, the second receiving calling module and the third acquiring module;
the second calling module is used for taking the obtained equipment identification instruction as data to be written in, taking an access path of the apple peripheral in the equipment object as an incoming parameter of a system write function, and calling the system write function by taking the data to be written in as an object;
the second receiving and calling module is configured to receive write file success response data obtained by analyzing a write file success response sent by the apple peripheral by the apple operating system, and when the write file success response data is received, use an access path of the apple peripheral in the device object as an incoming parameter of a system read function, and call the system read function with an address of a received data cache region as an object;
the third obtaining module is configured to obtain a first device identifier from the received data cache area, determine whether the first device identifier is the same as a preset second device identifier, trigger the first serving module if the first device identifier is the same as the preset second device identifier, and end the process if the first device identifier is not the same as the preset second device identifier;
the apple peripheral further comprises: the second analysis generation module and the second encapsulation sending module;
the second analysis generation module is used for receiving a write instruction issued after the apple operating system is called by the apple application, when the write instruction is received, analyzing the write instruction sent by the apple operating system according to a preset protocol format to obtain an equipment identification acquisition instruction, acquiring a first equipment identification and storing the first equipment identification in a first preset storage area, and generating a write file success response according to the preset protocol format and sending the write file success response to the apple operating system;
and the second encapsulation sending module is used for encapsulating the first equipment identifier in the first preset storage area according to a preset protocol format to obtain a successful response of a read file and sending the successful response to the apple operating system when receiving a read instruction issued after the apple operating system is called by the apple application, and emptying the first preset storage area.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011301310.9A CN112100103B (en) | 2020-11-19 | 2020-11-19 | Communication method and system based on apple operating system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011301310.9A CN112100103B (en) | 2020-11-19 | 2020-11-19 | Communication method and system based on apple operating system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112100103A true CN112100103A (en) | 2020-12-18 |
CN112100103B CN112100103B (en) | 2021-03-16 |
Family
ID=73785914
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011301310.9A Active CN112100103B (en) | 2020-11-19 | 2020-11-19 | Communication method and system based on apple operating system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112100103B (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101052031A (en) * | 2007-05-23 | 2007-10-10 | 中兴通讯股份有限公司 | Data interaction method for Apple computer and radio communication terminal |
US9201833B2 (en) * | 2014-02-26 | 2015-12-01 | American Megatrends, Inc. | Backplane controller capable of transferring and receiving data through USB interface |
CN105975415A (en) * | 2016-04-27 | 2016-09-28 | 成都门铺集科技有限公司 | Peripheral device management control apparatus, method and system |
CN108108317A (en) * | 2017-12-29 | 2018-06-01 | 飞天诚信科技股份有限公司 | A kind of method and apparatus for realizing the multiplex roles equipment for apple mobile terminal |
CN109446120A (en) * | 2016-06-22 | 2019-03-08 | 飞天诚信科技股份有限公司 | A kind of USB device and its method for identifying MacOS system |
-
2020
- 2020-11-19 CN CN202011301310.9A patent/CN112100103B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101052031A (en) * | 2007-05-23 | 2007-10-10 | 中兴通讯股份有限公司 | Data interaction method for Apple computer and radio communication terminal |
US9201833B2 (en) * | 2014-02-26 | 2015-12-01 | American Megatrends, Inc. | Backplane controller capable of transferring and receiving data through USB interface |
CN105975415A (en) * | 2016-04-27 | 2016-09-28 | 成都门铺集科技有限公司 | Peripheral device management control apparatus, method and system |
CN109446120A (en) * | 2016-06-22 | 2019-03-08 | 飞天诚信科技股份有限公司 | A kind of USB device and its method for identifying MacOS system |
CN108108317A (en) * | 2017-12-29 | 2018-06-01 | 飞天诚信科技股份有限公司 | A kind of method and apparatus for realizing the multiplex roles equipment for apple mobile terminal |
Also Published As
Publication number | Publication date |
---|---|
CN112100103B (en) | 2021-03-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107766190B (en) | Interface testing method and device, computer equipment and storage medium | |
CN104636924B (en) | Secure payment method, server and system | |
CN109857404B (en) | SDK interface packaging method and device, storage medium and electronic equipment | |
CN107122289A (en) | The method of system regression test, apparatus and system | |
CN108287790A (en) | Application program capacity test method, device and the electronic equipment of terminal | |
CN110719590B (en) | One-key login method, device, equipment and storage medium based on mobile phone number | |
CN107577622A (en) | Back end interface analogy method, equipment and storage medium | |
CN109597716A (en) | A kind of asynchronous remote copying method and system | |
CN111538515A (en) | Method, device and equipment for upgrading electric energy meter program | |
US20210120391A1 (en) | Method for providing near filed communication device information for user and system therefor | |
CN108170600A (en) | The coverage rate statistical method of front-end code test, apparatus and system | |
CN106557308A (en) | A kind of software continuous integrated approach and device | |
CN108052550B (en) | Annuity data receiving method and device, computer equipment and storage medium | |
CN110099414A (en) | Network resource transmission method, apparatus, computer equipment and storage medium | |
CN112866193A (en) | Equipment deployment method, device, equipment and storage medium | |
CN112100103B (en) | Communication method and system based on apple operating system | |
CN108182195A (en) | A kind of loading method of data, device, terminal and storage medium | |
CN102708032B (en) | Method and device for detecting hot plug of secure digital card | |
CN104570967B (en) | Long-range control method and system based on android system | |
CN105743890B (en) | Authority information generation method and device | |
CN108920389B (en) | Method and device for dynamically matching protocol type and application of multi-protocol USB device | |
CN110377292A (en) | Service configuration method, apparatus, computer equipment and storage medium | |
CN105975624B (en) | A kind of data transmission method, equipment and system | |
US9489984B2 (en) | Display apparatus, information terminal, display system, and program | |
EP3038390B1 (en) | Processing method and apparatus for signaling tracing |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |