Array of bytes to the Type specifier

Hello everyone.

In my project I have a connection to an external device via a RS-232 connection. Now, I read the bytes and want to convert them to a specified type, such as I32 or U8.

When the data arrives, I convert the string to a byte array. For one serving, I need to convert an array of 4-byte an I32. This means that the bytes are literary the data to be converted to the data type.

I have no idea how to do this, pourriez is it you guys please help me?

Kind regards

Jesse Bax

Swissdrones of operations AG

STH says:

That's exactly what about built-in 'contact numbers.

It's too much work.  Simply create a cluster of all data in the message and Unflatten string will do everything for you.

Tags: NI Software

Similar Questions

  • Pass an array of bytes to the oracle stored procedure

    I have a problem with moving from byte array in Oracle stored procedure as an input parameter by using odp.net.

    Here is the signature of the stored procedure:

    SOMEPROCEDURE(session IN NUMBER, data IN RAW)

    Here is c# code, which calls the procedure:

    var cmd = new OracleCommand("SOME_PROCEDURE", _connection);

    cmd.CommandType = CommandType.StoredProcedure;

    var bt = new byte[]{1,68,0,83,128,1};

    OracleParameter sessionId = new OracleParameter("dbSessionId", OracleDbType.Decimal, new OracleDecimal(_dbSessionId), ParameterDirection.Input);

    OracleParameter data = new OracleParameter("statusData", OracleDbType.Raw, new OracleBinary(bt), ParameterDirection.Input);

    cmd.Parameters.Add(sessionId);

    cmd.Parameters.Add(data);

    cmd.ExecuteNonQuery();

    This code does not (stored procedure throws exception, which cannot receive), because in byte array hadou number 128!, if I display 128 on another number, minus 128, it works great!

    What should I do?

    After some tests I found the solution. Initially, you cannot switch to the array of bytes via the odp.net stored procedure, if the table contains 127 large values.

    Yes, solution: 1. create the wrapper procedure

    procedure SOME_PROCEDURE_WRAPPER (p_session_id in number, p_data  in varchar2)
     is v_data raw(1024);
     rawdata raw(1024); 
     rawlen number;
     hex varchar2(32760);
     i number;
     begin
      rawlen := length(p_data);
      i := 1;
      while i <= rawlen-1
      loop 
     hex := substrb(p_data,i,2); 
         rawdata := rawdata || HEXTORAW(hex); 
         i := i + 2; end loop; 
         SOME_PROCEDURE(p_session_id , rawdata); 
     end;
    

    2 then need to modify the code c# in this way:

     var cmd = new OracleCommand("SOME_PROCEDURE_WRAPPER", _connection);
     cmd.CommandType = CommandType.StoredProcedure;
     string @string = statusData.ToHexString();
     OracleParameter sessionId = new OracleParameter("dbSessionId", OracleDbType.Decimal, new OracleDecimal(_dbSessionId), ParameterDirection.Input);
     OracleParameter data = new OracleParameter("statusData", OracleDbType.Varchar2,@string.Length, new OracleString(@string), ParameterDirection.Input);
     cmd.Parameters.Add(sessionId);
     cmd.Parameters.Add(data);
     cmd.ExecuteNonQuery();
    

    where

    public static string ToHexString(this byte[] bytes)
     { 
         if(bytes == null || bytes.Length == null)
               return string.Empty;
          StringBuilder hexStringBuilder = new StringBuilder();
          foreach (byte @byte in bytes)
          { 
              hexStringBuilder.Append(@byte.ToString("X2")); 
          } 
          return hexStringBuilder.ToString();
     }
    
  • What is the best way to convert an array of bytes or string cluster

    I am writing a program that sends UDP packets and I defined the data I want to send via large groups (with numbers of u8, u16/u32, u16/u8/u32 tables and nested groups). Just before sending the data, I need to convert groups or chains of arrays of bytes. The flatten the string function is almost perfect for this. However, it is addition of lengths in the tables and strings that makes this unusable method, because as far as I can tell.

    As I have many of these groups, I would rather not hard code the unbundle names and conversion/cast of strings or arrays of bytes for each of them.

    Y at - it a function, or a tool that I'm on?

    Thank you!

    mkirzon wrote:

    The program I'm developing is to communicate and to poll an external device that includes a Protocol well documented. The messages that I built in clusters contain components accurate that expected from the other device. So, if my program adds any additional info (such as this array/string lengths), monitor the device external won't recognize messages and returns an error.

    Unfortunately, you have to ungroup your cluster and collect the individual channels to concatinate.

  • LabVIEW:EXE generates the error 1003 calling plugin with the type definition

    Hi all

    I am running LV 2012 on a Win 7 machine. I had this same problem with LV 2011, so I'm sure that's not associated with version/upgrade.

    Go to a LV-built EXE, I try to call a dynamically loaded Subvi. I did it several times with success before, so I think I know how. I prefer to use the call by reference, but I get the error 1003 Open Ref VI (with the type specifier). If I use the type specifier, can I open the Subvi, but the State is listed as 'bad '. Then, I went to recursively through all the subVIs (~ 25 in total) and concluded that the only item with a status of 'Bad' was a type definition.

    I checked several times, several different, that all ways the subVIs (and the definition of Type 'bad') are available to the Subvi dynamics. I did that the type definition is correct. I have also made sure the subVIs are stored as .VI files in the same directory and not within an EXE file. When I try to run the VI run call node, I still get the error 1003. I checked the path that displays in the error dialog box is the exact path for the Subvi (it would be for other VI properties and methods working properly).

    Why can't I run a sub - VI loaded dynamically from an executable if it has a type (a group of 3 trails) as output parameter definition?

    I just tested an idea: rename the library from project to project A create script. Now when it loads, it does not disturb what he must internally with externally called Subvi (dynamic). It worked the first time!

  • Add an attribute of the element configuration table type programmatically.  How can I specify the type of table?

    I am trying to add a configuration item that is an array of strings.  I don't know how to do this programmatically and have it show as an array of strings.  I would like people to be able to use the client of vCO and only change these if needed is.  I managed to add items, but they appear as "modified".  I can retrieve all ok by programming, but I guess since one can table actually waiting variant values is done deal as the generic object rather than an array of strings.  Is it possible to force this type when I put the value via the api?  It's my test code:

    var testArray = new Array();
    testArray.push ("string1");
    testArray.push ("string2");
    element.setAttributeWithKey ("TestKey", testArray);
    This translates into an attribute of type table, but I like it to be of type Array/string;

    Paul, as far as I know, you must manually set your attribute types using the vCO client. You cannot specify the types using script.

  • Sending the command apdu with an array of bytes as CDATA

    Hello
    I learn the java card as part of my final year project. So far I think I can do the most basic things, but I stuck a special moment.

    I know that there are different manufacturers to create an apdu command object and a number of these manufacturers take an array of bytes as CDATA values.

    My problem is, how do I access this data table in the side of the card because apdu.getBuffer () returns an array of integers (bytes)? And what is actually on apdu.getBuffer () [ISO7816. (Instead of OFFSET_CDATA)] when you send the apdu command object using such constuctor?

    concerning

    Published by: 992194 on 6 March 2013 06:12

    992194 wrote:
    (..) I should have mentioned earlier that my card use jc 2.2.1 version, and from different places, I've read that this version does not support ExtendedLength facilities.

    Indeed.

    I also understand the semantics of apdu.getBuffer () [ISO7816. OFFSET_CDATA] is the first byte of the data command. My question is, these command data was initially provided as an array of bytes. Something like this:

    + new CommandAPDU(CLA, INS, P1, P2, DATA_ARRAY, Le) +.

    For example, when you call:

    ubyte [] buffer = apdu.getBuffer)

    So it means that the values of bytes inside the tableau_donnees argument automatically occupy locations + buffer [ISO7816. OFFSET_CDATA] + inside the buffer?

    Yes. The length would be (abstract) (buffer [ISO7816. (OFFSET_LC] & 0xFF) . Notice the & 0xFF is a must greater than 127 bytes.

    Or there is a mechanism to extract the table tableau_donnees itself?

    Laughing out loud

    In fact, in the interest of performance and portability in environments with low memory, usual coding style must pass buffer , an offset that and length; rather than take an object, which would require a copy. Welcome to the real world of Java Card.

  • Problem of cast to array of bytes in array of float

    Can someone help me find this process I am doing wrong?

    • I read a string of 6 tanks during the series.
    • I take the string and convert it to an array of bytes.
    • I then reverse the byte array because my microcontroller first sends the LSB and Labview is Big-endian
    • I catalogued this table in an array of float
    • I invert the table again to retrieve the data in the original order

    I can see the bytes in the array of bytes as 'byte, 0, 0, 0' when there are a small number, but when I I cataloged get very large or very small floats. Can someone help me understand this?

    Thank you!

    LabVIEW 2011

    You should probably use string unflatten, select the byte with rule of the little order and use a DBL 1 d array type. Everything must fall in place without all these gynastics bit, what you're doing.

    You can show us your code? I don't understand your use of "decimate the table."

    Attach a small VI containingh a typical chain received as a constant of diagram.

  • Array of bytes to double signs for AutoPowerSpectrum

    I'm trying to analyze a wav file and get the thd.

    During the read wav file, I read in one data (void *) table.  And according to the type of bit, depends on how to call PlotWaveform.  So, in my example, I have a 16-bit mono signal.  And I'm calling draw the waveform as follows:

    PlotWaveform (panelHandle, PANEL_CHANNEL_LEFT, channel1, samplesPerChannel, type, 1.0, 0.0, 0.0, 1.0, VAL_THIN_LINE, VAL_EMPTY_SQUARE, VAL_SOLID, 1,
                            VAL_RED);
    

    And a perfect sine wav out.

    Now, I try to do the THD on the signal, but can't convert my array of bytes in a double table.  I have the following code, but all my values that I use are in power - 319th.

    channel 1 is a (void *)

    I guess that the ConvertArrayType () function can help you in this problem.

  • Array of bytes and KSOAP2

    Hello
    I have a request. I have a MSSQL database into two columns. One is a varchar and the second is the Image type. I would use these two fields filled to KSOAP2. I tried to send a picture in KSOAP byte array but it did not, probably, I sometimes confuse.
    Here is the source code.

    public byte[] getBytesFromBitmap(Bitmap bmp) {
     try {
      int height=bmp.getHeight();
      int width=bmp.getWidth();
      int[] rgbdata = new int[width*height];
      ByteArrayOutputStream bos = new ByteArrayOutputStream();
      DataOutputStream dos = new DataOutputStream(bos);
      bmp.getARGB(rgbdata,0,width,0,0,width,height);
      for (int i = 0; i < rgbdata.length ; i++) {
       if (rgbdata[i] != -1) {
        dos.writeInt(i);
        dos.flush();
        //l++;
       }
      }
      bos.flush();
      return bos.toByteArray();
     } catch (Exception ex) {
      Dialog.alert("getBytesFromBitmap: " + ex.toString()); return null;
     }
    }
    
    Bitmap borderBitmap = Bitmap.getBitmapResource("rounded.png");
    byte[] img = getBytesFromBitmap(borderBitmap);
    String name = "Name";
    SoapObject rpc = new SoapObject(serviceNamespace, "name");
    
    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    rpc.addProperty("_img", img);
    rpc.addProperty("_string", name);
    envelope.setOutputSoapObject(rpc);
    envelope.bodyOut = rpc;
    envelope.dotNet = true;
    envelope.encodingStyle = SoapSerializationEnvelope.XSD;
    

    I also tried... I transferred the image in the array of bytes to a string, using the string, I sent KSOAP and everything went well... The problem was that if she string converted to array of bytes, and then in a Bitmap, then bb do not show Bitmap. I would like to send a byte array.

    Thank you

    Stepan

    This function is useful to get the bytes of the image.

    public static byte[] returnByte(String path)
    {
    FileConnection fconn;
    int available = 0;
    InputStream input = null;
    byte[] data=null;
    try
    {
    fconn = (FileConnection)Connector.open(path);
    if(fconn.exists()==true)
    {
    input = fconn.openInputStream();
    available = input.available();
    int fSz = (int)fconn.fileSize();
    data = new byte[fSz];
    input.read(data, 0, fSz);
    }
    }
    catch(Exception e)
    {
    Dialog.alert("Error");
    }
    return data;
    }
    

    Now you must do this:

    Byte [] img = returnByte ("pawan.png");

    rpc.addProperty("_img", Base64.encode(img));
    

    I'm sure it works...

    Thank you

  • getData returns an incorrect number of bytes for the .png icon

    BB Storm JDE 4.7.0

    I'm creating a module of code in a .cod file. I get application descriptor and the first descriptor I getEncodedIcon() and the returned EncodedImage I call getData. The result is a byte array that has 2 additional bytes to the beginning 0x00DD (it's a .png file).

    OK, first of all, why is it? The first 2 bytes tells me it's a file .png or something?

    Second, can someone tell me a quick way to convert it to an array, starting with the 2 byte (the 3rd byte).

    I watched ByteVector but it allows me to copy but not for copy in.

    I don't want to do byte-by-byte as it is slow.

    I want just to get an arrangement [] starting with byte 2 bytes or to first get the .png file returned with the correct byte.

    Note that I confirmed that what I say is true by setting the two breakpoints in the debugger and by writing out a file again... he got 2 extra bytes at the beginning of the different file than that was the original .png file.

    Any ideas greatly appreciated.

    Thank you

    -Donald

    You could do a System.arraycopy () with size origArray.length - 2 I guess. But you have to double the space...

    What you're trying to do with it? Many features of rop and others allow you to specify an offset in the table to avoid copies.

  • Problem using the pixel format indexed bytes in the PixelWriter setPixels method

    I'm trying to build a byte array and set it on a WritableImage using the PixelWriter setPixels method.

    If I use a RGB pixel format, it works. If I use a byte indexed pixel format, I get a NPE.
    Stride etc should be fine if I'm not mistaken.

    java.lang.NullPointerException
    to com.sun.javafx.image.impl.BaseByteToByteConverter. < init > (BaseByteToByteConverter.java:45)
    to com.sun.javafx.image.impl.General$ ByteToByteGeneralConverter. < init > (General.java:69)
    at com.sun.javafx.image.impl.General.create(General.java:44)
    at com.sun.javafx.image.PixelUtils.getB2BConverter(PixelUtils.java:223)
    to com.sun.prism.Image$ ByteAccess.setPixels (Image.java:770)
    at com.sun.prism.Image.setPixels(Image.java:606)
    to javafx.scene.image.WritableImage$ 2.setPixels(WritableImage.java:199)

    Independent, short example here:
    import java.nio.ByteBuffer;
    
    import javafx.application.Application;
    import javafx.scene.Scene;
    import javafx.scene.image.ImageView;
    import javafx.scene.image.PixelFormat;
    import javafx.scene.image.WritableImage;
    import javafx.scene.layout.BorderPane;
    import javafx.stage.Stage;
    
    public class IndexedColorTestApp extends Application {
    
        public static void main(String[] args) {
            launch(args);
        }
    
        @Override
        public void start(Stage primaryStage) {
            BorderPane borderPane = new BorderPane();
            Scene scene = new Scene(borderPane, 600, 1100);
            primaryStage.setScene(scene);
    
            ImageView imageView = new ImageView();
            borderPane.setCenter(imageView);
            primaryStage.show();
    
            int imageWidth = 200;
            int imageHeight = 200;
            WritableImage writableImage = new WritableImage(imageWidth, imageHeight);
    
            // this works
            byte[] rgbBytePixels = new byte[imageWidth * imageHeight * 3];
            PixelFormat<ByteBuffer> byteRgbFormat = PixelFormat.getByteRgbInstance();
            writableImage.getPixelWriter().setPixels(0, 0, imageWidth, imageHeight,
                                                     byteRgbFormat, rgbBytePixels, 0, imageWidth * 3);
            imageView.setImage(writableImage);
    
            // this throws an NPE in setPixels()
            byte[] indexedBytePixels = new byte[imageWidth * imageHeight];
            int[] colorPalette = new int[256];
            PixelFormat<ByteBuffer> byteIndexedFormat = PixelFormat.createByteIndexedInstance(colorPalette);
            writableImage.getPixelWriter().setPixels(0, 0, imageWidth, imageHeight,
                                                     byteIndexedFormat, indexedBytePixels, 0, imageWidth);
            imageView.setImage(writableImage);
        }
    
    }
    If there is no solution, maybe someone knows a solution? We chose to use the format indexed due to the size of the data / performance reasons.

    Published by: Andipa on 01.03.2013 10:52

    You have found a bug in the platform, filed against the project to-online http://javafx-jira.kenai.com to your sample code and a link to this forum question.
    Byte indexed pixel formats seem like a feature never completely (or maybe even any) implemented for me.

    The PixelFormat type uses your unsuccessful case is (PixelFormat.Type.BYTE_INDEXED):

    PixelFormat byteIndexedFormat = PixelFormat.createByteIndexedInstance(colorPalette);
    System.out.println(byteIndexedFormat.getType());
    

    Here are the valid PixelFormat types =>
    http://docs.Oracle.com/JavaFX/2/API/JavaFX/scene/image/PixelFormat.type.html

    BYTE_BGRA
    The pixels are stored in adjacent bytes with the non-premultiplied components stored in order of increasing index: blue, green, red, alpha.
    BYTE_BGRA_PRE
    The pixels are stored in adjacent bytes with the premultiplied components stored in order of increasing index: blue, green, red, alpha.
    BYTE_INDEXED
    The pixel colors are referenced by byte indices stored in the pixel array, with the byte interpreted as an unsigned index into a list of colors provided by the PixelFormat object.
    BYTE_RGB
    The opaque pixels are stored in adjacent bytes with the color components stored in order of increasing index: red, green, blue.
    INT_ARGB
    The pixels are stored in 32-bit integers with the non-premultiplied components stored in order, from MSb to LSb: alpha, red, green, blue.
    INT_ARGB_PRE
    The pixels are stored in 32-bit integers with the premultiplied components stored in order, from MSb to LSb: alpha, red, green, blue.
    

    As for a WritableImage native pixel format is not the same that you use the pixel format, the JavaFX platform needs to do a conversion while reading pixels in a format and write it in another format. To do this, he must be able to determine a PixelGetter for your PixelFormat (the PixelGetter is an internal thing, API not public).

    And here's the source determines the PixelGetter for a given type of PixelFormat:
    http://Hg.OpenJDK.Java.NET/openjfx/8/master/RT/file/06afa65a1aa3/JavaFX-UI-common/src/com/Sun/JavaFX/image/PixelUtils.Java

    119     public static  PixelGetter getGetter(PixelFormat pf) {
    120         switch (pf.getType()) {
    121             case BYTE_BGRA:
    122                 return (PixelGetter) ByteBgra.getter;
    123             case BYTE_BGRA_PRE:
    124                 return (PixelGetter) ByteBgraPre.getter;
    125             case INT_ARGB:
    126                 return (PixelGetter) IntArgb.getter;
    127             case INT_ARGB_PRE:
    128                 return (PixelGetter) IntArgbPre.getter;
    129             case BYTE_RGB:
    130                 return (PixelGetter) ByteRgb.getter;
    131         }
    132         return null;
    133     }
    

    As you can see, the BYTE_INDEXED format is not supported, and null is returned instead... it is the source of your NullPointerException.

  • Photosmart C4780 installation fails at the "system cannot find the file specified."

    My problem began simply with your printer, a HP Photosmart C4780, who has always had a wireless connection and would not print.  Initially, the checked network connection fine control panel of the printer.  I ran a Microsoft printer troubleshooting, which found a block in line print and authorized.  The first test page print, but did print the "internal test page.  I did not understand what it meant, so I looked for help on the HP site.

    I ran the HP print and Scan Doctorand he suggested I have reinstall the driver.  I have downloaded and saved the current HP (PS_AIO_06_C4700_USW_Full_Win_enu_140_175.exe) and then uninstalled the existing driver.  When I tried to install a new, a window pops up saying "the system cannot find the file specified," with only a single box for click that simply says "OK".  The installation went through 'examining installation options', after entering "check updates, download updates, install updates" and then it was all in "audit system", who jumped out of the window "file not found" upwards, and when I clicked 'OK', the installation window as well as the error message box simply disappeared.  Which I suppose is the path to the file is under the window, but it didn't fit so he showed not the end.  What I read was "C:\Users\... \Local\Temp\7zS588E\Setup\.\Setup\hpzpnp40...»

    I found a topic on the same printer model for the same problem in the forum, which offered this hotfix:

    You must first complete a level 3 of the software uninstallation. I've included the steps below to do this.

    1. press the Windows key and the letter R
    2. type %temp%, and then click OK
    3. open the 7z folder (a more recent if there are multiples)
    4 open the util folder
    5 open the folder of the ccc
    6. double-click on the Uninstall_L3

    Once you have completed the Uninstall_L3, delete all of the items listed in the temp folder. Note, you will not be able to remove all the elements, please ignore those that do not. Then please empty the trash and perform a clean boot. I've included the document «How to perform a boot in Windows» If your computer does not request it, restart your computer.

    Once your computer is back, you must reinstall the printer software. You can do this either by using the Setup CD, or by downloading the software.

    I did what was suggested, until he got to the point where it says it was the case recommend not removing any more items if I had intended on using the HP Officejet printer (Yes, I have a second HP printer connected to the network) anytime in the future.  Not really understand how it all works, I decided to stop what I was doing, so unfortunately it has not solved my problem.

    Do I need to uninstall both printers HP before I can reinstall a?  And if I do that, is there a reason that I wouldn't be able to reinstall the two printers?  Looks like I'm asking trouble.  Bottom line... I can not install the driver.

    I tried to install the full versions and the driver base and still get the same result.

    I have a HP Pavilion dv6 - 3100t for computer laptop, running Windows 7 Edition Premium, version 6.1.7601 family service pack 1 64-bit.  I have not installed new hardware or software.  This printer has always had a wireless connection.  The router I'm using is a Netgear 54Mbps WGR614 v6 (provided by my cable company) and the network includes not only my laptop and the Photosmart printer, but also desktop ASUS, HP printer, an Officejet 6300 series (used only for printing graphics and photos via a wired to the router) and a chip on Vizio TV.  I use Norton 360 first Edition and disabled the antivirus auto-protect when I downloaded and tried to install the driver.

    Help, please!  And thanks in advance for your time and your attention.

    Oh, Jamieson, it worked!  I can print again!  A massive amount of thanks and congratulations to you.

    I couldn't believe it when he actually passed the point where it normally would stop the installation, but then almost at the end, upward jumped «Fatal error during installation»  My excitement sank into a depression.  He said while the installation was not successful and he needed to collect information in order to diagnose the fault.  I looked at what has been collected, and it was more or less gobblety-* beep * for me.  There was a code of 19714722 error condition, if that means anything.

    Then he placed on my desk, the "Error of Installation HP - Windows 7.hta" file and instructed me to do away with the current window, restart, and then open the file and move forward with these guidelines.  I did and he basically had me to restart the computer once again, and then turn the printer off, unplug the printer, then unplug the router, wait 30 seconds and then plug the TAA - DAA and back in, I'm back in the business of printing.

    Thank you very much for your time and patience.

    All the best to you and yours!

  • Where lives the logic for the types of flow control step?

    For most types of step, the behavior of the type of the step is determined entirely by the configuration of the stage - that is to say, the properties that can be configured in the window type, such as the properties of the step, steps, etc..  But as far as I know, the behavior of the control flow step types (for example, hop, back at the beginning of a block of loop after a late stage) does not seem to be defined by a lower level, flag, attribute or any other configuration item - it seems to be something inherent to the motor TestStand.

    If this is the case, how the TestStand engine knows to provide the functionality for a particular flow control step type?  It runs the appropriate logic based on the name of the step type?  I suspect that this may be the case, because if I create new types of step in copying the types of step ForEach and end without any changes other than to specify the new name for the beginning of the block and end step types, new types of step repeat not the loops as expected.

    Can someone clear this up for me?  Types of flow control step break the model completely define the features by changing the type of step, or I am simply not find relevant configuration items?  I tried to create a new type of end step that allows an expression pre, but it broke my step ForEach (new) type loopback functionality.  Is it possible to do what I want?

    You are right that the engine processes specially the flow control measures. He looks at the name of step type. If you want the same behavior execution, you must keep the original name of type step as a prefix on your step type name, such as NI_Flow_End_CustomizedByMe.

    Also, check out the http://forums.ni.com/t5/NI-TestStand/copy-of-NI-Flow-End-does-not-work/m-p/290170/highlight/true#M88...

    There is the source code that is similar to what the engine makes the steps of flow control. That was the actual code before it moved into the engine. It might be a bit outdated now. I found this on my machine in C:\Program Files (x 86) \National Instruments\TestStand 2010\Components\StepTypes\FlowControl\

  • How to convert an array of bytes in a single integer

    Hello!

    So, for the moment, I am trying to receive data from a device that sends data back as an array of 10 bytes, where the first 2 bytes are a header, 6 are a number of words that is supposed to be a unique 48-bit value and the last 2 are a number of errors which is suppose to be a unique 16-bit value.

    Ex:

    Word has received

    (Header)   (----------------------------------Word Count------------------------------)   (Number of errors)
    0            120     0               44              221          155          96             48             0              0

    So, in theory, what I want to do is be able to calculate the values like this:

    (Header)   (----------------------------------Word Count------------------------------)   (Number of errors)
    0            120     0               44              221          155          96             48             0              0
    The binary values: 00000000 00101100 11011101 10011011 01100000 00110000 00000000 00000000
    Concat. Vals: 000000000010110011011101100110110110000000110000 0000000000000000
    Calc'd Vals: = 192696508464 words = 0 errors
    * 40 (40-bit words)
    Totals: = 7.7078603e + 12 bits total = 0 Total errors

    But the problem that I am running is that all methods that I use seem to not be correct.

    I tried:

    Flatten the data and then it unflattening like a U64

    Convering to bool, concatinating tables data, and then convert that to a certain number

    Join all the bytes together using the join function

    Casting to an array of bytes to a U64

    And with all methods, the data that I use is incorrect (in the sense where the values are incorrect compared to this calculation manually like I did above), and at this point, I'm not sure how to get the correct values, so any kind of help would be greatly appreciated!

    Thank you!

    It seems to work for me...

  • GetTableCellValue "the control is not of the type expected by the function.

    I hope you can help me to find out why GetTableCellvalue is a failure.
    I don't get "the control is not of the type expected by the function.
    int calPanelId = LoadPanel (PARENT, "gui_main.uir", CAL_PANEL);
    Point p;
    p.x = 1;
    p.y = 1;
    Double val = - 1.0;
    State int = - 1;
    status = GetTableCellVal (calPanelId, READY_TAB_TABLE, p, &val);)
    READY_TAB_TABLE is an array, it is apparent from the record of the uir:
    gui_main.h: #define READY_TAB_TABLE 2 / * type of control:
    table, the callback function: (none) * /.
    I'd appreciate any help you can give me.
    Thank you
    Randy

    OK, 1, 2 and 4 look ok to me, but maybe 3 either, so one last thing: If the table is in a tab of the Panel, you must use the handle Panel tab, for example,

    function (tabpanel_handle, TABPANEL_4_CONTROL_1,...)

    and GetPanelHandleFromTabPage for the tabpanel_handle...

Maybe you are looking for

  • Suddenly cannot display the contents of the image on a stock photography site.

    All of a sudden in the last days, I can view is more images on a stock photography site where I sell content. I can view the thumbnails of my and other images, but when I click to enlarge, I get only a white box about the size of the image would be.

  • Replacing motherboard G62-225nr

    I got a G62 someone because it does not work and I'm trying to fix it. Looking at it I'm pretty sure his problem with the motherboard, so my question is what are my options to replace the motherboard? Does anyone know what motherboard will fit? The s

  • Load samples and play live?

    I use Garageband to play sounds through a Bluetooth speaker on my train. Then I load in a bunch of samples and play them back like a sampling keyboard? Y at - it another app that works better?

  • (C) always showing as the copyright sign

    Why typing (C) always shows as the sign copyright when I type in the text?If I place the spaces between the brackets it shows as usual.All the other letters normally not spaced brackets are very good.

  • Cannot remove a folder on my desktop without name - please help!

    Hi - I accidentally renamed a folder using the 'Alt + 255"character invisible.  I forgot I was renaming a real folder on my desktop and not a shortcut to a folder.  In fact, what I actually renamed it as "Alt + 255 (x 7)", i.e. of 7 invisible charact