Data processing method, device, computer equipment, storage medium and product
By obtaining device port information and attribute information, identifying device types and loading matching compilers, programming errors caused by device version mismatches are solved, and programming efficiency and compiler matching are improved.
Patent Information
- Application Number
- CN202211007353.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-22
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2042-08-22
AI Technical Summary
During the programming process, students often forget to switch to the corresponding device version when the device is replaced.
By obtaining the port information and attribute information of the device, the device type is identified, the device version information is queried in the preset storage path, and a matching compiler is loaded for compilation to avoid errors caused by compiler mismatch.
It improves programming efficiency, ensures the matching of compiler and device, avoids errors caused by compiler mismatch, and simplifies the device replacement process.
Smart Images

Figure CN117667100B
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and specifically to a data processing method, apparatus, computer equipment, storage medium and product, wherein the storage medium is a computer-readable storage medium and the product is a computer program product. Background Art
[0002] With the rapid development of artificial intelligence, many schools and institutions have launched artificial intelligence learning courses to enable students to understand the rapidly developing artificial intelligence technology and learn programming skills. In the process of programming the device, it is necessary to determine the compilation method supported by the device. Usually, students determine the device version of the device by themselves, and then determine the corresponding compilation method. However, this requires students to have a better understanding of the device version. When students do not know much about the device version, or forget to switch the corresponding device version when changing the device, the client will compile using a compilation method that does not match the device version, which will cause errors in device programming and low programming efficiency. Summary of the invention
[0003] The embodiments of the present application provide a data processing method, apparatus, computer equipment, storage medium and product, which can avoid errors caused by compiler mismatch and improve programming efficiency.
[0004] A data processing method provided in an embodiment of the present application includes:
[0005] Obtaining information about a port through which a preset device to be programmed is connected to a terminal, and a preset device type of the device;
[0006] Acquire device attribute information of a connection device connected to the terminal through a port corresponding to the port information;
[0007] identifying a device type of the connected device according to the device attribute information;
[0008] If the device type matches the preset device type, querying the device version information of the connected device in a storage area corresponding to the preset device type under a preset storage path;
[0009] A compiler corresponding to the connection device is loaded based on the device version information, so that the program to be written is compiled by the compiler and then written into the connection device from the port.
[0010] Accordingly, an embodiment of the present application further provides a data processing device, including:
[0011] A first information acquisition unit, used to acquire information about a port through which a preset device to be programmed is connected to a terminal, and a preset device type of the device;
[0012] A second information acquisition unit, used to acquire device attribute information of a candidate device connected to the terminal through a port;
[0013] a type identification unit, configured to identify a device type of the connected device according to the device attribute information;
[0014] A version query unit, configured to query device version information of the connected device in a storage area corresponding to the preset device type under a preset storage path if the device type matches the preset device type;
[0015] The loading unit is used to load a compiler corresponding to the connection device based on the device version information, so that after the program to be written is compiled by the compiler, it is written into the connection device from the port.
[0016] In one embodiment, the device attribute information includes a first device identifier of the connected device, and the version query unit includes:
[0017] A file acquisition subunit, configured to acquire a device configuration file including a second device identifier and device version information from a storage area corresponding to the preset device type under a preset storage path if the device type matches the preset device type;
[0018] The version identification subunit is used for, if the second device identification obtained by parsing the device configuration file matches the first device identification, then using the device version information in the device configuration file as the device version information of the connected device.
[0019] In one embodiment, the version query unit further includes:
[0020] a sending subunit, configured to send the device configuration file to a server, so that the server parses the device configuration file to obtain the first device identifier and device version information in the device configuration file;
[0021] The receiving subunit is used to receive the first device identification and device version information in the device configuration file sent by the server.
[0022] In one embodiment, the loading unit comprises:
[0023] a type determination subunit, configured to determine a device model of the connecting device according to the first device identifier of the connecting device and the device version information;
[0024] The compiler loading subunit is used to load the compiler corresponding to the preset device type if the device model matches the preset device type.
[0025] In one embodiment, the loading unit further includes:
[0026] A window display subunit, configured to display a device type switching window including a switching control if the device model does not match the preset device type;
[0027] The switching subunit is used to update the preset device type to a device type matching the preset device type model in response to a confirmation operation on the switching control, so as to load a compiler corresponding to the preset device type.
[0028] In one embodiment, the first information acquisition unit includes:
[0029] A page display unit, used to display a hardware programming learning page of the client, wherein the hardware programming learning page includes a circuit board selection control and a port selection control;
[0030] The response unit is used to obtain the preset device type in response to the selection operation on the circuit board selection control, and to obtain the port information in response to the selection operation on the port selection control.
[0031] In one embodiment, the data processing device further includes:
[0032] A connecting unit, used to connect the client to the connecting device through the port;
[0033] The writing unit is used for writing the program to be written compiled by the compiler into the connecting device through the port when receiving a program writing request.
[0034] Correspondingly, an embodiment of the present application also provides a computer device, including a memory and a processor; the memory stores a computer program, and the processor is used to run the computer program in the memory to execute any data processing method provided in the embodiment of the present application.
[0035] Correspondingly, an embodiment of the present application also provides a computer-readable storage medium, which is used to store a computer program, and the computer program is loaded by a processor to execute any data processing method provided in the embodiment of the present application.
[0036] Accordingly, an embodiment of the present application further provides a computer program product, including a computer program, which implements any data processing method provided in the embodiment of the present application when executed by a processor.
[0037] The embodiment of the present application obtains the port information of the preset device to be programmed and the terminal, as well as the preset device type of the device; obtains the device attribute information of the connected device connected to the terminal through the port corresponding to the port information; identifies the device type of the connected device according to the device attribute information; if the device type matches the preset device type, queries the device version information of the connected device in the storage area corresponding to the preset device type under the preset storage path; loads the compiler corresponding to the connected device based on the device version information, so that after the program to be written is compiled by the compiler, it is written to the connected device from the port.
[0038] The embodiment of the present application selects a connected device that matches the device type through device attribute information, and automatically and accurately identifies the device version information of the connected device based on the device configuration file, and then uses a compiler that matches the connected device for compilation, thereby avoiding errors caused by compiler mismatch and improving programming efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0040] Figure 1 It is a scene diagram of the data processing method provided in the embodiment of the present application;
[0041] Figure 2 is a flow chart of a data processing method provided in an embodiment of the present application;
[0042] Figure 3 It is a port connection diagram of the data processing method provided in the embodiment of the present application;
[0043] Figure 4 It is a schematic diagram of device attribute information of a data processing method provided in an embodiment of the present application;
[0044] Figure 5 is another device attribute information schematic diagram of the data processing method provided in an embodiment of the present application;
[0045] Figure 6 It is a schematic diagram of a preset storage path of the data processing method provided in an embodiment of the present application;
[0046] Figure 7 is a schematic diagram of a device configuration file of a data processing method provided in an embodiment of the present application;
[0047] Figure 8It is a schematic diagram of a hardware programming learning page of a data processing method provided in an embodiment of the present application;
[0048] Fig. 9 is another flow chart of the data processing method provided in an embodiment of the present application;
[0049] Fig.10 is a schematic diagram of a data processing device provided in an embodiment of the present application;
[0050] Fig.11 It is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0051] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0052] The embodiments of the present application provide a data processing method, apparatus, computer equipment and computer-readable storage medium. The data processing apparatus can be integrated in a computer equipment, which can be a server or a terminal.
[0053] The terminal may include a mobile phone, a wearable smart device, a tablet computer, a laptop computer, a personal computer (PC), and a vehicle-mounted computer.
[0054] Among them, the server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, as well as big data and artificial intelligence platforms.
[0055] For example, Figure 1 As shown, a computer device is used as a terminal for explanation, and the terminal obtains device attribute information of a connection device connected to a port corresponding to preset port information of the terminal; determines the device type of the connection device and the first device identifier of the connection device from candidate devices according to the device attribute information; obtains a device configuration file in a storage area corresponding to a preset storage path, and the device configuration file includes a second device identifier and device version information.
[0056] If the second device identifier matches the first device identifier, indicating that the device configuration file belongs to the connected device, the device version information in the device configuration file is determined as the device version information of the connected device.
[0057] Based on the device version information and the first device identifier of the connected device, a compiler corresponding to the connected device is loaded so that after the program to be written is compiled by the compiler, it is written into the connected device from the port, thereby avoiding errors caused by compiler mismatch and improving programming efficiency.
[0058] It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments.
[0059] This embodiment will be described from the perspective of a data processing device. The data processing device may be integrated into a computer device, which may be a server or a terminal.
[0060] The present application provides a data processing method, such as Figure 2 As shown, the specific process of the data processing method can be as follows:
[0061] 101. Obtain information about a port through which a preset device to be programmed is connected to a terminal, and a preset device type of the device.
[0062] The port information may include information indicating a corresponding port, such as a port number, etc. The preset device type indicates the manufacturer, product type, and product version of the device.
[0063] Users can preset port information and device type.
[0064] 102. Obtain device attribute information of a connection device connected to the terminal through a port corresponding to the port information.
[0065] The connection device may be a device connected to the terminal via a port corresponding to preset port information, and the connection device may include a programmable device, such as a circuit board or a device integrated with a circuit board.
[0066] The device attribute information may be information including attributes of the connected device, such as a vendor identification code (Vender ID, VID), a product identification code (Product ID, PID), and a product serial number (Serial Number, SN).
[0067] For example, when a device is connected to a terminal through a port, a corresponding record of the device being connected through the port will be displayed on the terminal. The device connected through the port corresponding to the preset port information can be viewed in the device manager file on the terminal, and the device attribute information of the device can be obtained.
[0068] For example, Figure 3 As shown, in the terminal's Computer Management-Device Manager path, you can view the devices connected through the port, such as Figure 4 and Figure 5 As shown, the device attribute information of the connected device can be viewed in the device attribute file. Therefore, the device attribute information of the connected device can be obtained from the storage path of the attribute file of the connected device connected to the port corresponding to the preset port information on the terminal.
[0069] 103. Identify the device type of the connected device according to the device attribute information.
[0070] For example, the device type of the connected device may be determined based on the information of relevant attributes in the device attribute information, for example, the supplier and product type of the connected device may be determined. For example, the supplier information of the connected device may be determined based on the VID code. Optionally, the device of the specified supplier and product type of the connected device may be determined based on the VID code and the PID code, and then the device type of the connected device may be determined based on the supplier and the product type. For example, if the VID of the connected device is 0D28 and the PID is 0204, it is determined that the device type of the connected device is a BBC development board, that is, a micro:bit development board.
[0071] 104. If the device type matches the preset device type, query the device version information of the connected device in the storage area corresponding to the preset device type under the preset storage path.
[0072] The device version information may indicate the version of the product. For example, micro:bitV1 is the first-generation version, and micro:bitV2 is the second-generation version.
[0073] The preset storage path may be a storage path of a storage area generated after the device is connected, for example, Figure 4 As shown in the figure, when the device is connected to the terminal, the terminal generates a storage area with the device name corresponding to the device under the device and driver file. The device configuration file of the device is stored in the storage area, and the preset storage path is the device and driver file. Among them, the storage area corresponding to the preset device type is the storage area with a name matching the preset device type under the preset storage path. For example, the micro:bit development board will have a corresponding storage area named MICROBIT.
[0074] The device configuration file contains basic information about the device's hardware, such as the ID, the boot loader version, and USB interface description information. The ID can be used to uniquely identify the device, and the Bootloader Version represents the processor model. Different processors have different corresponding compilation methods.
[0075] For example, the preset device type is the second version of the microcomputer development board designed for youth programming education launched by the British Broadcasting Corporation (BBC) - micro:bit development board V2. The VID of the micro:bit development board is 0D28 and the PID is 0204. Therefore, it can be determined that the device type in the connected device is the micro:bit development board according to the VID code and PID code of the connected device. If the preset device type matches the device type of the connected device, the device configuration file is obtained in the storage area corresponding to the preset device type under the preset storage path.
[0076] For example, Figure 6 As shown in the figure, the preset device type is micro:bit development board. The micro:bit development board will have a corresponding storage area named MICROBIT. You can query the storage area corresponding to the micro:bit development board in the preset storage path, such as Figure 7 As shown, the device configuration file DETAILS.TXT is obtained from the storage area, and the device version information of the connected device is determined according to the device version information in the device configuration file.
[0077] In order to accurately obtain the device configuration file of the connected device when there are multiple storage areas matching the preset device type under the preset storage path, it can be determined whether the configuration file belongs to the connected device through the device identification information in the device configuration file. That is, in one embodiment, the device attribute information includes the first device identification of the connected device. The step of "if the device type matches the preset device type, querying the device version information of the connected device in the storage area corresponding to the preset device type under the preset storage path" may specifically include:
[0078] If the device type matches the preset device type, obtaining a device configuration file including the second device identifier and device version information in a storage area corresponding to the preset device type under a preset storage path;
[0079] If the second device identifier in the device configuration file matches the first device identifier, the device version information in the device configuration file is used as the device version information of the connected device.
[0080] For example, the identification of the connected device, namely the first device identification, can be obtained from the device attribute information of the connected device. If the device type matches the preset device type, the device configuration file is obtained, and the identification for identifying the device, namely the second device identification, is identified in the device configuration file.
[0081] If the first device identifier and the second device identifier are the same, or have a mapping relationship, and the device configuration file is identified as the device configuration file of the connected device, the device version information of the connected device is obtained according to the information in the device version field. The device version field can be a field in the device configuration file that represents the processor version of the device, for example, the BootloaderVersion field. With the development of technology and the changing needs of application scenarios, it is necessary to upgrade the device. For example, on October 13, 2020, the official micro:bit development board officially released the latest BBC micro:bitV2. Compared with micro:bitV1, micro:bitV2 has made the following upgrades:
[0082] 1. Processor: Upgraded from the original Nordic Semiconductor nRF51822 to nRF52833, the processing performance is greatly improved.
[0083] 2. Memory: Increased from the original 256KB flash memory and 16KB RAM to 512KB flash memory and 128KB RAM.
[0084] 3. Wireless communication: Upgraded from the original Bluetooth 4.0 to Bluetooth 5.0, allowing for longer transmission distance and faster speed.
[0085] 4. Speaker: Added on the back of the board, it allows creators to play their music instantly. It can simulate a bumblebee in flight, presenting vivid sound frequency, speed and volume according to the speed of movement.
[0086] 5. Sound sensor: Added on the back of the board, and on the front there is a sound input hole and a microphone activity indicator next to it. The indicator will light up red when the microphone is in use. With the microphone's sound detection function, you can make the heart on the micro:bitV2 beat by clapping your hands.
[0087] 6. Touch sensor: Copper-plated and located on the top of the front, it is different from the resistive touch of the V1.5 version. The new version uses capacitive touch, and is a bit like a mobile phone in use.
[0088] 7. Built-in shutdown / sleep mode: The reset button on the back of the board has been replaced with a sleep and shutdown mode. You can turn off the power of the board or switch to sleep mode by long pressing the button.
[0089] Since the two versions of processors are different, when compiling the hardware code for micro:bit, you need to distinguish which processor's core compilation library to use according to the version, that is, use the corresponding compiler for processing.
[0090] Among them, the Bootloader Version of micro:bitV2 is 0255, and the device version information of the device can be determined based on this field.
[0091] Specifically, the device configuration file can be parsed and the fields in the device configuration file can be traversed to obtain the device identification field and the device version field in the device configuration file. The second device identification of the device can be determined according to the device identification field, and the device version information of the device can be determined according to the device version field. If the second device identification matches the first device identification, it is considered that the storage area is a storage area generated by the connected device on the terminal, and the device configuration file in the storage area belongs to the connected device. The device version information obtained according to the device version field in the device configuration file is determined as the device version information of the connected device.
[0092] Optionally, the device configuration file can be parsed by the server. Since the server has strong computing power, the version identification speed of the connected device can be improved, and the space occupied by the computer program on the terminal can be reduced. That is, after the step of "if the device type matches the preset device type, then in the storage area corresponding to the preset device type under the preset storage path, obtain the device configuration file containing the second device identifier and the device version information", the version identification method provided in the embodiment of the present application can also specifically include:
[0093] Sending the device configuration file to the server so that the server parses the device configuration file to obtain the first device identifier and device version information in the device configuration file;
[0094] The first device identifier and device version information in the device configuration file sent by the server are received.
[0095] For example, the device configuration file may be sent to a server, and the server may parse the device configuration file to obtain the first device identifier. The parsing process may refer to the above-mentioned related description, which will not be described in detail here.
[0096] Receive the first device identifier sent by the server. Optionally, the server may also parse the device configuration file to obtain the device version information of the connected device, and send the device version information to the terminal. The terminal compares the first device identifier and the second device identifier. If the first device identifier and the second device identifier are the same, the device version information of the connected device is obtained based on the device version information belonging to the same device configuration file as the first device identifier.
[0097] 105. Based on the device version information, a compiler corresponding to the connected device is loaded, so that the program to be written is compiled by the compiler and then written into the connected device through the port.
[0098] For example, after determining the device version information of the connected device, the corresponding compiler can be loaded, the compiler compiles the program to be written for the connected device based on the core compilation library corresponding to the processor of the connected device, and writes the compiled program to be written to the connected device through the port.
[0099] Optionally, in order to prevent the user from connecting the wrong device, the device type of the device to be programmed (i.e., preset device type) may be preset, and when the device type of the connected device is matched with the preset device type, the corresponding compiler is loaded. That is, in one embodiment, the step of "loading the compiler corresponding to the connected device based on the device version information" includes:
[0100] Determine the device model of the connected device according to the first device identifier and device version information of the connected device;
[0101] If the device model matches the preset device type, the compiler corresponding to the preset device type is loaded.
[0102] The device model may be a product model or product version of the connected device, for example, micro:bit 1st generation, micro:bit 2nd generation, or CocoRobo.
[0103] The device model of the connected device is determined according to the first device identification and the device version information of the connected device. If the device model is the same as the preset device type of the device to be programmed determined by the user, a compiler corresponding to the device version information is loaded.
[0104] For example, based on the device attribute information, it can be determined that the device type is the micro:bit development board launched by BBC. Based on the device version information of the connected device, it can be determined that the connected device is the device model - micro:bit second generation device.
[0105] If the device model does not match the preset device type, the compiler currently used by the client is incompatible with the connected device and needs to be switched. The device type set on the client can be automatically switched, or the user can be reminded to switch the device type. That is, in one embodiment, after the step "if the connected device type matches the preset device type, then load the compiler corresponding to the preset device type", the version identification method provided in the embodiment of the present application may further include:
[0106] If the connected device type does not match the preset device type, a device type switching window containing a switching control is displayed;
[0107] In response to a confirmation operation on the switch control, the preset device type is updated to a device type matching the device model, so as to load a compiler corresponding to the preset device type.
[0108] For example, if the device model does not match the device type pre-set by the user, a device type switching window including a switching control is displayed. The switching window can prompt the user to switch the preset device type to a device type that matches the connected device. In response to a confirmation operation on the switching control, the preset device type is switched to the device model to load the compiler corresponding to the preset device type.
[0109] After determining the corresponding compiler of the connected device, the client can be connected to the connected device through the port corresponding to the terminal of the connected device, so that the computer program compiled by the compiler can be written into the connected device, that is, after the step of "loading the compiler corresponding to the connected device based on the device version information", the device version identification method provided in the embodiment of the present application can also specifically include:
[0110] Connect the client to the connection device through the port;
[0111] When a program writing request is received, the program to be written compiled by the compiler is written into the connected device through the port.
[0112] For example, the port corresponding to the connection device on the terminal can be set as the client's program writing path, that is, the client and the connection device are connected through the port, and when a program writing request triggered by the client is received, the compiled writing program is written to the connection device through the port.
[0113] Optionally, a hardware programming learning page may be displayed for the user to set the device type. The user may select the device type in the hardware programming learning page and set the preset device type. When the connected device type of the connected device matches the device type selected by the user, it indicates that the device type is selected correctly or the device is connected correctly, and the corresponding compiler is loaded. Otherwise, the device type is selected incorrectly or the device is connected incorrectly, and the user is reminded to make changes. That is, in one embodiment, the step of "obtaining the port information of the preset device to be programmed and the terminal connection, and the preset device type of the device" may specifically include:
[0114] Display the client's hardware programming learning page, which includes a circuit board selection control;
[0115] In response to a selection operation on a circuit board selection control, a preset device type is obtained.
[0116] For example, the hardware programming learning page shows a variety of circuit boards, each of which has a corresponding control, such as Figure 8 As shown, the displayed circuit board picture can be used as a control. By selecting the circuit board to be programmed on the hardware programming learning page, in response to the selection operation of the circuit board selection control, the device type (i.e., the preset device type) of the circuit board to be programmed is determined, for example, micro:bit 1st generation, micro:bit 2nd generation, or CocoRobo, etc.
[0117] Optionally, step 102 can determine a connected device that matches a preset device type from the connected devices according to the device attribute information. For example, the preset device type is micro:bit second generation. Since the device attribute information includes a vendor identification code (Vender ID, VID) and a product identification code (Product ID, PID), the device (i.e., the connected device) belonging to the development board developed by BBC can be determined from the connected devices according to the VID and PID in the device attribute information.
[0118] As can be seen from the above, the embodiments of the present application obtain the port information of the preset device to be programmed and the terminal, as well as the preset device type of the device; obtain the device attribute information of the connected device connected to the terminal through the port corresponding to the port information; identify the device type of the connected device according to the device attribute information; if the device type matches the preset device type, query the device version information of the connected device in the storage area corresponding to the preset device type under the preset storage path; load the compiler corresponding to the connected device based on the device version information, so that after the program to be written is compiled by the compiler, it is written to the connected device from the port.
[0119] The embodiment of the present application selects a connected device that matches the device type through device attribute information, and automatically and accurately identifies the device version information of the connected device based on the device configuration file, and then uses a compiler that matches the connected device for compilation, thereby avoiding errors caused by compiler mismatch and improving programming efficiency.
[0120] Based on the above embodiments, further detailed description will be given below with examples.
[0121] This embodiment will be described from the perspective of a data processing device, which may be integrated into a computer device, which may be a terminal or other device;
[0122] The present application provides a data processing method, such as Fig. 9 As shown, the specific process of the data processing method can be as follows:
[0123] 201. The terminal displays the hardware programming learning page of the client, and responds to the selection operation of the circuit board selection control on the hardware programming learning page to determine the preset port information and the preset device type.
[0124] For example, Figure 5 As shown, the hardware programming learning page displays a variety of circuit boards, and uses the displayed circuit board pictures as circuit board selection controls. The user selects the circuit board to be programmed on the hardware programming learning page. The terminal responds to the selection operation on the circuit board selection control, determines the device type of the circuit board to be programmed (i.e., the preset device type), for example, micro:bit generation 1, micro:bit generation 2, or CocoRobo, etc., and selects the port information for connection.
[0125] 202. The terminal obtains device attribute information of a connection device connected through a port.
[0126] For example, Figure 3 As shown, under the Computer Management-Device Manager path of the terminal, the connected devices connected through the port can be viewed, and the device property information of the connected devices can be viewed in the property file of the connected devices. Therefore, the device property information of the connected devices can be obtained from the storage path of the property file of the device connected to the port corresponding to the port information on the terminal.
[0127] 203. The terminal determines the device type of the connected device and the first device identifier of the connected device according to the device attribute information.
[0128] For example, the device of the specified supplier and product type of the connected device can be determined according to the VID code and PID code in the device attribute information, and then the device type of the connected device can be determined according to the supplier and the product type. For example, if the VID of the connected device is 0D28 and the PID is 0204, it is determined that the device type of the connected device is a BBC development board, that is, a micro:bit development board.
[0129] 204. If the device type matches the preset device type, the terminal obtains a device configuration file from a storage area corresponding to the preset device type in the device and driver file.
[0130] For example, in step 201, the preset device type selected by the user is micro:bit second generation, and in step 203, it is determined that the device type of the connected device is a device of the micro:bit development board. The preset device type matches the device type of the connected device, and the device configuration file is obtained in the storage area corresponding to the preset device type under the preset storage path.
[0131] 205. The terminal parses the device configuration file to obtain the second device identifier and device version information.
[0132] For example, the terminal can parse the device configuration file, traverse the fields in the device configuration file, obtain the device identification field and the device version field in the device configuration file, determine the second device identification of the device according to the device identification field, and determine the device version information of the device according to the device version field.
[0133] 206. If the first device identifier and the second device identifier match, the terminal determines device version information of the connected device according to the device configuration file.
[0134] For example, if the second device identifier matches the first device identifier, the storage area is considered to be a storage area generated by the connected device on the terminal, and the device configuration file in the storage area belongs to the connected device. The device version information of the connected device will be obtained based on the information corresponding to the device version field in the device configuration file.
[0135] 207. The terminal loads a compiler corresponding to the connected device based on the device version information and the first device identifier, so that the program to be written is compiled by the compiler and then written into the connected device through the port.
[0136] For example, after determining the device version information of the connected device, the corresponding compiler can be loaded, the compiler compiles the program to be written for the connected device based on the core compilation library corresponding to the processor of the connected device, and writes the compiled program to be written to the connected device through the port.
[0137] As can be seen from the above, the terminal of the embodiment of the present application determines the preset device type by displaying the hardware programming learning page of the client and responding to the selection operation of the circuit board selection control on the hardware programming learning page; obtains the device attribute information of the connected device connected through the port; determines the connected device corresponding to the preset device type and the first device identifier of the connected device from the connected device according to the device attribute information; obtains the device configuration file in the storage area corresponding to the preset device type in the device and driver file; parses the device configuration file to obtain the second device identifier and the connected device version information; if the first device identifier and the second device identifier match, determines that the connected device version information is the version information of the connected device; based on the device version information and the first device identifier, loads the compiler corresponding to the connected device, so that after the program to be written is compiled by the compiler, it is written to the connected device through the port.
[0138] The embodiment of the present application selects a connected device that matches the device type through device attribute information, and automatically and accurately identifies the device version information of the connected device based on the device configuration file, and then uses a compiler that matches the connected device for compilation, thereby avoiding errors caused by compiler mismatch and improving programming efficiency.
[0139] In order to better implement the data processing method provided in the embodiment of the present application, a data processing device is also provided in one embodiment. The meanings of the terms are the same as those in the above data processing method, and the specific implementation details can refer to the description in the method embodiment.
[0140] The data processing device may be integrated into a computer device, such as Fig.10 As shown, the data processing device may include: a first information acquisition unit 301, a second information acquisition unit 302, a type identification unit 303, a version query unit 304 and a loading unit 305, as follows:
[0141] (1) A first information acquisition unit 301 is used to acquire information about a port through which a preset device to be programmed is connected to a terminal, and a preset device type of the device.
[0142] In one embodiment, the data processing device may further include a page display unit and a response unit, specifically:
[0143] A page display unit, used to display a hardware programming learning page of the client, wherein the hardware programming learning page includes a circuit board selection control and a port selection control;
[0144] The response unit is used to determine the preset device type in response to a selection operation on the circuit board selection control, and to obtain the port information in response to a selection operation on the port selection control.
[0145] (2) A second information acquisition unit 302 is used to acquire device attribute information of a candidate device connected to the terminal through a port.
[0146] (3) A type identification unit 303, configured to identify the device type of the connected device according to the device attribute information.
[0147] (4) A version query unit 304, configured to query device version information of the connected device in a storage area corresponding to the preset device type under a preset storage path if the device type matches the preset device type.
[0148] In one embodiment, the device attribute information includes a first device identifier of the connected device, and the version query unit may include a file acquisition subunit and a version identification subunit, specifically:
[0149] A file acquisition subunit, configured to acquire a device configuration file including a second device identifier and device version information from a storage area corresponding to the preset device type under a preset storage path if the device type matches the preset device type;
[0150] The version identification subunit is used for, if the second device identification obtained by parsing the device configuration file matches the first device identification, then using the device version information in the device configuration file as the device version information of the connected device.
[0151] In one embodiment, the version query unit may further include a sending subunit and a receiving subunit, specifically:
[0152] a sending unit, configured to send the device configuration file to a server, so that the server parses the device configuration file to obtain the first device identifier and device version information in the device configuration file;
[0153] The receiving unit is used to receive the first device identification and device version information in the device configuration file sent by the server.
[0154] (5) A loading unit 305, configured to load a compiler corresponding to the connected device based on the device version information, so that the program to be written is compiled by the compiler and then written into the connected device from the port.
[0155] In one embodiment, the loading unit 305 may include a type acquisition subunit, a type determination subunit and a compiler loading subunit, specifically:
[0156] a type determination subunit, configured to determine a device model of the connecting device according to the first device identifier of the connecting device and the device version information;
[0157] The compiler loading subunit is used to load the compiler corresponding to the preset device type if the device model matches the preset device type.
[0158] In one embodiment, the loading unit 305 may further include a window display subunit and a switching subunit, specifically:
[0159] a window display subunit, configured to display a device type switching window including a switching control if the connected device type does not match the preset device type;
[0160] The switching subunit is used to update the preset device type to a device type matching the device model in response to a confirmation operation on the switching control, so as to load a compiler corresponding to the preset device type.
[0161] In one embodiment, the data processing device may further include a connecting unit and a writing unit, specifically:
[0162] A connecting unit, used to connect the client to the connecting device through the port;
[0163] The writing unit is used for writing the program to be written compiled by the compiler into the connecting device through the port when receiving a program writing request.
[0164] The data processing device of the embodiment of the present application obtains the port information of the preset device to be programmed and the terminal connected, as well as the preset device type of the device, by the first information acquisition unit 301; the second information acquisition unit 302 obtains the device attribute information of the connection device connected to the terminal through the port corresponding to the port information; the type identification unit 303 identifies the device type of the connection device according to the device attribute information; if the device type matches the preset device type, the version query unit 304 queries the device version information of the connection device in the storage area corresponding to the preset device type under the preset storage path; finally, the loading unit 305 loads the compiler corresponding to the connection device based on the device version information, so that after the program to be written is compiled by the compiler, it is written into the connection device from the port.
[0165] The embodiment of the present application selects a connected device that matches the device type through device attribute information, and automatically and accurately identifies the device version information of the connected device according to the device configuration file, and then uses a compiler that matches the connected device for compilation, thereby avoiding errors caused by compiler mismatch and improving programming efficiency. The embodiment of the present application also provides a computer device, which can be a terminal or a server, such as Fig.11 As shown, it shows a schematic diagram of the structure of the computer device involved in the embodiment of the present application, specifically:
[0166] The computer device may include components such as a processor 1001 with one or more processing cores, a memory 1002 with one or more computer-readable storage media, a power supply 1003, and an input unit 1004. Those skilled in the art will appreciate that Fig.11 The computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. Among them:
[0167] The processor 1001 is the control center of the computer device. It uses various interfaces and lines to connect various parts of the entire computer device. By running or executing software programs and / or modules stored in the memory 1002 and calling data stored in the memory 1002, it executes various functions of the computer device and processes data, thereby monitoring the computer device as a whole. Optionally, the processor 1001 may include one or more processing cores; preferably, the processor 1001 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, computer program, etc., and the modem processor mainly processes wireless communication. It is understandable that the above-mentioned modem processor may not be integrated into the processor 1001.
[0168] The memory 1002 can be used to store software programs and modules. The processor 1001 executes various functional applications and data processing by running the software programs and modules stored in the memory 1002. The memory 1002 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, a computer program required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 1002 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 1002 may also include a memory controller to provide the processor 1001 with access to the memory 1002.
[0169] The computer device also includes a power supply 1003 for supplying power to various components. Preferably, the power supply 1003 can be logically connected to the processor 1001 through a power management system, so as to manage charging, discharging, and power consumption through the power management system. The power supply 1003 can also include any components such as one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, and power status indicators.
[0170] The computer device may further include an input unit 1004, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0171] Although not shown, the computer device may further include a display unit, etc., which will not be described in detail herein. Specifically, in this embodiment, the processor 1001 in the computer device will load the executable files corresponding to the processes of one or more computer programs into the memory 1002 according to the following instructions, and the processor 1001 will run the computer programs stored in the memory 1002, thereby realizing various functions, as follows:
[0172] Obtaining the port information of the preset device to be programmed and the terminal connected thereto, as well as the preset device type of the device;
[0173] Obtain device attribute information of a connection device connected to the terminal through a port corresponding to the port information;
[0174] Identify the device type of the connected device according to the device attribute information; if the device type matches the preset device type, query the device version information of the connected device in the storage area corresponding to the preset device type under the preset storage path;
[0175] A compiler corresponding to the connected device is loaded based on the device version information, so that the program to be written is compiled by the compiler and then written into the connected device from the port.
[0176] The specific implementation of the above operations can be found in the previous embodiments and will not be described in detail here.
[0177] As can be seen from the above, the computer device of the embodiment of the present application can obtain
[0178] Obtain the port information of the preset device to be programmed and the terminal, as well as the preset device type of the device; obtain the device attribute information of the connected device connected to the terminal through the port corresponding to the port information; identify the device type of the connected device according to the device attribute information; if the device type matches the preset device type, query the device version information of the connected device in the storage area corresponding to the preset device type under the preset storage path; load the compiler corresponding to the connected device based on the device version information, so that after the program to be written is compiled by the compiler, it is written to the connected device from the port.
[0179] The embodiment of the present application selects a connected device that matches the device type through device attribute information, and automatically and accurately identifies the device version information of the connected device based on the device configuration file, and then uses a compiler that matches the connected device for compilation, thereby avoiding errors caused by compiler mismatch and improving programming efficiency.
[0180] According to one aspect of the present application, a computer program product is provided, the computer program product comprising a computer program, the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in various optional implementations in the above-mentioned embodiments.
[0181] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by a computer program, or by controlling related hardware through a computer program. The computer program may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0182] To this end, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. The computer program can be loaded by a processor to execute any data processing method provided in the embodiment of the present application.
[0183] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0184] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0185] Since the computer program stored in the computer-readable storage medium can execute any data processing method provided in the embodiments of the present application, the beneficial effects that can be achieved by any data processing method provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0186] The above is a detailed introduction to a data processing method, device, computer equipment and computer-readable storage medium provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the ideas of the present application, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A data processing method, characterized in that: include: Obtaining information about a port through which a preset device to be programmed is connected to a terminal, and a preset device type of the device; Acquire device attribute information of a connection device connected to the terminal through a port corresponding to the port information; identifying a device type of the connected device according to the device attribute information; If the device type matches the preset device type, querying the device version information of the connected device in a storage area corresponding to the preset device type under a preset storage path; A compiler corresponding to the connection device is loaded based on the device version information, so that the program to be written is compiled by the compiler and then written into the connection device from the port.
2. The method according to claim 1, characterized in that The device attribute information includes a first device identifier of the connected device, and if the device type matches the preset device type, querying the device version information of the connected device in a storage area corresponding to the preset device type under a preset storage path includes: If the device type matches the preset device type, obtaining a device configuration file including a second device identifier and device version information in a storage area corresponding to the preset device type under a preset storage path; If the second device identifier in the device configuration file matches the first device identifier, the device version information in the device configuration file is used as the device version information of the connecting device.
3. The method according to claim 1, characterized in that: If the device type matches the preset device type, then after acquiring a device configuration file including a second device identifier and device version information in a storage area corresponding to the preset device type under a preset storage path, the method further includes: Sending the device configuration file to a server so that the server parses the device configuration file to obtain the first device identifier and device version information in the device configuration file; Receive the first device identifier and device version information in the device configuration file sent by the server.
4. The method according to claim 1, characterized in that: The loading of a compiler corresponding to the connected device based on the device version information includes: Determining a device model of the connecting device according to the first device identifier of the connecting device and the device version information; If the device model matches the preset device type, a compiler corresponding to the preset device type is loaded.
5. The method according to claim 4, characterized in that If the device model matches the preset device type, after loading the compiler corresponding to the preset device type, the method further includes: If the device model does not match the preset device type, displaying a device type switching window including a switching control; In response to a confirmation operation on the switching control, the preset device type is updated to a device type matching the device model, so as to load a compiler corresponding to the preset device type.
6. The method according to any one of claims 1 to 5, characterized in that: The step of obtaining the port information of the preset device to be programmed and the terminal connected thereto, and the preset device type of the device, includes: Displaying a hardware programming learning page of the client, wherein the hardware programming learning page includes a circuit board selection control and a port selection control; In response to a selection operation on the circuit board selection control, the preset device type is acquired, and in response to a selection operation on the port selection control, the port information is acquired.
7. The method according to claim 6, characterized in that After loading the compiler corresponding to the connected device based on the device version information, the method further includes: Connecting the client to the connection device via the port; When a program writing request is received, the program to be written compiled by the compiler is written into the connection device through the port.
8. A data processing device, characterized in that: include: The first information acquisition unit is used to acquire the port information of the preset device to be programmed and the terminal, and the preset device type of the device A second information acquisition unit, used to acquire device attribute information of a candidate device connected to the terminal through a port; a type identification unit, configured to identify a device type of the connected device according to the device attribute information; A version query unit, configured to query device version information of the connected device in a storage area corresponding to the preset device type under a preset storage path if the device type matches the preset device type; The loading unit is used to load a compiler corresponding to the connection device based on the device version information, so that after the program to be written is compiled by the compiler, it is written into the connection device from the port.
9. A computer device, characterized in that: It comprises a memory and a processor; the memory stores a computer program, and the processor is used to run the computer program in the memory to execute the data processing method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store a computer program, and the computer program is loaded by a processor to execute the data processing method according to any one of claims 1 to 7.
11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the data processing method according to any one of claims 1 to 7 is implemented.
