10524a6a8Smahlzeit/*! 26ac7032dSJohn Scipione \mainpage Welcome to the Haiku Book 36ac7032dSJohn Scipione 46ac7032dSJohn Scipione Below you will find documentation on the Application Programming 56ac7032dSJohn Scipione Interface (API) of the Haiku operating system. This API describes 66ac7032dSJohn Scipione the internals of the operating system allowing developers to write 76ac7032dSJohn Scipione native C++ applications and device drivers. See the 81de2d728SAugustin Cavalier <a href="https://api.haiku-os.org">online version</a> for the most 96ac7032dSJohn Scipione updated version of this document. If you would like to help contribute 104d556706SAugustin Cavalier contact the <a href="https://www.freelists.org/list/haiku-doc">documentation 116ac7032dSJohn Scipione mailing list</a>. For guidelines on how to help document the API see 126ac7032dSJohn Scipione the \link apidoc Documenting the API\endlink page. A list of 136ac7032dSJohn Scipione contributors can be found \ref credits page. Documenting the API is 146ac7032dSJohn Scipione an ongoing process so contributions are greatly appreciated. 156ac7032dSJohn Scipione 166ac7032dSJohn Scipione The Haiku API is based on the BeOS R5 API but changes and additions have 176ac7032dSJohn Scipione been included where appropriate. Important compatibility differences are 186ac7032dSJohn Scipione detailed on the \ref compatibility page. New classes and methods 196ac7032dSJohn Scipione and incompatible API changes to the BeOS R5 API are noted in the 206ac7032dSJohn Scipione appropriate sections. 216ac7032dSJohn Scipione 226ac7032dSJohn Scipione A complete reference to the BeOS R5 API is available on the web in 231de2d728SAugustin Cavalier <a href="https://haiku-os.org/legacy-docs/bebook/">The Be Book</a>. 246ac7032dSJohn Scipione The Be Book is used with permission from 254d556706SAugustin Cavalier <a href="https://www.access-company.com/">Access Co.</a>, the current 266ac7032dSJohn Scipione owners of Be's intellectual property. 270524a6a8Smahlzeit 281e994bc7SJohn Scipione \section book_kits Kits and Servers 290524a6a8Smahlzeit 306ac7032dSJohn Scipione The API is split into several kits and servers each detailing a different 316ac7032dSJohn Scipione aspect of the operating system. 326ac7032dSJohn Scipione - The \ref app is the starting point for developing applications 336ac7032dSJohn Scipione and includes classes for messaging and for interacting with 346ac7032dSJohn Scipione the rest of the system. 358786818cSJohn Scipione - The \ref game provides classes for producing game sounds and 368786818cSJohn Scipione working with full screen apps. 376ac7032dSJohn Scipione - The \ref interface is used to create responsive and attractive 386ac7032dSJohn Scipione graphical user interfaces building on the messaging facilities 396ac7032dSJohn Scipione provided by the Application Kit. 40f122405dSAdrien Destugues - A \link interface_intro general introduction \endlink to the 41f122405dSAdrien Destugues Interface Kit. 426ac7032dSJohn Scipione - The \link layout_intro Layout API \endlink is a new addition 436ac7032dSJohn Scipione to the Interface Kit in Haiku which provides resources to 446ac7032dSJohn Scipione layout your application flexibly and easily. 456ac7032dSJohn Scipione - The \ref locale includes classes to localize your application to 466ac7032dSJohn Scipione different languages, timezones, number formatting conventions and 476ac7032dSJohn Scipione much more. 4895c9effdSAugustin Cavalier - The \ref mail includes classes to work with e-mail files, folders, 4995c9effdSAugustin Cavalier protocols, and filters, as part of Haiku's unique mail handling system. 506ac7032dSJohn Scipione - The \ref media provides a unified and consistent interface for media 516ac7032dSJohn Scipione streams and applications to intercommunicate. 526ac7032dSJohn Scipione - The \ref midi2 describes an interface to generating, processing, 536ac7032dSJohn Scipione and playing music in MIDI format. For reference documentation on the 546ac7032dSJohn Scipione \ref midi1 is also included. 554cf62172SAdrien Destugues - The \ref network handles everything network related, from interface 564cf62172SAdrien Destugues IP address settings to HTTP connections. 576ac7032dSJohn Scipione - The \ref storage is a collection of classes that deal with storing and 586ac7032dSJohn Scipione retrieving information from disk. 596ac7032dSJohn Scipione - The \ref support contains support classes to use in your application 606ac7032dSJohn Scipione including resources for thread safety, IO, and serialization. 613528f5bbSJohn Scipione - The \ref translation provides a framework for converting data streams 623528f5bbSJohn Scipione between media formats. 6389e18a51SNiels Sascha Reedijk 641e994bc7SJohn Scipione \section book_special_topics Special Topics 656ac7032dSJohn Scipione 66b966e837SAdrien Destugues - \ref libroot 676ac7032dSJohn Scipione - \ref drivers 684466b89cSJohn Scipione - \ref keyboard 69f943fa46SAndrew Lindesay - \ref json 70094b8dcfSNiels Sascha Reedijk - \ref netservices 71d419ca3bSNiels Sascha Reedijk*/ 72d419ca3bSNiels Sascha Reedijk 739889ca4aSNiels Sascha Reedijk///// Define main kits ///// 7489e18a51SNiels Sascha Reedijk 75d419ca3bSNiels Sascha Reedijk/*! 76bef614efSNiels Sascha Reedijk \defgroup app Application Kit 776ac7032dSJohn Scipione \brief The Application Kit is the starting point for writing native Haiku 786ac7032dSJohn Scipione GUI applications. 796ac7032dSJohn Scipione 806ac7032dSJohn Scipione The application kit is exactly what its name suggests — it is the 816ac7032dSJohn Scipione basis of Haiku applications. You should first read through this document 826ac7032dSJohn Scipione and the references here before moving on to the other parts of the API. 836ac7032dSJohn Scipione 846ac7032dSJohn Scipione The Application Kit classes can be divided into two groups: the messaging 856ac7032dSJohn Scipione classes and the system interaction classes. The larger of the two groups is 866ac7032dSJohn Scipione the messaging classes. Since the Haiku API relies on pervasive 876ac7032dSJohn Scipione multithreading messaging is an essential topic for any application. Have a 886ac7032dSJohn Scipione look at the \link app_messaging Introduction to Messaging \endlink for more 896ac7032dSJohn Scipione information. 906ac7032dSJohn Scipione 916ac7032dSJohn Scipione The following messaging classes which allow you to easily and securely 926ac7032dSJohn Scipione communicate between threads. 936ac7032dSJohn Scipione - BHandler 946ac7032dSJohn Scipione - BInvoker 956ac7032dSJohn Scipione - BLooper 966ac7032dSJohn Scipione - BMessage 976ac7032dSJohn Scipione - BMessageFilter 986ac7032dSJohn Scipione - BMessageQueue 996ac7032dSJohn Scipione - BMessageRunner 1006ac7032dSJohn Scipione - BMessenger 1016ac7032dSJohn Scipione 1026ac7032dSJohn Scipione The second group is the system interaction classes. These classes 1036ac7032dSJohn Scipione provide hooks for your application to interact with the rest of the system. 1046ac7032dSJohn Scipione The most important class in this group is BApplication. Below is a list of 1056ac7032dSJohn Scipione all system interaction classes: 1066ac7032dSJohn Scipione - BApplication 1076ac7032dSJohn Scipione - BClipboard 1086ac7032dSJohn Scipione - BCursor 1090e6f9572SNiels Sascha Reedijk - BLaunchRoster 1100e6f9572SNiels Sascha Reedijk - BNotification 1116ac7032dSJohn Scipione - BPropertyInfo 1126ac7032dSJohn Scipione - BRoster 1136ac7032dSJohn Scipione 1140e6f9572SNiels Sascha Reedijk A third special category is the \link app_keystore Password and Key storage 1150e6f9572SNiels Sascha Reedijk API:\endlink 1160e6f9572SNiels Sascha Reedijk - BKey 1170e6f9572SNiels Sascha Reedijk - BKeyStore 1180e6f9572SNiels Sascha Reedijk 1196ac7032dSJohn Scipione 1208786818cSJohn Scipione \defgroup game Game Kit 1218786818cSJohn Scipione \brief The Game Kit provides classes for producing game sounds and 1228786818cSJohn Scipione working with full screen apps. 1238786818cSJohn Scipione 1248786818cSJohn Scipione 125cc19e7c0SAlex Wilson \defgroup interface Interface Kit 126cc19e7c0SAlex Wilson \brief API for displaying a graphical user interface. 1276ac7032dSJohn Scipione 1280a4e27c5SAdrien Destugues \defgroup locale Locale Kit 129c6247544SAdrien Destugues \brief Collection of classes for localizing applications. 1306ac7032dSJohn Scipione 13195c9effdSAugustin Cavalier \defgroup mail Mail Kit 13295c9effdSAugustin Cavalier \brief API for working with e-mail messages and protocols. 13395c9effdSAugustin Cavalier 1346ac7032dSJohn Scipione \defgroup media Media Kit 1356ac7032dSJohn Scipione \brief Collection of classes that deal with audio and video. 1366ac7032dSJohn Scipione 1376ac7032dSJohn Scipione \defgroup midi1 The old MIDI Kit (libmidi.so) 1386ac7032dSJohn Scipione \brief The old MIDI kit. 1396ac7032dSJohn Scipione 1406ac7032dSJohn Scipione 1416ac7032dSJohn Scipione \defgroup midi2 MIDI 2 Kit 1426ac7032dSJohn Scipione \brief The Midi Kit is the API that implements support for generating, 1436ac7032dSJohn Scipione processing, and playing music in MIDI format. 1446ac7032dSJohn Scipione 1454d556706SAugustin Cavalier <A HREF="https://www.midi.org/">MIDI</A>, which stands for 'Musical 1466ac7032dSJohn Scipione Instrument Digital Interface', is a well-established standard for 1476ac7032dSJohn Scipione representing and communicating musical data. This document serves as 1486ac7032dSJohn Scipione an overview. If you would like to see all the components, please look 1496ac7032dSJohn Scipione at \link midi2 the list with classes \endlink. 1506ac7032dSJohn Scipione 1511e994bc7SJohn Scipione \section book_midi2twokits A Tale of Two MIDI Kits 1526ac7032dSJohn Scipione 1536ac7032dSJohn Scipione BeOS comes with two different, but compatible Midi Kits. This 1546ac7032dSJohn Scipione documentation focuses on the "new" Midi Kit, or midi2 as we like to 1556ac7032dSJohn Scipione call it, that was introduced with BeOS R5. The old kit, which we'll 1566ac7032dSJohn Scipione refer to as midi1, is more complete than the new kit, but less powerful. 1576ac7032dSJohn Scipione 1586ac7032dSJohn Scipione Both kits let you create so-called MIDI endpoints, but the endpoints 1596ac7032dSJohn Scipione from midi1 cannot be shared between different applications. The midi2 1606ac7032dSJohn Scipione kit solves that problem, but unlike midi1 it does not include a General 1616ac7032dSJohn Scipione MIDI softsynth, nor does it have a facility for reading and playing 1626ac7032dSJohn Scipione Standard MIDI Files. Don't worry: both kits are compatible and you can 1636ac7032dSJohn Scipione mix-and-match them in your applications. 1646ac7032dSJohn Scipione 1656ac7032dSJohn Scipione The main differences between the two kits: 1666ac7032dSJohn Scipione - Instead of one BMidi object that both produces and consumes events, 1676ac7032dSJohn Scipione we have BMidiProducer and BMidiConsumer. 1686ac7032dSJohn Scipione - Applications are capable of sharing MIDI producers and consumers 1696ac7032dSJohn Scipione with other applications via the centralized Midi Roster. 1706ac7032dSJohn Scipione - Physical MIDI ports are now sharable without apps "stealing" events 1716ac7032dSJohn Scipione from each other. 1726ac7032dSJohn Scipione - Applications can now send/receive raw MIDI byte streams (useful if 1736ac7032dSJohn Scipione an application has its own MIDI parser/engine). 1746ac7032dSJohn Scipione - Channels are numbered 0–15, not 1–16 1756ac7032dSJohn Scipione - Timing is now specified in microseconds rather than milliseconds. 1766ac7032dSJohn Scipione 1771e994bc7SJohn Scipione \section book_midi2concepts Midi Kit Concepts 1786ac7032dSJohn Scipione 1796ac7032dSJohn Scipione A brief overview of the elements that comprise the Midi Kit: 1806ac7032dSJohn Scipione - \b Endpoints. This is what the Midi Kit is all about: sending MIDI 1816ac7032dSJohn Scipione messages between endpoints. An endpoint is like a MIDI In or MIDI 1826ac7032dSJohn Scipione Out socket on your equipment; it either receives information or it 1836ac7032dSJohn Scipione sends information. Endpoints that send MIDI events are called 1846ac7032dSJohn Scipione \b producers; the endpoints that receive those events are called 1856ac7032dSJohn Scipione \b consumers. An endpoint that is created by your own application 1866ac7032dSJohn Scipione is called \b local; endpoints from other applications are 1876ac7032dSJohn Scipione \b remote. You can access remote endpoints using \b proxies. 1886ac7032dSJohn Scipione - \b Filters. A filter is an object that has a consumer and a producer 1896ac7032dSJohn Scipione endpoint. It reads incoming events from its consumer, performs some 1906ac7032dSJohn Scipione operation, and tells its producer to send out the results. In its 1916ac7032dSJohn Scipione current form, the Midi Kit doesn't provide any special facilities 1926ac7032dSJohn Scipione for writing filters. 1936ac7032dSJohn Scipione - \b Midi \b Roster. The roster is the list of all published producers 1946ac7032dSJohn Scipione and consumers. By publishing an endpoint, you allow other 1956ac7032dSJohn Scipione applications to talk to it. You are not required to publish your 1966ac7032dSJohn Scipione endpoints, in which case only your own application can use them. 1976ac7032dSJohn Scipione - \b Midi \b Server. The Midi Server does the behind-the-scenes work. 1986ac7032dSJohn Scipione It manages the roster, it connects endpoints, it makes sure that 1996ac7032dSJohn Scipione endpoints can communicate, and so on. The Midi Server is started 2006ac7032dSJohn Scipione automatically when BeOS boots, and you never have to deal with it 2016ac7032dSJohn Scipione directly. Just remember that it runs the show. 2026ac7032dSJohn Scipione - \b libmidi. The BMidi* classes live inside two shared libraries: 2036ac7032dSJohn Scipione libmidi.so and libmidi2.so. If you write an application that uses 2046ac7032dSJohn Scipione old Midi Kit, you must link it to libmidi.so. Applications that use 2056ac7032dSJohn Scipione the new Midi Kit must link to libmidi2.so. If you want to 2066ac7032dSJohn Scipione mix-and-match both kits, you should also link to both libraries. 2076ac7032dSJohn Scipione 2086ac7032dSJohn Scipione Here is a pretty picture: 2096ac7032dSJohn Scipione 2106ac7032dSJohn Scipione \image html midi2concepts.png 2116ac7032dSJohn Scipione 2121e994bc7SJohn Scipione \section book_midi2mediakit Midi Kit != Media Kit 2136ac7032dSJohn Scipione 2146ac7032dSJohn Scipione Be chose not to integrate the Midi Kit into the Media Kit as another media 2156ac7032dSJohn Scipione type, mainly because MIDI doesn't require any of the format negotiation that 2166ac7032dSJohn Scipione other media types need. Although the two kits look similar -- both have a 2176ac7032dSJohn Scipione "roster" for finding or registering "consumers" and "producers" -- there are 2186ac7032dSJohn Scipione some very important differences. 2196ac7032dSJohn Scipione 2206ac7032dSJohn Scipione The first and most important point to note is that BMidiConsumer and 2216ac7032dSJohn Scipione BMidiProducer in the Midi Kit are \b NOT directly analogous to 2226ac7032dSJohn Scipione BBufferConsumer and BBufferProducer in the Media Kit! In the Media Kit, 2236ac7032dSJohn Scipione consumers and producers are the data consuming and producing properties 2246ac7032dSJohn Scipione of a media node. A filter in the Media Kit, therefore, inherits from both 2256ac7032dSJohn Scipione BBufferConsumer and BBufferProducer, and implements their virtual member 2266ac7032dSJohn Scipione functions to do its work. 2276ac7032dSJohn Scipione 2286ac7032dSJohn Scipione In the Midi Kit, consumers and producers act as endpoints of MIDI data 2296ac7032dSJohn Scipione connections, much as media_source and media_destination do in the Media Kit. 2306ac7032dSJohn Scipione Thus, a MIDI filter does not derive from BMidiConsumer and BMidiProducer; 2316ac7032dSJohn Scipione instead, it contains BMidiConsumer and BMidiProducer objects for each of its 2326ac7032dSJohn Scipione distinct endpoints that connect to other MIDI objects. The Midi Kit does not 2336ac7032dSJohn Scipione allow the use of multiple virtual inheritance, so you can't create an object 2346ac7032dSJohn Scipione that's both a BMidiConsumer and a BMidiProducer. 2356ac7032dSJohn Scipione 2366ac7032dSJohn Scipione This also contrasts with the old Midi Kit's conception of a BMidi object, 2376ac7032dSJohn Scipione which stood for an object that both received and sent MIDI data. In the new 2386ac7032dSJohn Scipione Midi Kit, the endpoints of MIDI connections are all that matters. What lies 2396ac7032dSJohn Scipione between the endpoints, i.e. how a MIDI filter is actually structured, is 2406ac7032dSJohn Scipione entirely at your discretion. 2416ac7032dSJohn Scipione 2426ac7032dSJohn Scipione Also, rather than use token structs like media_node to make connections 2436ac7032dSJohn Scipione via the MediaRoster, the new kit makes the connections directly via the 2446ac7032dSJohn Scipione BMidiProducer object. 2456ac7032dSJohn Scipione 2461e994bc7SJohn Scipione \section book_midi2remotelocal Remote vs. Local Objects 2476ac7032dSJohn Scipione 2486ac7032dSJohn Scipione The Midi Kit makes a distinction between remote and local MIDI objects. 2496ac7032dSJohn Scipione You can only create local MIDI endpoints, which derive from either 2506ac7032dSJohn Scipione BMidiLocalConsumer or BMidiLocalProducer. Remote endpoints are endpoints 2516ac7032dSJohn Scipione that live in other applications, and you access them through BMidiRoster. 2526ac7032dSJohn Scipione 2536ac7032dSJohn Scipione BMidiRoster only gives you access to BMidiEndpoints, BMidiConsumers, and 2546ac7032dSJohn Scipione BMidiProducers. When you want to talk to remote MIDI objects, you do so 2556ac7032dSJohn Scipione through the proxy objects that BMidiRoster provides. Unlike 2566ac7032dSJohn Scipione BMidiLocalConsumer and BMidiLocalProducer, these classes do not provide a 2576ac7032dSJohn Scipione lot of functions. That is intentional. In order to hide the details of 2586ac7032dSJohn Scipione communication with MIDI endpoints in other applications, the Midi Kit must 2596ac7032dSJohn Scipione hide the details of how a particular endpoint is implemented. 2606ac7032dSJohn Scipione 2616ac7032dSJohn Scipione So what can you do with remote objects? Only what BMidiConsumer, 2626ac7032dSJohn Scipione BMidiProducer, and BMidiEndpoint will let you do. You can connect 2636ac7032dSJohn Scipione objects, get the properties of these objects -- and that's about it. 2646ac7032dSJohn Scipione 2651e994bc7SJohn Scipione \section book_midi2lifespan Creating and Destroying Objects 2666ac7032dSJohn Scipione 2676ac7032dSJohn Scipione The constructors and destructors of most midi2 classes are private, 2686ac7032dSJohn Scipione which means that you cannot directly create them using the C++ 2696ac7032dSJohn Scipione <CODE>new</CODE> operator, on the stack, or as globals. Nor can you 2706ac7032dSJohn Scipione <CODE>delete</CODE> them. Instead, these objects are obtained through 2716ac7032dSJohn Scipione BMidiRoster. The only two exceptions to this rule are BMidiLocalConsumer 2726ac7032dSJohn Scipione and BMidiLocalProducer. These two objects may be directly created and 2736ac7032dSJohn Scipione subclassed by developers. 2746ac7032dSJohn Scipione 2751e994bc7SJohn Scipione \section book_midi2refcount Reference Counting 2766ac7032dSJohn Scipione 2776ac7032dSJohn Scipione Each MIDI endpoint has a reference count associated with it, so that 2786ac7032dSJohn Scipione the Midi Roster can do proper bookkeeping. When you construct a 2796ac7032dSJohn Scipione BMidiLocalProducer or BMidiLocalConsumer endpoint, it starts with a 2806ac7032dSJohn Scipione reference count of 1. In addition, BMidiRoster increments the reference 2816ac7032dSJohn Scipione count of any object it hands to you as a result of 2826ac7032dSJohn Scipione \link BMidiRoster::NextEndpoint() NextEndpoint() \endlink or 2836ac7032dSJohn Scipione \link BMidiRoster::FindEndpoint() FindEndpoint() \endlink. 2846ac7032dSJohn Scipione Once the count hits 0, the endpoint will be deleted. 2856ac7032dSJohn Scipione 2866ac7032dSJohn Scipione This means that, to delete an endpoint, you don't call the 2876ac7032dSJohn Scipione <CODE>delete</CODE> operator directly; instead, you call 2886ac7032dSJohn Scipione \link BMidiEndpoint::Release() Release() \endlink. 2896ac7032dSJohn Scipione To balance this call, there's also an 2906ac7032dSJohn Scipione \link BMidiEndpoint::Acquire() Acquire() \endlink, in case you have two 2916ac7032dSJohn Scipione disparate parts of your application working with the endpoint, and you 2926ac7032dSJohn Scipione don't want to have to keep track of who needs to Release() the endpoint. 2936ac7032dSJohn Scipione 2946ac7032dSJohn Scipione When you're done with any endpoint object, you must Release() it. 2956ac7032dSJohn Scipione This is true for both local and remote objects. Repeat after me: 2966ac7032dSJohn Scipione Release() when you're done. 2976ac7032dSJohn Scipione 2981e994bc7SJohn Scipione \section book_midi2events MIDI Events 2996ac7032dSJohn Scipione 3006ac7032dSJohn Scipione To make some actual music, you need to 3016ac7032dSJohn Scipione \link BMidiProducer::Connect() Connect() \endlink your consumers to 3026ac7032dSJohn Scipione your producers. Then you tell the producer to "spray" MIDI events to all 3036ac7032dSJohn Scipione the connected consumers. The consumers are notified of these incoming 3046ac7032dSJohn Scipione events through a set of hook functions. 3056ac7032dSJohn Scipione 3066ac7032dSJohn Scipione The Midi Kit already provides a set of commonly used spray functions, 3076ac7032dSJohn Scipione such as \link BMidiLocalProducer::SprayNoteOn() SprayNoteOn() \endlink, 3086ac7032dSJohn Scipione \link BMidiLocalProducer::SprayControlChange() SprayControlChange() 3096ac7032dSJohn Scipione \endlink, and so on. These correspond one-to-one with the message types 3106ac7032dSJohn Scipione from the MIDI spec. You don't need to be a MIDI expert to use the kit, but 3116ac7032dSJohn Scipione of course some knowledge of the protocol helps. If you are really hardcore, 3126ac7032dSJohn Scipione you can also use the 3136ac7032dSJohn Scipione \link BMidiLocalProducer::SprayData() SprayData() \endlink to send raw MIDI 3146ac7032dSJohn Scipione events to the consumers. 3156ac7032dSJohn Scipione 3166ac7032dSJohn Scipione At the consumer side, a dedicated thread invokes a hook function for every 3176ac7032dSJohn Scipione incoming MIDI event. For every spray function, there is a corresponding hook 3186ac7032dSJohn Scipione function, e.g. \link BMidiLocalConsumer::NoteOn() NoteOn() \endlink and 3196ac7032dSJohn Scipione \link BMidiLocalConsumer::ControlChange() ControlChange() \endlink. 3206ac7032dSJohn Scipione The hardcore MIDI fanatics among you will be pleased to know that you can 3216ac7032dSJohn Scipione also tap into the \link BMidiLocalConsumer::Data() Data() \endlink hook and 3226ac7032dSJohn Scipione get your hands dirty with the raw MIDI data. 3236ac7032dSJohn Scipione 3241e994bc7SJohn Scipione \section book_midi2time Time 3256ac7032dSJohn Scipione 3266ac7032dSJohn Scipione The spray and hook functions accept a bigtime_t parameter named "time". This 3276ac7032dSJohn Scipione indicates when the MIDI event should be performed. The time is given in 3286ac7032dSJohn Scipione microseconds since the computer booted. To get the current tick measurement, 3296ac7032dSJohn Scipione you call the system_time() function from the Kernel Kit. 3306ac7032dSJohn Scipione 3316ac7032dSJohn Scipione If you override a hook function in one of your consumer objects, it should 3326ac7032dSJohn Scipione look at the time argument, wait until the designated time, and then perform 3336ac7032dSJohn Scipione its action. The preferred method is to use the Kernel Kit's 3346ac7032dSJohn Scipione <CODE>snooze_until()</CODE> function, which sends the consumer thread to 3356ac7032dSJohn Scipione sleep until the requested time has come. (Or, if the time has already 3366ac7032dSJohn Scipione passed, returns immediately.) 3376ac7032dSJohn Scipione 3386ac7032dSJohn Scipione Like this: 3396ac7032dSJohn Scipione 3406ac7032dSJohn Scipione \code 3416ac7032dSJohn Scipionevoid MyConsumer::NoteOn( 3426ac7032dSJohn Scipione uchar channel, uchar note, uchar velocity, bigtime_t time) 3436ac7032dSJohn Scipione{ 3446ac7032dSJohn Scipione snooze_until(time, B_SYSTEM_TIMEBASE); 3456ac7032dSJohn Scipione ...do your thing... 3466ac7032dSJohn Scipione} 3476ac7032dSJohn Scipione \endcode 3486ac7032dSJohn Scipione 3496ac7032dSJohn Scipione If you want your producers to run in real time, i.e. they produce MIDI data 3506ac7032dSJohn Scipione that needs to be performed immediately, you should pass time 0 to the spray 3516ac7032dSJohn Scipione functions (which also happens to be the default value). Since time 0 has 3526ac7032dSJohn Scipione already passed, <CODE>snooze_until()</CODE> returns immediately, and the 3536ac7032dSJohn Scipione consumer will process the events as soon as they are received. 3546ac7032dSJohn Scipione 3556ac7032dSJohn Scipione To schedule MIDI events for a performance time that lies somewhere in the 3566ac7032dSJohn Scipione future, the producer must take into account the consumer's latency. 3576ac7032dSJohn Scipione Producers should attempt to get notes to the consumer by or before 3586ac7032dSJohn Scipione <I>(scheduled_performance_time - latency)</I>. The time argument is still 3596ac7032dSJohn Scipione the scheduled performance time, so if your consumer has latency, it should 3606ac7032dSJohn Scipione snooze like this before it starts to perform the events: 3616ac7032dSJohn Scipione 3626ac7032dSJohn Scipione \code 3636ac7032dSJohn Scipionesnooze_until(time - Latency(), B_SYSTEM_TIMEBASE); 3646ac7032dSJohn Scipione \endcode 3656ac7032dSJohn Scipione 3666ac7032dSJohn Scipione Note that a typical producer sends out its events as soon as it can; 3676ac7032dSJohn Scipione unlike a consumer, it does not have to snooze. 3686ac7032dSJohn Scipione 3691e994bc7SJohn Scipione \section book_midi2ports Other Timing Issues 3706ac7032dSJohn Scipione 3716ac7032dSJohn Scipione Each consumer object uses a Kernel Kit port to receive MIDI events from 3726ac7032dSJohn Scipione connected producers. The queue for this port is only 1 message deep. 3736ac7032dSJohn Scipione This means that if the consumer thread is asleep in a 3746ac7032dSJohn Scipione <CODE>snooze_until()</CODE>, it will not read its port. Consequently, 3756ac7032dSJohn Scipione any producer that tries to write a new event to this port will block until 3766ac7032dSJohn Scipione the consumer thread is ready to receive a new message. This is intentional, 3776ac7032dSJohn Scipione because it prevents producers from generating and queueing up thousands of 3786ac7032dSJohn Scipione events. 3796ac7032dSJohn Scipione 3806ac7032dSJohn Scipione This mechanism, while simple, puts on the producer the responsibility 3816ac7032dSJohn Scipione for sorting the events in time. Suppose your producer sends three Note 3826ac7032dSJohn Scipione On events, the first on t + 0, the second on t + 4, and the third on t + 2. 3836ac7032dSJohn Scipione This last event won't be received until after t + 4, so it will be two ticks 3846ac7032dSJohn Scipione too late. If this sort of thing can happen with your producer, you should 3856ac7032dSJohn Scipione somehow sort the events before you spray them. Of course, if you have two or 3866ac7032dSJohn Scipione more producers connected to the same consumer, it is nearly impossible to 3876ac7032dSJohn Scipione sort this all out (pardon the pun). So it is not wise to send the same kinds 3886ac7032dSJohn Scipione of events from more than one producer to one consumer at the same time. 3896ac7032dSJohn Scipione 3906ac7032dSJohn Scipione The article Introduction to MIDI, Part 2 in <A 3914d556706SAugustin Cavalier HREF="https://open-beos.sourceforge.net/nsl.php?mode=display&id=36">OpenBeOS 3926ac7032dSJohn Scipione Newsletter 36</A> describes this problem in more detail, and provides a 3936ac7032dSJohn Scipione solution. Go read it now! 3946ac7032dSJohn Scipione 3951e994bc7SJohn Scipione \section book_midi2filters Writing a Filter 3966ac7032dSJohn Scipione 3976ac7032dSJohn Scipione A typical filter contains a consumer and a producer endpoint. It receives 3986ac7032dSJohn Scipione events from the consumer, processes them, and sends them out again using the 3996ac7032dSJohn Scipione producer. The consumer endpoint is a subclass of BMidiLocalConsumer, whereas 4006ac7032dSJohn Scipione the producer is simply a BMidiLocalProducer, not a subclass. This is a 4016ac7032dSJohn Scipione common configuration, because consumers work by overriding the event hooks 4026ac7032dSJohn Scipione to do work when MIDI data arrives. Producers work by sending an event when 4036ac7032dSJohn Scipione you call their member functions. You should hardly ever need to derive from 4046ac7032dSJohn Scipione BMidiLocalProducer (unless you need to know when the producer gets connected 4056ac7032dSJohn Scipione or disconnected, perhaps), but you'll always have to override one or more of 4066ac7032dSJohn Scipione BMidiLocalConsumer's member functions to do something useful with incoming 4076ac7032dSJohn Scipione data. 4086ac7032dSJohn Scipione 4096ac7032dSJohn Scipione Filters should ignore the time argument from the spray and hook functions, 4106ac7032dSJohn Scipione and simply pass it on unchanged. Objects that only filter data should 4116ac7032dSJohn Scipione process the event as quickly as possible and be done with it. Do not 4126ac7032dSJohn Scipione <CODE>snooze_until()</CODE> in the consumer endpoint of a filter! 4136ac7032dSJohn Scipione 4141e994bc7SJohn Scipione \section book_midi2apidiffs API Differences 4156ac7032dSJohn Scipione 4166ac7032dSJohn Scipione As far as the end user is concerned, the Haiku Midi Kit is mostly the same 4176ac7032dSJohn Scipione as the BeOS R5 kits, although there are a few small differences in the API 4186ac7032dSJohn Scipione (mostly bug fixes): 4196ac7032dSJohn Scipione - BMidiEndpoint::IsPersistent() always returns false. 4206ac7032dSJohn Scipione - The B_MIDI_CHANGE_LATENCY notification is now properly sent. The Be 4216ac7032dSJohn Scipione kit incorrectly set be:op to B_MIDI_CHANGED_NAME, even though the 4226ac7032dSJohn Scipione rest of the message was properly structured. 4236ac7032dSJohn Scipione - If creating a local endpoint fails, you can still Release() the object 4246ac7032dSJohn Scipione without crashing into the debugger. 4256ac7032dSJohn Scipione 4261e994bc7SJohn Scipione \section book_midi2seealso See also 4276ac7032dSJohn Scipione 4286ac7032dSJohn Scipione More about the Midi Kit: 4296ac7032dSJohn Scipione - \ref Midi2Defs.h 4306ac7032dSJohn Scipione - Be Newsletter Volume 3, Issue 47 - Motor Mix sample code 4316ac7032dSJohn Scipione - Be Newsletter Volume 4, Issue 3 - Overview of the new kit 4324d556706SAugustin Cavalier - <A HREF="https://haiku-os.org/documents/dev/introduction_to_midi_part_1">Newsletter 4336ac7032dSJohn Scipione 33</A>, Introduction to MIDI, Part 1 4344d556706SAugustin Cavalier - <A HREF="https://haiku-os.org/documents/dev/introduction_to_midi_part_2">Newsletter 4356ac7032dSJohn Scipione 36</A>, Introduction to MIDI, Part 2 4366ac7032dSJohn Scipione - Sample code and other goodies at the 4374d556706SAugustin Cavalier <A HREF="https://haiku-os.org/about/teams/midi_kit">Haiku Midi Kit team page</A> 4386ac7032dSJohn Scipione 4396ac7032dSJohn Scipione Information about MIDI in general: 4404d556706SAugustin Cavalier - <A HREF="https://www.midi.org">MIDI Manufacturers Association</A> 4414d556706SAugustin Cavalier - <A HREF="https://www.borg.com/~jglatt/tutr/miditutr.htm">MIDI Tutorials</A> 4424d556706SAugustin Cavalier - <A HREF="https://www.borg.com/~jglatt/tech/midispec.htm">MIDI Specification</A> 4434d556706SAugustin Cavalier - <A HREF="https://www.borg.com/~jglatt/tech/midifile.htm">Standard MIDI File Format</A> 4444d556706SAugustin Cavalier - <A HREF="https://www.io.com/~jimm/midi_ref.html">Jim Menard's MIDI Reference</A> 4456ac7032dSJohn Scipione 4466ac7032dSJohn Scipione 4474cf62172SAdrien Destugues \defgroup network Network Kit 4484cf62172SAdrien Destugues \brief Classes that deal with all network connections and communications. 4496ac7032dSJohn Scipione 450b1a9f638SJohn Scipione The Haiku Network Kit consists of: 451b1a9f638SJohn Scipione - A modular, add-ons based network stack 45295c9effdSAugustin Cavalier - Two shared libraries, libnetwork.so and libnetapi.so 453b1a9f638SJohn Scipione - A stack driver, acting as interface between the network stack and 45495c9effdSAugustin Cavalier libnetwork.so 455b1a9f638SJohn Scipione - Basic network apps 456b1a9f638SJohn Scipione - A modular GUI preflet 457b1a9f638SJohn Scipione 458b1a9f638SJohn Scipione The libnet.so shared library is the way that BeOS R5 provided POSIX/BSD 459b1a9f638SJohn Scipione API sockets to apps. Being binary compatible with BeOS R5 has made this 460b1a9f638SJohn Scipione library implementation tedious. To counter this, the libnetapi.so shared 461b1a9f638SJohn Scipione library was developed. It contains thin C++ classes wrapping the C 462b1a9f638SJohn Scipione sockets POSIX/BSD API into these BNet* classes we're used under BeOS. 463b1a9f638SJohn Scipione 464b1a9f638SJohn Scipione The stack driver is the interface between libnet.so and the real stack 465b1a9f638SJohn Scipione behind it, hosted by the network stack kernel modules. Its purposes 466b1a9f638SJohn Scipione include: 467b1a9f638SJohn Scipione -# Providing sockets to file descriptors translation support 468b1a9f638SJohn Scipione -# Providing support for select() on sockets 469b1a9f638SJohn Scipione -# Loading the network stack on first access, and then keeping it for 470b1a9f638SJohn Scipione further accesses 471b1a9f638SJohn Scipione 472b1a9f638SJohn Scipione The following diagram illustrates the network stack design on Haiku: 473b1a9f638SJohn Scipione 474b1a9f638SJohn Scipione \image html obos_net_stack_design_1.gif 475b1a9f638SJohn Scipione 476b1a9f638SJohn Scipione The Network Kit includes a handful of useful networking related apps 477b1a9f638SJohn Scipione including ping, ifconfig, route, traceroute, and arp. 478b1a9f638SJohn Scipione 479b1a9f638SJohn Scipione See the User Guide for more information about the 4804d556706SAugustin Cavalier <a href="https://haiku-os.org/docs/userguide/en/preferences/network.html">Network preferences app</a> 481b1a9f638SJohn Scipione included as part of the Network Kit. 482b1a9f638SJohn Scipione 483b1a9f638SJohn Scipione 4846ac7032dSJohn Scipione \defgroup storage Storage Kit 4856ac7032dSJohn Scipione \brief Collection of classes that deal with storing and retrieving 4866ac7032dSJohn Scipione information from disk. 4876ac7032dSJohn Scipione 4886ac7032dSJohn Scipione 4896ac7032dSJohn Scipione \defgroup support Support Kit 4906ac7032dSJohn Scipione \brief Collection of utility classes that are used throughout the API. 4916ac7032dSJohn Scipione 4926ac7032dSJohn Scipione The Support Kit provides a handy set of classes that you can use in your 4936ac7032dSJohn Scipione applications. These classes provide: 4946ac7032dSJohn Scipione - \b Thread \b Safety. Haiku can execute multiple threads of an 4956ac7032dSJohn Scipione application in parallel, letting certain parts of an application 4966ac7032dSJohn Scipione continue when one part is stalled, as well as letting an application 4976ac7032dSJohn Scipione process multiple pieces of data at the same time on multicore or 4986ac7032dSJohn Scipione multiprocessor systems. However, there are times when multiple 4996ac7032dSJohn Scipione threads desire to work on the same piece of data at the same time, 5006ac7032dSJohn Scipione potentially causing a conflict where variables or pointers are 5016ac7032dSJohn Scipione changed by one thread causing another to execute incorrectly. To 5026ac7032dSJohn Scipione prevent this, Haiku implements a \"locking\" mechanism, allowing one 5036ac7032dSJohn Scipione thread to \"lock out\" other threads from executing code that might 5046ac7032dSJohn Scipione modify the same data. 5056ac7032dSJohn Scipione - \b Archiving \b and \b IO. These classes allow a programmer to 5066ac7032dSJohn Scipione convert objects into a form that can more easily be transferred to 5076ac7032dSJohn Scipione other applications or stored to disk, as well as performing basic 5086ac7032dSJohn Scipione input and output operations. 5096ac7032dSJohn Scipione - \b Memory \b Allocation. This class allows a programmer to hand off 5106ac7032dSJohn Scipione some of the duties of memory accounting and management. 5116ac7032dSJohn Scipione - \b Common \b Datatypes. To avoid unnecessary duplication of code 5126ac7032dSJohn Scipione and to make life easier for programmers, Haiku includes classes that 5136ac7032dSJohn Scipione handle management of ordered lists and strings. 5146ac7032dSJohn Scipione 5156ac7032dSJohn Scipione There are also a number of utility functions to time actions, play system 5166ac7032dSJohn Scipione alert sounds, compare strings, and atomically manipulate integers. Have a 5176ac7032dSJohn Scipione look at the overview, or go straight to the complete 5186ac7032dSJohn Scipione \link support list of components \endlink of this kit. 5196ac7032dSJohn Scipione 5201e994bc7SJohn Scipione \section book_overview Overview 5216ac7032dSJohn Scipione - Thread Safety: 5226ac7032dSJohn Scipione - BLocker provides a semaphore-like locking mechanism allowing for 5236ac7032dSJohn Scipione recursive locks. 5246ac7032dSJohn Scipione - BAutolock provides a simple method of automatically removing a 5256ac7032dSJohn Scipione lock when a function ends. 5266ac7032dSJohn Scipione - \ref TLS.h "Thread Local Storage" allows a global variable\'s 5276ac7032dSJohn Scipione content to be sensitive to thread context. 5286ac7032dSJohn Scipione - Archiving and IO: 5296ac7032dSJohn Scipione - BArchivable provides an interface for \"archiving\" objects so 5306ac7032dSJohn Scipione that they may be sent to other applications where an identical 5316ac7032dSJohn Scipione copy will be recreated. 5326ac7032dSJohn Scipione - BArchiver simplifies archiving of BArchivable hierarchies. 5336ac7032dSJohn Scipione - BUnarchiver simplifies unarchiving hierarchies that have been 5346ac7032dSJohn Scipione archived using BArchiver. 5356ac7032dSJohn Scipione - BFlattenable provides an interface for \"flattening\" objects so 5366ac7032dSJohn Scipione that they may be easily stored to disk. 5376ac7032dSJohn Scipione - BDataIO provides an interface for generalized read/write streams. 5386ac7032dSJohn Scipione - BPositionIO extends BDataIO to allow seeking within the data. 5396ac7032dSJohn Scipione - BBufferIO creates a buffer and attaches it to a BPositionIO 5406ac7032dSJohn Scipione stream, allowing for reduced load on the underlying stream. 5416ac7032dSJohn Scipione - BMemoryIO allows operation on an already-existing buffer. 5426ac7032dSJohn Scipione - BMallocIO creates and allows operation on a buffer. 5436ac7032dSJohn Scipione - Memory Allocation: 5446ac7032dSJohn Scipione - BBlockCache allows an application to allocate a \"pool\" of 5456ac7032dSJohn Scipione memory blocks that the application can fetch and dispose of as 5466ac7032dSJohn Scipione it pleases, letting the application make only a few large memory 5476ac7032dSJohn Scipione allocations, instead of many small expensive allocations. 5486ac7032dSJohn Scipione - Common Datatypes: 5496ac7032dSJohn Scipione - BList allows simple ordered lists and provides common access, 5506ac7032dSJohn Scipione modification, and comparison functions. 5516ac7032dSJohn Scipione - BString allows strings and provides common access, modification, 5526ac7032dSJohn Scipione and comparison functions. 5536ac7032dSJohn Scipione - BStopWatch allows an application to measure the time an action takes. 5546ac7032dSJohn Scipione - \ref support_globals "Global functions" 5556ac7032dSJohn Scipione - \ref TypeConstants.h "Common types and constants" 5566ac7032dSJohn Scipione - Error codes for all kits 5576ac7032dSJohn Scipione 5586ac7032dSJohn Scipione 5593528f5bbSJohn Scipione \defgroup translation Translation Kit 5603528f5bbSJohn Scipione \brief Provides a framework for converting data streams between media 5613528f5bbSJohn Scipione formats. 5623528f5bbSJohn Scipione 5633528f5bbSJohn Scipione 56402bdb5dbSFrançois Revol \defgroup libtranslation (libtranslation.so) 56502bdb5dbSFrançois Revol 5666ac7032dSJohn Scipione \defgroup libbe (libbe.so) 5676ac7032dSJohn Scipione 5686ac7032dSJohn Scipione 5696ac7032dSJohn Scipione \defgroup libroot (libroot.so) 570b966e837SAdrien Destugues \brief Implements the C and POSIX standard libraries. 5710524a6a8Smahlzeit*/ 5729d54b143SNiels Sascha Reedijk 5739889ca4aSNiels Sascha Reedijk///// Subgroups ///// 5749d54b143SNiels Sascha Reedijk 5759d54b143SNiels Sascha Reedijk/*! 576dba29137Swaddlesplash \defgroup support_globals Global functions 5779d54b143SNiels Sascha Reedijk \ingroup support 578cc19e7c0SAlex Wilson 579dba29137Swaddlesplash \defgroup layout Layout API 580dba29137Swaddlesplash \brief Provides classes for automatically laying out UIs. 581cc19e7c0SAlex Wilson \ingroup interface 5829d54b143SNiels Sascha Reedijk*/ 5834466b89cSJohn Scipione 5844466b89cSJohn Scipione 5854466b89cSJohn Scipione///// Special Topics ///// 5864466b89cSJohn Scipione 587aa6ef665SAugustin Cavalier/*! 5884466b89cSJohn Scipione \defgroup drivers Device Drivers 589f943fa46SAndrew Lindesay 590f943fa46SAndrew Lindesay \defgroup json Json Handling 591f943fa46SAndrew Lindesay \brief Provides for parsing and writing of data in Json encoding. 592f54a5a68SNiels Sascha Reedijk*/ 593094b8dcfSNiels Sascha Reedijk 594f54a5a68SNiels Sascha Reedijk 595f54a5a68SNiels Sascha Reedijk#if __cplusplus >= 201703L 596f54a5a68SNiels Sascha Reedijk/*! 597094b8dcfSNiels Sascha Reedijk \defgroup netservices Experimental Network Services Support 598094b8dcfSNiels Sascha Reedijk \brief Experimental API to do higher level network requests 599094b8dcfSNiels Sascha Reedijk 600094b8dcfSNiels Sascha Reedijk This API currently is marked as experimental. It is part of the 601094b8dcfSNiels Sascha Reedijk <code>BPrivate::Network</code> namespace, the header files are found at 602f54a5a68SNiels Sascha Reedijk <code>headers\\private\\netservices2</code>, and you have to link your 603f54a5a68SNiels Sascha Reedijk application to <code>libnetservices2.a</code>. The new API is only 604f54a5a68SNiels Sascha Reedijk available for modern platforms (x86 and x86_64), and not for the legacy 605f54a5a68SNiels Sascha Reedijk platform (x86_gcc2). The compiler needs to support C++17 or higher. 60660355daeSNiels Sascha Reedijk 60760355daeSNiels Sascha Reedijk <h3>Asynchronous handling of the result.</h3> 60860355daeSNiels Sascha Reedijk 60960355daeSNiels Sascha Reedijk In GUI applications, networking operations are often triggered by a user action. For example, 61060355daeSNiels Sascha Reedijk downloading a file will be initiated by the user clicking a button. When you initiate that 61160355daeSNiels Sascha Reedijk action in the window's thread, and you block the message loop until the request is finished, 61260355daeSNiels Sascha Reedijk the user will be left with a non-responsive UI. That is why one would usually run a network 61360355daeSNiels Sascha Reedijk request asynchronously. And instead of checking the status every few CPU cycles, you'd want 61460355daeSNiels Sascha Reedijk to be proactively informed when something important happens, like the progress of the download 61560355daeSNiels Sascha Reedijk or a signal when the request is finished. 61660355daeSNiels Sascha Reedijk 61760355daeSNiels Sascha Reedijk The Network Services kit support using the Haiku API's Looper and Handler system to keep you up 61860355daeSNiels Sascha Reedijk to date about relevant events that happen to the requests. 61960355daeSNiels Sascha Reedijk 62060355daeSNiels Sascha Reedijk The following messages are available for all requests (HTTP and other). The messages below are 62160355daeSNiels Sascha Reedijk in the order that they will arrive (when applicable). 62260355daeSNiels Sascha Reedijk 62360355daeSNiels Sascha Reedijk <table> 62460355daeSNiels Sascha Reedijk <tr> 62560355daeSNiels Sascha Reedijk <th>Message Constant</th> 62660355daeSNiels Sascha Reedijk <th>Description</th> 62760355daeSNiels Sascha Reedijk <th>Applies to</th> 62860355daeSNiels Sascha Reedijk <th> Additional Data</th> 62960355daeSNiels Sascha Reedijk </tr> 63060355daeSNiels Sascha Reedijk <tr> 63160355daeSNiels Sascha Reedijk <td>\ref BPrivate::Network::UrlEvent::HostNameResolved "UrlEvent::HostNameResolved"</td> 63260355daeSNiels Sascha Reedijk <td> 63360355daeSNiels Sascha Reedijk The hostname has been resolved. This message is even sent when you set an 63460355daeSNiels Sascha Reedijk IP-address in the URL object 63560355daeSNiels Sascha Reedijk </td> 63660355daeSNiels Sascha Reedijk <td>All protocols that use network connections.</td> 63760355daeSNiels Sascha Reedijk <td> 63860355daeSNiels Sascha Reedijk \ref BPrivate::Network::UrlEventData::Id "UrlEventData::Id" \c int32 <br/> 63960355daeSNiels Sascha Reedijk \ref BPrivate::Network::UrlEventData::HostName "UrlEventData::HostName" 64060355daeSNiels Sascha Reedijk \ref BString 64160355daeSNiels Sascha Reedijk </td> 64260355daeSNiels Sascha Reedijk </tr> 64360355daeSNiels Sascha Reedijk <tr> 64460355daeSNiels Sascha Reedijk <td>\ref BPrivate::Network::UrlEvent::ConnectionOpened "UrlEvent::ConnectionOpened"</td> 64560355daeSNiels Sascha Reedijk <td> 64660355daeSNiels Sascha Reedijk The connection to the remote server is opened. After this event, data will be 64760355daeSNiels Sascha Reedijk written. 64860355daeSNiels Sascha Reedijk </td> 64960355daeSNiels Sascha Reedijk <td>All protocols that use network connections.</td> 65060355daeSNiels Sascha Reedijk <td> 65160355daeSNiels Sascha Reedijk \ref BPrivate::Network::UrlEventData::Id "UrlEventData::Id" \c int32 65260355daeSNiels Sascha Reedijk </td> 65360355daeSNiels Sascha Reedijk </tr> 65460355daeSNiels Sascha Reedijk <tr> 65560355daeSNiels Sascha Reedijk <td>\ref BPrivate::Network::UrlEvent::UploadProgress "UrlEvent::UploadProgress"</td> 65660355daeSNiels Sascha Reedijk <td> 65760355daeSNiels Sascha Reedijk If there is a request body to be sent, this informs you of the progress. When the 65860355daeSNiels Sascha Reedijk total size of the request body is known, this will be part of the message. 65960355daeSNiels Sascha Reedijk </td> 66060355daeSNiels Sascha Reedijk <td> 66160355daeSNiels Sascha Reedijk All protocols that use network connections and support writing data to the server 66260355daeSNiels Sascha Reedijk (like HTTP(S)). 66360355daeSNiels Sascha Reedijk </td> 66460355daeSNiels Sascha Reedijk <td> 66560355daeSNiels Sascha Reedijk \ref BPrivate::Network::UrlEventData::Id "UrlEventData::Id" \c int32 <br/> 66660355daeSNiels Sascha Reedijk \ref BPrivate::Network::UrlEventData::NumBytes "UrlEventData::NumBytes" 66760355daeSNiels Sascha Reedijk \c int64 <br/> 66860355daeSNiels Sascha Reedijk \ref BPrivate::Network::UrlEventData::TotalBytes "UrlEventData::TotalBytes" 66960355daeSNiels Sascha Reedijk \c int64 (optional) 67060355daeSNiels Sascha Reedijk </td> 67160355daeSNiels Sascha Reedijk </tr> 67260355daeSNiels Sascha Reedijk <tr> 67360355daeSNiels Sascha Reedijk <td>\ref BPrivate::Network::UrlEvent::ResponseStarted "UrlEvent::ResponseStarted"</td> 67460355daeSNiels Sascha Reedijk <td>The server has started transmitting the response.</td> 67560355daeSNiels Sascha Reedijk <td>All Protocols</td> 67660355daeSNiels Sascha Reedijk <td> 67760355daeSNiels Sascha Reedijk \ref BPrivate::Network::UrlEventData::Id "UrlEventData::Id" \c int32 <br/> 67860355daeSNiels Sascha Reedijk </td> 67960355daeSNiels Sascha Reedijk </tr> 68060355daeSNiels Sascha Reedijk <tr> 681*8a16ecbcSNiels Sascha Reedijk <td>\ref BPrivate::Network::UrlEvent::HttpRedirect "UrlEvent::HttpRedirect"</td> 68260355daeSNiels Sascha Reedijk <td> 68360355daeSNiels Sascha Reedijk The network services kit is handling a HTTP redirect. The request will be repeated 68460355daeSNiels Sascha Reedijk for a new URL. 68560355daeSNiels Sascha Reedijk </td> 68660355daeSNiels Sascha Reedijk <td>HTTP/HTTPS</td> 68760355daeSNiels Sascha Reedijk <td> 68860355daeSNiels Sascha Reedijk \ref BPrivate::Network::UrlEventData::Id "UrlEventData::Id" \c int32 <br/> 68960355daeSNiels Sascha Reedijk \ref BPrivate::Network::UrlEventData::HttpRedirectUrl 69060355daeSNiels Sascha Reedijk "UrlEventData::HttpRedirectUrl" \ref BString 69160355daeSNiels Sascha Reedijk </td> 69260355daeSNiels Sascha Reedijk </tr> 69360355daeSNiels Sascha Reedijk <tr> 69460355daeSNiels Sascha Reedijk <td>\ref BPrivate::Network::UrlEvent::HttpStatus "UrlEvent::HttpStatus"</td> 69560355daeSNiels Sascha Reedijk <td> 69660355daeSNiels Sascha Reedijk The response status is available. This means it can also be accessed through 69760355daeSNiels Sascha Reedijk \ref BPrivate::Network::BHttpResult::Status() "BHttpResult::Status()" without 69860355daeSNiels Sascha Reedijk blocking the system. 69960355daeSNiels Sascha Reedijk </td> 70060355daeSNiels Sascha Reedijk <td>HTTP/HTTPS</td> 70160355daeSNiels Sascha Reedijk <td> 70260355daeSNiels Sascha Reedijk \ref BPrivate::Network::UrlEventData::Id "UrlEventData::Id" \c int32 <br/> 70360355daeSNiels Sascha Reedijk \ref BPrivate::Network::UrlEventData::HttpStatusCode "UrlEventData::HttpStatusCode" 70460355daeSNiels Sascha Reedijk \c int16 70560355daeSNiels Sascha Reedijk </td> 70660355daeSNiels Sascha Reedijk </tr> 70760355daeSNiels Sascha Reedijk <tr> 70860355daeSNiels Sascha Reedijk <td>\ref BPrivate::Network::UrlEvent::HttpFields "UrlEvent::HttpFields"</td> 70960355daeSNiels Sascha Reedijk <td> 71060355daeSNiels Sascha Reedijk The HTTP header block has been fully received, and the HTTP fields can be accessed 71160355daeSNiels Sascha Reedijk using \ref BPrivate::Network::BHttpResult::Fields() "BHttpResult::Fields()" without 71260355daeSNiels Sascha Reedijk blocking the system. 71360355daeSNiels Sascha Reedijk </td> 71460355daeSNiels Sascha Reedijk <td>HTTP/HTTPS</td> 71560355daeSNiels Sascha Reedijk <td> 71660355daeSNiels Sascha Reedijk \ref BPrivate::Network::UrlEventData::Id "UrlEventData::Id" \c int32 71760355daeSNiels Sascha Reedijk </td> 71860355daeSNiels Sascha Reedijk </tr> 71960355daeSNiels Sascha Reedijk <tr> 72060355daeSNiels Sascha Reedijk <td>\ref BPrivate::Network::UrlEvent::DownloadProgress "UrlEvent::DownloadProgress"</td> 72160355daeSNiels Sascha Reedijk <td> 72260355daeSNiels Sascha Reedijk If there is a response body to be received, this informs you of the progress. If 72360355daeSNiels Sascha Reedijk the total size of the body is known, this will be included in the message as well. 72460355daeSNiels Sascha Reedijk </td> 72560355daeSNiels Sascha Reedijk <td>All protocols that use network connections.</td> 72660355daeSNiels Sascha Reedijk <td> 72760355daeSNiels Sascha Reedijk \ref BPrivate::Network::UrlEventData::Id "UrlEventData::Id" \c int32 <br/> 72860355daeSNiels Sascha Reedijk \ref BPrivate::Network::UrlEventData::NumBytes "UrlEventData::NumBytes" 72960355daeSNiels Sascha Reedijk \c int64 <br/> 73060355daeSNiels Sascha Reedijk \ref BPrivate::Network::UrlEventData::TotalBytes "UrlEventData::TotalBytes" 73160355daeSNiels Sascha Reedijk \c int64 (optional) 73260355daeSNiels Sascha Reedijk </td> 73360355daeSNiels Sascha Reedijk </tr> 73460355daeSNiels Sascha Reedijk <tr> 73560355daeSNiels Sascha Reedijk <td>\ref BPrivate::Network::UrlEvent::BytesWritten "UrlEvent::BytesWritten"</td> 73660355daeSNiels Sascha Reedijk <td> 73760355daeSNiels Sascha Reedijk An interim update on how many bytes have been written to the target. This message 73860355daeSNiels Sascha Reedijk is only sent when you supplied a custom target to store the body of the request in. 73960355daeSNiels Sascha Reedijk Note that the number of bytes written to the target may differ from the network 74060355daeSNiels Sascha Reedijk transfer size, due to compression in the protocol. 74160355daeSNiels Sascha Reedijk </td> 74260355daeSNiels Sascha Reedijk <td>All protocols.</td> 74360355daeSNiels Sascha Reedijk <td> 74460355daeSNiels Sascha Reedijk \ref BPrivate::Network::UrlEventData::Id "UrlEventData::Id" \c int32 <br/> 74560355daeSNiels Sascha Reedijk \ref BPrivate::Network::UrlEventData::NumBytes "UrlEventData::NumBytes" 74660355daeSNiels Sascha Reedijk \c int64 74760355daeSNiels Sascha Reedijk </td> 74860355daeSNiels Sascha Reedijk </tr> 74960355daeSNiels Sascha Reedijk <tr> 75060355daeSNiels Sascha Reedijk <td>\ref BPrivate::Network::UrlEvent::RequestCompleted "UrlEvent::RequestCompleted"</td> 75160355daeSNiels Sascha Reedijk <td> 75260355daeSNiels Sascha Reedijk The request is completed and all the data is written to the target, or there was 75360355daeSNiels Sascha Reedijk an error. 75460355daeSNiels Sascha Reedijk </td> 75560355daeSNiels Sascha Reedijk <td>All protocols.</td> 75660355daeSNiels Sascha Reedijk <td> 75760355daeSNiels Sascha Reedijk \ref BPrivate::Network::UrlEventData::Id "UrlEventData::Id" \c int32 <br/> 75860355daeSNiels Sascha Reedijk \ref BPrivate::Network::UrlEventData::Success "UrlEventData::Success" \c bool 75960355daeSNiels Sascha Reedijk </td> 76060355daeSNiels Sascha Reedijk </tr> 76160355daeSNiels Sascha Reedijk <tr> 76260355daeSNiels Sascha Reedijk <td>\ref BPrivate::Network::UrlEvent::DebugMessage "UrlEvent::DebugMessage"</td> 76360355daeSNiels Sascha Reedijk <td> 76460355daeSNiels Sascha Reedijk Additional debug information on the request. This is enabled or disabled per 76560355daeSNiels Sascha Reedijk request. See the details in the protocol description. 76660355daeSNiels Sascha Reedijk </td> 76760355daeSNiels Sascha Reedijk <td>All protocols.</td> 76860355daeSNiels Sascha Reedijk <td> 76960355daeSNiels Sascha Reedijk \ref BPrivate::Network::UrlEventData::Id "UrlEventData::Id" \c int32 <br/> 77060355daeSNiels Sascha Reedijk \ref BPrivate::Network::UrlEventData::DebugType "UrlEventData::DebugType" 771*8a16ecbcSNiels Sascha Reedijk \c uint32 <br/> 77260355daeSNiels Sascha Reedijk \ref BPrivate::Network::UrlEventData::DebugMessage "UrlEventData::DebugMessage" 77360355daeSNiels Sascha Reedijk \ref BString 77460355daeSNiels Sascha Reedijk </td> 77560355daeSNiels Sascha Reedijk </tr> 77660355daeSNiels Sascha Reedijk </table> 777aa6ef665SAugustin Cavalier*/ 778f54a5a68SNiels Sascha Reedijk#endif 779094b8dcfSNiels Sascha Reedijk 780094b8dcfSNiels Sascha Reedijk 781094b8dcfSNiels Sascha Reedijk///// Namespace Documentation ///// 782094b8dcfSNiels Sascha Reedijk 783094b8dcfSNiels Sascha Reedijk 784094b8dcfSNiels Sascha Reedijk//! \brief Internal or experimental API 785094b8dcfSNiels Sascha Reedijknamespace BPrivate { 786f54a5a68SNiels Sascha Reedijk 787f54a5a68SNiels Sascha Reedijk#if __cplusplus >= 201703L 788094b8dcfSNiels Sascha Reedijk /*! 789094b8dcfSNiels Sascha Reedijk \brief Experimental Network Services API 790094b8dcfSNiels Sascha Reedijk 791094b8dcfSNiels Sascha Reedijk See \ref netservices for more information. 792094b8dcfSNiels Sascha Reedijk */ 793094b8dcfSNiels Sascha Reedijk namespace Network { 794094b8dcfSNiels Sascha Reedijk 795094b8dcfSNiels Sascha Reedijk } 796f54a5a68SNiels Sascha Reedijk#endif 797f54a5a68SNiels Sascha Reedijk 798094b8dcfSNiels Sascha Reedijk} 799