Gets the actual esp_netif pointer from the internal network interface list The supplied ordinal number could - point to a predef netif -> "STA", "AP", "ETH" - if no entry in the list (NULL) -> check if the system added this netif - point to a custom netif -> just return the entry in the list - users is responsible for the lifetime of this netif (to be valid between mdns-init -> deinit)
Duplicate a string with length limit.
Query mDNS for host or service Note that querying PTR types sends Multicast query, all other types send Unicast queries
This function is wait for modbus master request finish and return result. Waiting result include request process success, request respond timeout, receive data error and execute function error.You can use the above callback function.
This function is take Mobus Master running resource. Note:The resource is define by Operating System.
Function to set bits in a byte buffer. This function allows the efficient use of an array to implement bitfields. The array used for storing the bits must always be a multiple of two bytes. Up to eight bits can be set or cleared in one operation.
ucBits[2] = {0, 0};
// Set bit 4 to 1 (read: set 1 bit starting at bit offset 4 to value 1)
xMBUtilSetBits( ucBits, 4, 1, 1 );
// Set bit 7 to 1 and bit 8 to 0.
xMBUtilSetBits( ucBits, 7, 2, 0x01 );
// Set bits 8 - 11 to 0x05 and bits 12 - 15 to 0x0A;
xMBUtilSetBits( ucBits, 8, 8, 0x5A);
Allocate and zero memory.
This is modbus master user error handling funcion. If it is defined in the user application, then helps to handle the errors and received/sent buffers to transfer as well as handle the slave exception codes.
Function to read bits in a byte buffer. This function is used to extract up bit values from an array. Up to eight bit values can be extracted in one step.
UCHAR ucBits[2] = {0, 0};
UCHAR ucResult;
// Extract the bits 3 - 10.
ucResult = xMBUtilGetBits( ucBits, 3, 8 );
Allocate new answer and add it to answer list (destination)
Set/Add TXT item for service TXT record with hostname and txt value length
Callback function used if a Holding Register value is read or written by the protocol stack. The starting register address is given by \c usAddress and the last register is given by usAddress + usNRegs - 1.
Callback function used if a Holding Register value is read or written by the protocol stack. The starting register address is given by \c usAddress and the last register is given by usAddress + usNRegs - 1.
Set the hostname for mDNS server required if you want to advertise services
Set the default instance name for mDNS server
appends uint16_t in a packet, incrementing the index
The helper function to set data of parameters according to its type
Remove service from mDNS server with hostname
Set instance name for service with hostname
Set service port with hostname
Remove and free all services from mDNS server
Add service to mDNS server with a delegated hostname
Replace all TXT items for service with hostname
Remove TXT item for service TXT record with hostname
Free allocated memory for mDNS task.
Initialize mDNS on given interface
Set Modbus area descriptor
Callback function used if a Coil Register value is read or written by the protocol stack. If you are going to use this function you might use the functions xMBUtilSetBits( ) and xMBUtilGetBits( ) for working with bitfields.
Callback function used if a Coil Register value is read or written by the protocol stack. If you are going to use this function you might use the functions xMBUtilSetBits( ) and xMBUtilGetBits( ) for working with bitfields.
Browse mDNS for a service `_service._proto`.
Stop the `_service._proto` browse.
Add multiple subtypes for service at once.
Generic mDNS query All following query methods are derived from this one
Query mDNS for SRV record
Query mDNS for TXT record
Look up delegated services.
Look up self hosted services.
Stop and free mDNS server
Adds a hostname and address to be delegated A/AAAA queries will be replied for the hostname and services can be added to this host.
Remove a delegated hostname All the services added to this host will also be removed.
Set/Add TXT item for service TXT record with hostname
Add a subtype for service.
Query mDNS for A record Please note that hostname must not contain domain name, as mDNS uses '.local' domain.
Allocate memory for mDNS task.
Gets data pointer to the mDNS packet
sets uint16_t value in a packet
Initialize Modbus Master controller interface handle
This function will request read discrete inputs.
This function is release Modbus Master running resource. Note:The resource is define by Operating System. If you not use OS this function can be empty.
Release resources used by the protocol stack. This function disables the Modbus Master protocol stack and release all hardware resources. It must only be called when the protocol stack is disabled.
Enable the Modbus Master protocol stack. This function enables processing of Modbus Master frames. Enabling the protocol stack is only possible if it is in the disabled state.
Disable the Modbus Master protocol stack. This function disables processing of Modbus frames.
The main pooling loop of the Modbus Master protocol stack. This function must be called periodically. The timer interval required is given by the application dependent Modbus slave timeout. Internally the function calls xMBMasterPortEventGet() and waits for an event from the receiver or transmitter state machines.
This function will request read input register.
This function will request write holding register.
This function will request write multiple holding register.
This function will request read holding register.
This function will request read and write holding register.
This function will request read coil.
This function will request write one coil. @see eMBMasterReqWriteMultipleCoils
This function will request write multiple coils. @see eMBMasterReqWriteCoil
Enable the Modbus protocol stack. This function enables processing of Modbus frames. Enabling the protocol stack is only possible if it is in the disabled state.
Disable the Modbus protocol stack. This function disables processing of Modbus frames.
The main pooling loop of the Modbus protocol stack. This function must be called periodically. The timer interval required is given by the application dependent Modbus slave timeout. Internally the function calls xMBPortEventGet() and waits for an event from the receiver or transmitter state machines.
Initialize Modbus Slave controller interface handle
Initialize Modbus controller and stack
Initialize Modbus controller and stack for TCP slave
Create Modbus Master controller and stack for TCP port
Registers slave IP address
Remove service from mDNS server
appends byte in a packet, incrementing the index
read uint16_t from a packet
Add service to mDNS server
Set/Add TXT item for service TXT record
appends FQDN to a packet, incrementing the index and compressing the output if previous occurrence of the string (or part of it) has been found
Set/Add TXT item for service TXT record
Callback function used if a Input Discrete Register value is read by the protocol stack. If you are going to use his function you might use the functions xMBUtilSetBits( ) and xMBUtilGetBits( ) for working with bitfields.
#include "mb_m.h"
The protocol stack does not internally allocate any memory for the registers. This makes the protocol stack very small and also usable on low end targets. In addition the values don't have to be in the memory and could for example be stored in a flash. Whenever the protocol stack requires a value it calls one of the callback function with the register address and the number of registers to read as an argument. The application should then read the actual register values (for example the ADC voltage) and should store the result in the supplied buffer. If the protocol stack wants to update a register value because a write register function was received a buffer with the new register values is passed to the callback function. The function should then use these values to update the application register values. The common callback function used to transfer common data as bytes from command buffer in little endian format.
Callback function used if the value of a Input Register is required by the protocol stack. The starting register address is given by \c usAddress and the last register is given by usAddress + usNRegs - 1.
This is modbus master respond timeout error process callback function.
This is modbus master receive data error process callback function.
This is modbus master execute function error process callback function.
This is modbus master request process success callback function.
Initialize the Modbus Master protocol stack. This functions initializes the ASCII or RTU module and calls the init functions of the porting layer to prepare the hardware. Please note that the receiver is still disabled and no Modbus frames are processed until eMBMasterEnable( ) has been called.
Initialize the Modbus Master protocol stack for Modbus TCP. This function initializes the Modbus TCP Module. Please note that frame processing is still disabled until eMBEnable( ) is called.
These Modbus functions are called for user when Modbus run in Master Mode.
Initialize the Modbus protocol stack. This functions initializes the ASCII or RTU module and calls the init functions of the porting layer to prepare the hardware. Please note that the receiver is still disabled and no Modbus frames are processed until eMBEnable( ) has been called.
Initialize the Modbus protocol stack for Modbus TCP. This function initializes the Modbus TCP Module. Please note that frame processing is still disabled until eMBEnable( ) is called.
Release resources used by the protocol stack. This function disables the Modbus protocol stack and release all hardware resources. It must only be called when the protocol stack is disabled.
Configure the slave id of the device. This function should be called when the Modbus function Report Slave ID is enabled ( By defining MB_FUNC_OTHER_REP_SLAVEID_ENABLED in mbconfig.h ).
#include "mb.h"
The protocol stack does not internally allocate any memory for the registers. This makes the protocol stack very small and also usable on low end targets. In addition the values don't have to be in the memory and could for example be stored in a flash. Whenever the protocol stack requires a value it calls one of the callback function with the register address and the number of registers to read as an argument. The application should then read the actual register values (for example the ADC voltage) and should store the result in the supplied buffer. If the protocol stack wants to update a register value because a write register function was received a buffer with the new register values is passed to the callback function. The function should then use these values to update the application register values. Callback function used if the value of a Input Register is required by the protocol stack. The starting register address is given by \c usAddress and the last register is given by usAddress + usNRegs - 1.
Callback function used if a Input Discrete Register value is read by the protocol stack. If you are going to use his function you might use the functions xMBUtilSetBits( ) and xMBUtilGetBits( ) for working with bitfields.
Function to setup communication options for TCP/UDP Modbus port
Keeps FSM event handle and mask then wait for Master stack to start
Set network options for Master port
Check whether a service has been added.
Check whether a service has been added.
Set instance name for service
Replace all TXT items for service
Remove a subtype for service.
Update subtype for service.
Deletes the finished query. Call this only after the search has ended!
Get results from search pointer. Results available as a pointer to the output parameter. Pointer to search object has to be deleted via `mdns_query_async_delete` once the query has finished. The results although have to be freed manually.
Query mDNS for host or service asynchronousely. Search has to be tested for progress and deleted manually!
Get the hostname for mDNS server
Set the address to a delegated hostname
Query whether a hostname has been added
Remove TXT item for service TXT record
Register custom esp_netif with mDNS functionality mDNS service runs by default on preconfigured interfaces (STA, AP, ETH). This API enables running the service on any customized interface, either using standard WiFi or Ethernet driver or any kind of user defined driver.
Unregister esp-netif already registered in mDNS service
Set esp_netif to a desired state, or perform a desired action, such as enable/disable this interface or send announcement packets to this netif * This function is used to enable (probe, resolve conflicts and announce), announce, or disable (send bye) mDNS services on the specified network interface. * This function must be called if users registers a specific interface using mdns_register_netif() to enable mDNS services on that interface. * This function could be used in IP/connection event handlers to automatically enable/announce mDNS services when network properties change and/or disable them on disconnection.
Read parameter from modbus slave device whose name is defined by name and has cid. The additional data for request is taken from parameter description (lookup) table.
Free a browse item (Not free the list).
Start Modbus communication stack
Set Modbus communication parameters for the controller
Destroy Modbus controller and stack
Wait for specific event on parameter change.
Get parameter information
Specific interface functions ******************************************** Interface functions below provide basic methods to read/write access to slave devices in Modbus segment as well as API to read specific supported characteristics linked to Modbus parameters of devices in Modbus network. Assign parameter description table for Modbus controller interface.
Set characteristic's value defined as a name and cid parameter. The additional data for cid parameter request is taken from master parameter lookup table.
Set Modbus communication parameters for the controller
Start Modbus communication stack
Get information about supported characteristic defined as cid. Uses parameter description table to get this information. The function will check if characteristic defined as a cid parameter is supported and returns its description in param_info. Returns ESP_ERR_NOT_FOUND if characteristic is not supported.
Destroy Modbus controller and stack
Free search structure (except the results)
Send probe for particular services on particular PCB Tests possible duplication on probing service structure and probes only for new entries. - If pcb probing then add only non-probing services and restarts probing - If pcb not probing, run probing for all specified services
Get the service name of a service
Initialize Modbus Slave controller and stack for TCP port
Initialize Modbus Slave controller and stack for Serial port
Initialize Modbus controller and stack for TCP port
Initialize Modbus Master controller and stack for Serial port
appends answer type, class, ttl and data length to a packet, incrementing the index
Helper to get either ETH or STA if the other is provided Used when two interfaces are on the same subnet
Allocate new packet for sending
Send data request as defined in parameter request, waits response from slave and returns status of command execution. This function provides standard way for read/write access to Modbus devices in the network.
The helper function to expose transaction info from modbus layer
Registers a callback handler for a given function code. This function registers a new callback handler for a given function code. The callback handler supplied is responsible for interpreting the Modbus PDU and the creation of an appropriate response. In case of an error it should return one of the possible Modbus exceptions which results in a Modbus exception frame sent by the protocol stack.
Modbus master coils callback function.
Modbus master discrete callback function.
Modbus master input register callback function.
Modbus master holding register callback function.
Modbus master holding register callback function.
Modbus master coils callback function.
Modbus master discrete callback function.
Modbus master input register callback function.
Dispatch interface changes based on system events
Add result to browse, only add when the result is a new one.
Send by for particular services
Send probe on all active PCBs
Send announcement on all active PCBs
Removes saved question from parsed data
schedules a packet to be sent after given milliseconds
Find, remove and free answer from the scheduled packets
finds service from given service type
Called from parser to add PTR data to search result
Called from packet parser to find matching running search
Send announcement on particular PCB
Convert Predefined interface to esp-netif handle
Restart the responder on all active PCBs
Duplicate string or return error
Find, remove and free answers and scheduled packets for service
Check if the parsed name is self-hosted, i.e. we should resolve conflicts
reads and formats MDNS FQDN into mdns_name_t structure
Create linked IP (copy) from parsed one
Called from parser to add A/AAAA data to search result
Send PTR query packet to all available interfaces for browsing.
Called from parser to add A/AAAA data to search result
appends AAAA record to a packet, incrementing the index
Convert Predefined interface to the netif id from the internal netif list
Remove and free service answer from answer list (destination)
Check if the parsed name is ours (matches service or host name)
Create TXT result array from parsed TXT data
reads MDNS FQDN into mdns_name_t structure FQDN is in format: [hostname.|[instance.]_service._proto.]local.
Check if IPv6 address is NULL
clear packets scheduled for sending on a specific interface
appends A record to a packet, incrementing the index
Registers a callback handler for a given function code. This function registers a new callback handler for a given function code. The callback handler supplied is responsible for interpreting the Modbus PDU and the creation of an appropriate response. In case of an error it should return one of the possible Modbus exceptions which results in a Modbus exception frame sent by the protocol stack.
Allocate new search structure
Mark search as finished and remove it from search chain
Called from parser to finish any searches that have reached maximum results
Chain new IP to search result
Mark browse as finished, remove and free it from browse chain
Add new browse to the browse chain
Called from packet parser to find matching running search
Called from parser to add TXT data to search result
Called from parser to add SRV data to search result
Called from parser to add SRV data to search result
Called from parser to add TXT data to search result
Send search packet to particular interface
appends one TXT record ("key=value" or "key")
Send by for particular services on particular PCB
Send probe for additional services on particular PCB
Send bye for particular subtypes
Stop the responder on all services without instance
Restart the responder on all services without instance
creates/allocates new text item list
Deallocate the txt linked list
Set interface as duplicate if another is found on the same subnet
Check if parsed name is discovery
Called from parser to check if question matches particular service
appends PTR record for service to a packet, incrementing the index
appends PTR record for a subtype to a packet, incrementing the index
Check if interface is duplicate (two interfaces on the same subnet)
Browse sync result action
Allocate new browse structure
free all packets scheduled for sending
Remove and free answer from answer list (destination)
Check if question is already in the list
the receive callback of the raw udp api. Packets are received here
Low level UDP Multicast membership control
Add new search to the search chain
Create search packet for particular interface
Send search packet to all available interfaces
Convert probe packet to announce
Restart the responder on particular PCB
Restart the responder on all active PCBs
Append question to packet
appends DNS-SD PTR record for service to a packet, incrementing the index
appends TXT record for service to a packet, incrementing the index
Called from service thread to execute given action
Called from timer task to run mDNS responder periodically checks first unqueued packet (from tx head). if it is scheduled to be transmitted, then pushes the packet to action queue to be handled.
Called from timer task to run active searches
the main MDNS service task. Packets are received and parsed here
Start the service thread if not running
creates/allocates new service
Detect IPv4 address collision
Detect IPv6 address collision
Adds a delegated hostname to the linked list
read uint32_t from a packet
Get number of items in TXT parsed data
Get the length of TXT item's key name
appends uint32_t in a packet, incrementing the index
appends single string to a packet, incrementing the index
Append PTR answers to packet
Performs interface changes based on system events or custom commands
get the next packet scheduled for sending on a specific interface
Create answer packet to questions from parsed packet
Create probe packet for particular services on particular PCB
Create announce packet for particular services on particular PCB
appends SRV record for service to a packet, incrementing the index
Low level UDP PCB Initialize
Check if any of the interfaces is up
Start PCB from LwIP thread
Stop PCB from LwIP thread