Date: Thu, 28 Mar 2024 20:57:03 +0000 (UTC) Message-ID: <1637519946.1877.1711659423320@ip-172-30-2-14> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_1876_966987400.1711659423314" ------=_Part_1876_966987400.1711659423314 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Once you have connected to the scanner head(s), you are ready to= scan. However, in most cases, the heads are not yet configured to your req= uirements. This example looks at the procedure for configuring a scan head.=
Best Practice
Even though the scanner head will retain configuration information in it= s non-volatile memory, it is recommended best practice to send the configur= ation every time you connect.
The configuration parameters are stored in a simple text format that is = documented in the Parameter Reference= .
using Sys= tem; using System.IO; using System.Net; using JoeScan.JCamNet; namespace Examples { class Program { static void Main(string[] args) { IPAddress baseIpAddress =3D new IPAddress(new byte[] { 192, 168= , 1, 150 }); // the scanner we want to configure Scanner scanner =3D Scanner.Connect(baseIpAddress, 0); =20 TextReader parametersReader; // Make sure your application can find the parameters file. In = Visual Studio,=20 // you can add the file to your project, and use the "Copy to O= utput Directory" property, // forcing Visual Studio to copy the file to your output direct= ory every time you build.=20 using (parametersReader =3D File.OpenText("param.dat")) { // the parameters are passed as one long string string parametersString =3D parametersReader.ReadToEnd(); try { // send the configuration parameters, and tell the head= to store it permanently scanner.SetParameters(parametersString, true); Console.WriteLine("Scanner {0}:{1} was successfully con= figured!", scanner.IPAddress.ToString(), scanner.CableID); } catch (Exception e) { Console.WriteLine("Scanner {0}:{1} did not accept confi= guration parameters!", scanner.IPAddress.ToString(), scanner.CableID); } } } } }
The parameters are passed as a simple string, containing the entire file= at once. Depending on your application, you can provide this string any wa= y you'd like (e.g., retrieve it from a database, read it from a file, or bu= ild it 'on the fly').
Unicode Text
Be aware that some text editors change the encoding of the file and stor= e it as 'UTF-8', in which case the SetParameters() function may fail.