CN106776401B - Method for message transmission and device - Google Patents

Method for message transmission and device Download PDF

Info

Publication number
CN106776401B
CN106776401B CN201611037623.1A CN201611037623A CN106776401B CN 106776401 B CN106776401 B CN 106776401B CN 201611037623 A CN201611037623 A CN 201611037623A CN 106776401 B CN106776401 B CN 106776401B
Authority
CN
China
Prior art keywords
message
sent
weight
priority
transmit queue
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.)
Active
Application number
CN201611037623.1A
Other languages
Chinese (zh)
Other versions
CN106776401A (en
Inventor
王旭
张锋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Neusoft Corp
Original Assignee
Neusoft Corp
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Neusoft Corp filed Critical Neusoft Corp
Priority to CN201611037623.1A priority Critical patent/CN106776401B/en
Publication of CN106776401A publication Critical patent/CN106776401A/en
Application granted granted Critical
Publication of CN106776401B publication Critical patent/CN106776401B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/14Handling requests for interconnection or transfer
    • G06F13/20Handling requests for interconnection or transfer for access to input/output bus
    • G06F13/24Handling requests for interconnection or transfer for access to input/output bus using interrupt
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/14Handling requests for interconnection or transfer
    • G06F13/20Handling requests for interconnection or transfer for access to input/output bus
    • G06F13/24Handling requests for interconnection or transfer for access to input/output bus using interrupt
    • G06F13/26Handling requests for interconnection or transfer for access to input/output bus using interrupt with priority control
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Communication Control (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Computer And Data Communications (AREA)
  • Telephonic Communication Services (AREA)

Abstract

The present disclosure proposes a kind of method for message transmission and devices, are related to field of communication technology, and this method includes: the first message for obtaining application and sending, and include the priority of the message in first message;First message is stored in transmit queue, and records the priority and property parameters of first message;It wherein, include the priority and property parameters of one or more message to be sent and every message to be sent in the transmit queue after being stored in first message;The transmission priority weight of every message to be sent is obtained according to the priority of every message to be sent in transmit queue and property parameters;The second message of transmission priority maximum weight in transmit queue is sent to target processor.Message transmission sequence can be adjusted flexibly according to the significance level of message, guarantee that important messages can be sent in time.

Description

Method for message transmission and device
Technical field
This disclosure relates to field of communication technology more particularly to a kind of method for message transmission and device.
Background technique
During development communication technologies, the communication between host and external equipment is by UART (Universal Asynchronous Receiver/Transmitter, universal asynchronous receiving-transmitting transmitter) Lai Shixian serial data and parallel data Between conversion.The realization of this conversion regime is by the way that message is stored in FIFO (First Input First Output, elder generation Entering and first go out) come what is realized, the transmission sequence of message does not consider to disappear according only to the sequencing of message deposit fifo queue for queue The significance level for ceasing itself needs to wait deposit FIFO team before this after the message for carrying important information enters fifo queue Message in column, which is sent, just can be carried out transmission, cause important messages that cannot be sent in time.
Summary of the invention
The disclosure provides a kind of method for message transmission and device, does not consider the important of message to solve conventional message transmission Degree, the problem of causing important messages that cannot be sent in time.
To achieve the goals above, according to the first aspect of the embodiments of the present disclosure, a kind of method for message transmission is provided, it is described Method includes:
The first message that application is sent is obtained, includes the priority of the first message in the first message;
The first message is stored in transmit queue, and records the priority and property parameters of the first message;Its In, it include that one or more message to be sent and every are to be sent in the transmit queue after being stored in the first message The priority and property parameters of message;
According to the priority of every message to be sent in the transmit queue and property parameters obtain described every to Send the transmission priority weight of message;
The second message of transmission priority maximum weight in the transmit queue is sent to target processor.
Optionally, the property parameters of described every message to be sent include: described every Messages Message length to be sent with And the timestamp of the deposit transmit queue, the priority according to every message to be sent in the transmit queue and Property parameters obtain the transmission priority weight of described every message to be sent, comprising:
According to the timestamp of the priority of described every message to be sent, message-length and the deposit transmit queue, The transmission priority weight of described every message to be sent is successively obtained using preset transmission priority Weights-selected Algorithm.
Optionally, described according to the priority of described every message to be sent, message-length and the deposit transmission team The timestamp of column successively obtains the transmission priority of described every message to be sent using preset transmission priority Weights-selected Algorithm Weight, comprising:
A. according to the priority of the nth message to be sent in the transmit queue, message-length and the deposit hair The timestamp for sending queue obtains the transmission priority of nth message to be sent using the transmission priority Weights-selected Algorithm Weight;
B. by the transmission preferences of the transmission priority weight of nth message to be sent and preceding n-1 item message to be sent Maximum value in grade weight is compared;
C. make one of larger in the transmission priority weight of nth message to be sent and described maximum value the two For the maximum value of the transmission priority weight of preceding n item message to be sent;Wherein, n is positive integer, and 2≤n≤N, N are to send team The sum of current message to be sent in column;
Step a to step c is executed after the value of n is added 1 again, is disappeared until the N item in the acquisition transmit queue is to be sent The maximum value of the transmission priority weight of breath.
Optionally, the transmission priority Weights-selected Algorithm includes:
W=P*a+ (T-Tst)*b+Lmsg
Wherein, W indicates that the transmission priority weight of message to be sent, P indicate the priority of message to be sent, and T expression is worked as Preceding time, TstIndicate that message to be sent is stored in the timestamp of the transmit queue, LmsgIndicate the message-length of message to be sent, a Indicate that priority weighting, b indicate time migration (T-Tst) weight.
Optionally, the second message by transmission priority maximum weight in the transmit queue is sent to target processing Device, comprising:
The second message corresponding with the maximum value of the transmission priority weight is obtained from the transmit queue;
The second message is sent to the target processor.
According to the second aspect of an embodiment of the present disclosure, a kind of massage transmission device is provided, described device includes: that message obtains Module, message storage module, weight obtain module and sending module;
The message capturing module includes described for obtaining using the first message sent, in the first message The priority of one message;
The message storage module for the first message to be stored in transmit queue, and records the first message Priority and property parameters;It wherein, include one or more pending in the transmit queue after being stored in the first message Send the priority and property parameters of message and every message to be sent;
The weight obtains module, for the priority and category according to every message to be sent in the transmit queue Property parameter obtains the transmission priority weight of described every message to be sent;
The sending module, for the second message of transmission priority maximum weight in the transmit queue to be sent to mesh Mark processor.
Optionally, the property parameters of described every message to be sent include: the message-length of described every message to be sent And the timestamp of the deposit transmit queue, the weight obtain module and are used for:
According to the timestamp of the priority of described every message to be sent, message-length and the deposit transmit queue, The transmission priority weight of described every message to be sent is successively obtained using preset transmission priority Weights-selected Algorithm.
Optionally, it includes: that weight acquisition submodule, Comparative sub-module and most value obtain submodule that the weight, which obtains module, Block;
The weight acquisition submodule, for according to the priority of the nth message to be sent in the transmit queue, disappear The timestamp for ceasing length and the deposit transmit queue obtains the nth using the transmission priority Weights-selected Algorithm and waits for Send the transmission priority weight of message;
The Comparative sub-module, for the transmission priority weight of nth message to be sent and preceding n-1 item is pending The maximum value in the transmission priority weight of message is sent to be compared;
It is described most be worth acquisition submodule, for by the transmission priority weight of nth message to be sent and it is described most The maximum value of one of larger transmission priority weight as preceding n item message to be sent in big value the two;Wherein, n is positive whole Number, and 2≤n≤N, N are the sum of message to be sent current in transmit queue;
The weight acquisition submodule, the Comparative sub-module and the most value are executed after the value of n is added 1 again and obtains son Step performed by module, until obtaining the maximum of the transmission priority weight of the N item message to be sent in the transmit queue Value.
Optionally, the transmission priority Weights-selected Algorithm includes:
W=P*a+ (T-Tst)*b+Lmsg
Wherein, W indicates that the transmission priority weight of message to be sent, P indicate the priority of message to be sent, and T expression is worked as Preceding time, TstIndicate that message to be sent is stored in the timestamp of the transmit queue, LmsgIndicate the message-length of message to be sent, a Indicate that priority weighting, b indicate time migration (T-Tst) weight.
Optionally, the sending module includes: second message acquisition submodule and second message sending submodule;
The second message acquisition submodule, for being obtained from the transmit queue and the transmission priority weight The corresponding second message of maximum value;
The second message sending submodule, for the second message to be sent to the target processor.
Through the above technical solutions, the disclosure utilizes the priority and property parameters of message, according to the transmission preferences of message Grade weight carrys out the transmission sequence of decision message, has comprehensively considered the significance level of message and the time of message deposit queue, can Solve the problem of that conventional message transmission does not consider that the significance level of message causes important messages that cannot be sent in time, With message transmission sequence can be adjusted flexibly according to the significance level of message, guarantee the effect that important messages can be sent in time Fruit.
It should be understood that above general description and following detailed description be only it is exemplary and explanatory, not The disclosure can be limited.
Detailed description of the invention
Attached drawing is and to constitute part of specification for providing further understanding of the disclosure, with following tool Body embodiment is used to explain the disclosure together, but does not constitute the limitation to the disclosure.In the accompanying drawings:
Fig. 1 is a kind of flow chart of method for message transmission shown according to an exemplary embodiment;
Fig. 2 is the flow chart of another method for message transmission shown according to an exemplary embodiment;
Fig. 3 is the flow chart of another method for message transmission shown according to an exemplary embodiment;
Fig. 4 is a kind of block diagram of massage transmission device shown according to an exemplary embodiment;
Fig. 5 is the block diagram of another massage transmission device shown according to an exemplary embodiment;
Fig. 6 is the block diagram of another massage transmission device shown according to an exemplary embodiment.
Specific embodiment
Example embodiments are described in detail here, and the example is illustrated in the accompanying drawings.Following description is related to When attached drawing, unless otherwise indicated, the same numbers in different drawings indicate the same or similar elements.Following exemplary embodiment Described in embodiment do not represent all implementations consistent with this disclosure.On the contrary, they be only with it is such as appended The example of the consistent device and method of some aspects be described in detail in claims, the disclosure.
Before the method for message transmission and device for introducing disclosure offer, first to involved by each embodiment of the disclosure Application scenarios are introduced.The disclosure relates generally to the communication between source processor and target processor, wherein source processor It is parallel data when handling data, and it is serial data that target processor, which is capable of handling received, therefore before sending data It needs to realize the conversion between parallel data and serial data using specific circuit, equipment or chip.Therefore the disclosure is each Application scenarios involved in a embodiment are as follows: the message sent by the application run on source processor is stored in transmit queue, with Preset mode handles the message in queue, the message currently sent at first is selected from queue, and send in a serial fashion To target processor.Wherein, the disclosure is illustrated exemplary embodiment by taking universal asynchronous receiving-transmitting transmitter UART as an example.
Fig. 1 is a kind of flow chart of method for message transmission shown according to an exemplary embodiment, as shown in Figure 1, the party Method includes:
Step 101, the first message that application is sent is obtained, includes the priority of first message in first message.
Exemplary, according to the preset transport protocol of UART, source processor is obtained by serial communication high-level interface from application The frame structure of the first message taken can be as shown in table 1, includes in message: start bit (STX, Start of Text), preferential Grade (priority), data length (len), data (data) and verification and (checksum), start bit indicate the first message Beginning, priority indicates the significance level of the included business information of data in the first message, data length indicate this The digit for the data for including in one message, data indicate the data information for including in the first message, verify and for judging this Whether first message malfunctions in transmission process, if there is mistake, the letter that can be malfunctioned according to the protocol processes of default Breath.It should be noted that the application refers to the application program run in systems, background service or process.The first message is Current time, using the message of transmission.The type of service with message can be needed according to the communication of system, a priority is set Strategy arranges a sequencing to each message in system, successively assignment.Such as the message in system is divided into 10 Grade, the message of security alarm class are related to the safety of system, importance highest, and setting priority is 10, and heartbeat class message can Guarantee the synchronization of system time, more important, setting priority is 8 etc..Can also according to the state of system in the process of running, The assignment of adjustment priority in real time, for example, when CPU (central processing unit Central Processing Unit) utilization rate is excessively high When, reduce the priority of the lower message of some importance, allow CPU can the urgent message of priority processing, when CPU usage is low When, prompt class message is improved, allows CPU that can give full play to function.
Table 1
Step 102, first message is stored in transmit queue, and records the priority and property parameters of first message;Its In, it include the excellent of one or more message to be sent and every message to be sent in the transmit queue after being stored in first message First grade and property parameters.Wherein, the property parameters of every message to be sent include: the message-length of every message to be sent with And the timestamp of deposit transmit queue.It should be noted that the message-length of every message to be sent is total position of the message (bit) number, contain the total length of start bit, priority, data length, data and verification sum, and be stored in transmit queue when Between stamp be message to be sent be stored in transmit queue at the time of.
By taking first message as an example, the process of step 102, after receiving first message, need first will include in first message Priority and property parameters parse and first message is stored in transmit queue together.The property parameters of the first message It may include the message-length of first message and the timestamp for being stored in transmit queue, wherein the message-length can disappear for first The digit of breath.A message to be sent is included at least in transmit queue after being stored in first message.
Step 103, according to the priority of every message to be sent in transmit queue and property parameters obtain every to Send the transmission priority weight of message.
Exemplary, step 103 can be completed by the transmission daemon on source processor, and transmission daemon is that backstage is used The service processes of message inter-related task are sent in processing.
It optionally, can be according to the priority of every message to be sent, message-length and the deposit transmit queue Timestamp successively obtains the transmission priority weight of every message to be sent using preset transmission priority Weights-selected Algorithm.
Step 104, the second message of transmission priority maximum weight in transmit queue is sent to target processor.
It is exemplary, the transmission priority weight for every message to be sent that step 103 obtains is ranked up, transmission is found The maximum second message of weights, the second message may be any bar message in transmit queue.Then, pass through transmission Second message is sent to target processor by serial interface by daemon.It can use insertion sort, bubble sort or y-bend Transmission priority weight is ranked up by the methods of tree sorting.
Fig. 2 is the flow chart of another method for message transmission shown according to an exemplary embodiment, as shown in Fig. 2, step According to the timestamp of the priority of every message to be sent, message-length and the deposit transmit queue described in rapid 103, The transmission priority weight of every message to be sent is successively obtained using preset transmission priority Weights-selected Algorithm, comprising:
Step 1031, it is sent according to the priority of the nth message to be sent in transmit queue, message-length and deposit The timestamp of queue obtains the transmission priority weight of nth message to be sent using transmission priority Weights-selected Algorithm.
Step 1032, the transmission priority weight of nth message to be sent and the transmission of preceding n-1 item message to be sent is excellent Maximum value in first grade weight is compared.
Wherein, the maximum value in the transmission priority weight of preceding n-1 item message to be sent is in upper primary carry out step When 1013 to 1033, by the transmission of the transmission priority weight of (n-1)th message to be sent and preceding n-2 item message to be sent What the maximum value in weights determined after being compared, and so on, in this way, it is excellent to obtain transmission by repeatedly judgement The maximum value of first grade weight.And nth and preceding n- can be often judged during judging the most value of transmission priority weight In 1 message to be sent when the maximum value of transmission priority weight, the maximum value is recorded.It is exemplary, it can store the maximum value, The corresponding message of the maximum value is recorded simultaneously, it, can also be by updating pointer to find the corresponding message of the maximum value later The address of storage marks the maximum value, and the pointer is for being directed toward maximum value position in the transmit queue, to look for later The corresponding message of the maximum value into transmit queue.
Step 1033, make one of larger in the transmission priority weight of nth message to be sent and maximum value the two For the maximum value of the transmission priority weight of preceding n item message to be sent.
Wherein, n is positive integer, and 2≤n≤N, N are the sum of message to be sent current in transmit queue.
Step 1031 is executed again after the value of n is added 1 after step 1033 has executed to step 1033, until obtaining hair Send the maximum value of the transmission priority weight of the N item message to be sent in queue.
It is exemplary, when there was only a piece of news in transmit queue, i.e. when n=1, the message can be directly transmitted;Work as n=2 When, the transmission priority weight of the 2nd article of message to be sent is obtained according to transmission priority Weights-selected Algorithm, preceding n-1 item is to be sent to disappear Breath is the 1st article of message to be sent, and the transmission priority weight of two message is compared, maximum value and corresponding message are put Enter in caching.The 3rd article of message is judged again, and the transmission preferences of the 3rd article of message to be sent are obtained according to transmission priority Weights-selected Algorithm Grade weight, and the to be sent of transmission priority maximum weight in last the 1st article judged and the 2nd article of message to be sent disappear Breath compares, and maximum value is put into caching.It successively executes, until the message in transmit queue is all relatively finished, can obtain Take the maximum value of transmission priority weight in all message to be sent.
Optionally, above-mentioned transmission priority Weights-selected Algorithm includes:
W=P*a+ (T-Tst)*b+Lmsg
Wherein, W indicates that the transmission priority weight of message to be sent, P indicate the priority of message to be sent, and T expression is worked as Preceding time, TstIndicate the timestamp of message deposit transmit queue to be sent, LmsgIndicate that the message-length of message to be sent, a indicate Priority weighting, b indicate time migration (T-Tst) weight.
It is exemplary, a message to be sent, priority P 8, time migration (T-Tst) it is 0.5, the message of the message is long Spend LmsgIt is 64, priority weighting a is 100, and the weight b of time migration is 30.Then the transmission priority weight of the message is 879, The message sends the message prior to transmission priority weight less than 879.
Fig. 3 is the flow chart of another method for message transmission shown according to an exemplary embodiment, as shown in figure 3, step The second message of transmission priority maximum weight in transmit queue is sent to target processor described in rapid 104, comprising:
Step 1041, second message corresponding with the maximum value of transmission priority weight is obtained from transmit queue.
Step 1042, second message is sent to target processor.
It is exemplary, the transmission priority weight of every message to be sent is obtained according to step 103, is found in transmit queue The corresponding second message of the maximum value of transmission priority weight, and the second message is obtained from transmit queue, then second is disappeared Breath is sent to target processor.
In conclusion the disclosure utilize message priority and property parameters, according to the transmission priority weight of message come The transmission sequence of decision message has comprehensively considered the significance level of message and the time of message deposit queue, has been able to solve tradition Message transmits the significance level for not considering the problems of message, and message transmission can be adjusted flexibly according to the significance level of message by having Sequentially, guarantee the effect that important messages can be sent in time.
Fig. 4 is a kind of block diagram of massage transmission device shown according to an exemplary embodiment, as shown in figure 4, the device It include: message capturing module 401, message storage module 402, weight acquisition module 403 and sending module 404;
Message capturing module 401 includes the excellent of first message in first message for obtaining the first message using transmission First grade
Message storage module 402, for first message to be stored in transmit queue, and record first message priority and Property parameters;It wherein, include that one or more message to be sent and every are pending in the transmit queue after being stored in first message Send the priority and property parameters of message.
Weight obtains module 403, for being joined according to the priority and attribute of every message to be sent in transmit queue Number obtains the transmission priority weight of every message to be sent;
Sending module 404, for the second message of transmission priority maximum weight in transmit queue to be sent at target Manage device.
Wherein, it should be noted that the property parameters of every message to be sent include: that the message of every message to be sent is long Spend and be stored in the timestamp of the transmit queue.
Optionally, weight acquisition module 403 includes:
According to the timestamp of the priority of every message to be sent, message-length and the deposit transmit queue, utilize Preset transmission priority Weights-selected Algorithm successively obtains the transmission priority weight of every message to be sent.
Fig. 5 is the block diagram of another massage transmission device shown according to an exemplary embodiment, as shown in figure 5, weight Obtaining module 403 includes: weight acquisition submodule 4031, Comparative sub-module 4032 and most value acquisition submodule 4033;
Weight acquisition submodule 4031 is long for priority, the message according to the nth message to be sent in transmit queue The timestamp of degree and deposit transmit queue, the transmission for obtaining nth message to be sent using transmission priority Weights-selected Algorithm are excellent First grade weight.
Comparative sub-module 4032, for by the transmission priority weight of nth message to be sent with preceding n-1 item is to be sent disappears Maximum value in the transmission priority weight of breath is compared.
Most it is worth acquisition submodule 4033, for by both the transmission priority weight of nth message to be sent and maximum value In one of the larger transmission priority weight as preceding n item message to be sent maximum value.Wherein, n is positive integer, and 2≤n ≤ N, N are the sum of message to be sent current in transmit queue;
Weight acquisition submodule 4031, Comparative sub-module 4032 and most value acquisition submodule are executed after the value of n is added 1 again Step performed by 4033, until obtaining the maximum value of the transmission priority weight of the N item message to be sent in transmit queue.
Optionally, transmission priority Weights-selected Algorithm includes:
W=P*a+ (T-Tst)*b+Lmsg
Wherein, W indicates that the transmission priority weight of message to be sent, P indicate the priority of message to be sent, and T expression is worked as Preceding time, TstIndicate the timestamp of message deposit transmit queue to be sent, LmsgIndicate that the message-length of message to be sent, a indicate Priority weighting, b indicate time migration (T-Tst) weight.
Fig. 6 is the block diagram of another massage transmission device shown according to an exemplary embodiment, as shown in fig. 6, sending Module 404 includes: second message acquisition submodule 4041 and second message sending submodule 4042;
Second message acquisition submodule 4041, for obtaining the maximum value pair with transmission priority weight from transmit queue The second message answered;
Second message sending submodule 4042, for second message to be sent to target processor.
Wherein, illustrating for above-mentioned modules realization of functions has carried out in above method embodiment in detail Description, details are not described herein again.
In conclusion the disclosure utilize message priority and property parameters, according to the transmission priority weight of message come The transmission sequence of decision message has comprehensively considered the significance level of message and the time of message deposit queue, has been able to solve tradition Message transmits the significance level for not considering the problems of message, and message transmission can be adjusted flexibly according to the significance level of message by having Sequentially, guarantee the effect that important messages can be sent in time.
The preferred embodiment of the disclosure is described in detail in conjunction with attached drawing above, still, the disclosure is not limited to above-mentioned reality The detail in mode is applied, in the range of the technology design of the disclosure, those skilled in the art are considering specification and practice After the disclosure, it is readily apparent that other embodiments of the disclosure, belongs to the protection scope of the disclosure.
It is further to note that specific technical features described in the above specific embodiments, in not lance In the case where shield, it can be combined in any appropriate way.Simultaneously between a variety of different embodiments of the disclosure Any combination can also be carried out, as long as it, without prejudice to the thought of the disclosure, equally should be considered as disclosure disclosure of that. The disclosure is not limited to the precision architecture being described above out, and the scope of the present disclosure is only limited by the attached claims System.

Claims (8)

1. a kind of method for message transmission, which is characterized in that be applied to source processor, which comprises
The first message that application is sent is obtained according to UART protocol, includes the preferential of the first message in the first message Grade;
The first message is stored in transmit queue, and records the priority and property parameters of the first message;Wherein, it deposits It include one or more message to be sent and every message to be sent in the transmit queue after entering the first message Priority and property parameters;
It is to be sent according to the priority of every message to be sent in the transmit queue and property parameters acquisition described every The transmission priority weight of message;
The second message of transmission priority maximum weight in the transmit queue is sent by serial interface according to UART protocol To target processor;
The property parameters of every message to be sent include: described every message to be sent message-length and deposit described in The timestamp of transmit queue, it is described to be obtained according to the priority and property parameters of every message to be sent in the transmit queue Take the transmission priority weight of described every message to be sent, comprising:
According to the timestamp of the priority of described every message to be sent, message-length and the deposit transmit queue, utilize Preset transmission priority Weights-selected Algorithm successively obtains the transmission priority weight of described every message to be sent.
2. the method according to claim 1, wherein the priority according to described every message to be sent, The timestamp of message-length and the deposit transmit queue, successively obtained using preset transmission priority Weights-selected Algorithm described in The transmission priority weight of every message to be sent, comprising:
A. according to the priority of the nth message to be sent in the transmit queue, message-length and the deposit transmission team The timestamp of column obtains the transmission priority weight of nth message to be sent using the transmission priority Weights-selected Algorithm;
B. the transmission priority weight of nth message to be sent and the transmission priority of preceding n-1 item message to be sent are weighed Maximum value in value is compared;
It c. will be before conduct one of larger in the transmission priority weight of nth message to be sent and described maximum value the two The maximum value of the transmission priority weight of n item message to be sent;Wherein, n is positive integer, and 2≤n≤N, N are the transmission team The sum of current message to be sent in column;
Step a to step c is executed after the value of n is added 1 again, until obtaining the N item message to be sent in the transmit queue The maximum value of transmission priority weight.
3. method according to claim 1 or 2, which is characterized in that the transmission priority Weights-selected Algorithm includes:
W=P*a+ (T-Tst)*b+Lmsg
Wherein, W indicates the transmission priority weight of message to be sent, and P indicates the priority of message to be sent, when T indicates current Between, TstIndicate that message to be sent is stored in the timestamp of the transmit queue, LmsgIndicate that the message-length of message to be sent, a indicate Priority weighting, b indicate time migration (T-Tst) weight.
4. according to the method described in claim 2, it is characterized in that, it is described by transmission priority weight in the transmit queue most Big second message is sent to target processor, comprising:
The second message corresponding with the maximum value of the transmission priority weight is obtained from the transmit queue;
The second message is sent to the target processor.
5. a kind of massage transmission device, which is characterized in that be applied to source processor, described device includes: message capturing module, disappears Cease memory module, weight obtains module and sending module;
The message capturing module wraps in the first message for obtaining the first message that application is sent according to UART protocol Include the priority of the first message;
The message storage module for the first message to be stored in transmit queue, and records the preferential of the first message Grade and property parameters;It wherein, include one or more to be sent disappearing in the transmit queue after being stored in the first message The priority and property parameters of breath and every message to be sent;
The weight obtains module, for being joined according to the priority and attribute of every message to be sent in the transmit queue Number obtains the transmission priority weight of every message to be sent;
The sending module, for according to UART protocol by the second message of transmission priority maximum weight in the transmit queue Target processor is sent to by serial interface;
The property parameters of every message to be sent include: described every message to be sent message-length and deposit described in The timestamp of transmit queue, the weight obtain module and are used for:
According to the timestamp of the priority of described every message to be sent, message-length and the deposit transmit queue, utilize Preset transmission priority Weights-selected Algorithm successively obtains the transmission priority weight of described every message to be sent.
6. device according to claim 5, it is characterised in that: the weight obtain module include: weight acquisition submodule, Comparative sub-module and most value acquisition submodule;
The weight acquisition submodule is long for priority, the message according to the nth message to be sent in the transmit queue It is to be sent to obtain the nth using the transmission priority Weights-selected Algorithm for the timestamp for spending and being stored in the transmit queue The transmission priority weight of message;
The Comparative sub-module, for by the transmission priority weight of nth message to be sent with preceding n-1 item is to be sent disappears Maximum value in the transmission priority weight of breath is compared;
It is described to be most worth acquisition submodule, for by the transmission priority weight of nth message to be sent and the maximum value The maximum value of one of larger transmission priority weight as preceding n item message to be sent in the two;Wherein, n is positive integer, and 2≤n≤N, N are the sum of message to be sent current in the transmit queue;
The weight acquisition submodule, the Comparative sub-module and the most value acquisition submodule are executed after the value of n is added 1 again Performed step, until obtaining the maximum value of the transmission priority weight of the N item message to be sent in the transmit queue.
7. the device according to claim 6 or 5, the transmission priority Weights-selected Algorithm include:
W=P*a+ (T-Tst)*b+Lmsg
Wherein, W indicates the transmission priority weight of message to be sent, and P indicates the priority of message to be sent, when T indicates current Between, TstIndicate that message to be sent is stored in the timestamp of the transmit queue, LmsgIndicate that the message-length of message to be sent, a indicate Priority weighting, b indicate time migration (T-Tst) weight.
8. device according to claim 6, which is characterized in that the sending module includes: second message acquisition submodule With second message sending submodule;
The second message acquisition submodule, for obtaining the maximum with the transmission priority weight from the transmit queue It is worth the corresponding second message;
The second message sending submodule, for the second message to be sent to the target processor.
CN201611037623.1A 2016-11-23 2016-11-23 Method for message transmission and device Active CN106776401B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611037623.1A CN106776401B (en) 2016-11-23 2016-11-23 Method for message transmission and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611037623.1A CN106776401B (en) 2016-11-23 2016-11-23 Method for message transmission and device

Publications (2)

Publication Number Publication Date
CN106776401A CN106776401A (en) 2017-05-31
CN106776401B true CN106776401B (en) 2019-11-15

Family

ID=58973846

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611037623.1A Active CN106776401B (en) 2016-11-23 2016-11-23 Method for message transmission and device

Country Status (1)

Country Link
CN (1) CN106776401B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10650367B2 (en) * 2017-07-28 2020-05-12 Ncr Corporation Peer-to-peer (P2P) peripheral communication control
CN110177053A (en) * 2019-05-07 2019-08-27 中国工商银行股份有限公司 A kind of smart message sending method and device
CN111124716B (en) * 2019-12-26 2022-10-28 中国航空工业集团公司沈阳飞机设计研究所 Multi-priority queue message transmission method in unmanned aerial vehicle
CN111931042B (en) * 2020-07-13 2024-04-05 珠海格力电器股份有限公司 Information pushing method and device
CN111984901A (en) * 2020-08-31 2020-11-24 上海博泰悦臻电子设备制造有限公司 Message pushing method and related product thereof
CN114338499B (en) * 2021-12-29 2024-05-14 中国电信股份有限公司 Data transmission method, device and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102201988A (en) * 2011-05-12 2011-09-28 西北工业大学 Scheduling method of avionics full duplex switched Ethernet (AFDX) exchanger
CN103246653A (en) * 2012-02-03 2013-08-14 腾讯科技(深圳)有限公司 Data processing method and device
CN104753769A (en) * 2015-03-24 2015-07-01 新余兴邦信息产业有限公司 Method and device for issuing messages by message queue
CN105450511A (en) * 2015-12-23 2016-03-30 东软集团股份有限公司 Message scheduling method and device in vehicular ad hoc network VANET
CN105813032A (en) * 2016-03-11 2016-07-27 中国联合网络通信集团有限公司 Information sending method and server

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102201988A (en) * 2011-05-12 2011-09-28 西北工业大学 Scheduling method of avionics full duplex switched Ethernet (AFDX) exchanger
CN103246653A (en) * 2012-02-03 2013-08-14 腾讯科技(深圳)有限公司 Data processing method and device
CN104753769A (en) * 2015-03-24 2015-07-01 新余兴邦信息产业有限公司 Method and device for issuing messages by message queue
CN105450511A (en) * 2015-12-23 2016-03-30 东软集团股份有限公司 Message scheduling method and device in vehicular ad hoc network VANET
CN105813032A (en) * 2016-03-11 2016-07-27 中国联合网络通信集团有限公司 Information sending method and server

Also Published As

Publication number Publication date
CN106776401A (en) 2017-05-31

Similar Documents

Publication Publication Date Title
CN106776401B (en) Method for message transmission and device
CN107562769A (en) A kind of online answer topic recommends method and device
CN102981627A (en) Password inputting method and password inputting device
CN107729409A (en) A kind of short chain delivers a child into method and device
CN110516462A (en) Method and apparatus for encryption data
CN105337837A (en) Message transmitting method and device
CN106034120A (en) Method for multiple processes to access trusted application and system thereof
CN110069397A (en) Function test method, device, computer equipment and storage medium
US20240015186A1 (en) Methods and devices for establishing secure communication channels
CN106792699A (en) A kind of Wireless Fidelity Wi Fi connection methods and mobile terminal
CN108076126A (en) A kind of method of data synchronization and server
CN105635124B (en) Flow control methods and device
CN105592558A (en) Data transmission method, terminal and data transmission system
CN107305570A (en) A kind of data retrieval method and system
CN107359989A (en) Data ciphering method, safety chip and computer-readable recording medium
CN109905362A (en) User request detection method and device, computer equipment and storage medium
CN109246695A (en) Data transmission method, device and computer readable storage medium
CN103209113A (en) Method, facility, device and system for transmitting and receiving content information
CN107786308B (en) Data transmission method and terminal device
CN108023949A (en) dial-up networking method, system, intelligent terminal and server
CN104994160B (en) Document transmission method and relevant apparatus and Transmission system
CN109981251B (en) Random number sequence compression method and device and electronic equipment
CN107169032A (en) Database operation method and database server
CN106484426A (en) A kind of method of feedback search information, apparatus and system
CN106789602A (en) Speech play control method, terminal and mobile terminal

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