• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Pointer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.sun.cldc.jna.Pointer的典型用法代码示例。如果您正苦于以下问题:Java Pointer类的具体用法?Java Pointer怎么用?Java Pointer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Pointer类属于com.sun.cldc.jna包,在下文中一共展示了Pointer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setStatusData

import com.sun.cldc.jna.Pointer; //导入依赖的package包/类
/**
 * Set the status data to send to the ds
 *
 * @param battery the battery voltage
 * @param dsDigitalOut value to set the digital outputs on the ds to
 * @param updateNumber unique ID for this update (incrementing)
 * @param userDataHigh additional high-priority user data bytes
 * @param userDataHighLength number of high-priority data bytes
 * @param userDataLow additional low-priority user data bytes
 * @param userDataLowLength number of low-priority data bytes
 * @param wait_ms the timeout
 * @return 0 on success, 1 if userData.length is too big, 2 if semaphore could not be taken in wait_ms.
 */
public static int setStatusData(double battery, int dsDigitalOut,
        int updateNumber, byte[] userDataHigh, int userDataHighLength,
        byte[] userDataLow, int userDataLowLength, int wait_ms) {
    synchronized (statusDataCacheHigh) {
        //System.out.println("udl " + userData.length);
        // Copy the userdata byte[] to C-accessible memory
        Pointer userDataPtrHigh = statusDataCacheHigh.getBufferSized(userDataHighLength); // new Pointer(userData.length);
        userDataPtrHigh.setBytes(0, userDataHigh, 0, userDataHighLength);
        Pointer userDataPtrLow = statusDataCacheLow.getBufferSized(userDataLowLength); // new Pointer(userData.length);
        userDataPtrLow.setBytes(0, userDataLow, 0, userDataLowLength);

        //System.out.print("Writing ");
        //System.out.print(userData.length);
        //System.out.println(" bytes of status data to network.");

        int res = setStatusDataFn.call8(Float.floatToIntBits((float) battery),
                dsDigitalOut, updateNumber,
                userDataPtrHigh.address().toUWord().toPrimitive(), userDataHighLength,
                userDataPtrLow.address().toUWord().toPrimitive(), userDataLowLength,
                wait_ms);

        //System.out.println("Data transfered.");
        return res;
    }
}
 
开发者ID:frc-team-342,项目名称:wpilibj,代码行数:39,代码来源:FRCControl.java


示例2: viBufRead

import com.sun.cldc.jna.Pointer; //导入依赖的package包/类
public static byte[] viBufRead(int vi, int cnt) throws VisaException {
    Pointer bytes = new Pointer(cnt);
    Pointer retCnt = new Pointer(4);
    status = viBufReadFn.call4(vi, bytes, cnt, retCnt);
    switch (status) {
        case VI_SUCCESS_TERM_CHAR:
        case VI_SUCCESS_MAX_CNT:
            status = 0;
            break;
        default:
            assertCleanStatus("viBufRead");
    }

    byte[] toReturn = new byte[cnt];
    bytes.getBytes(0, toReturn, 0, cnt);
    bytes.free();
    return toReturn;
}
 
开发者ID:frc-team-342,项目名称:wpilibj,代码行数:19,代码来源:Visa.java


示例3: write

import com.sun.cldc.jna.Pointer; //导入依赖的package包/类
public void write(String fileName) throws NIVisionException{
    Pointer colorTable = new Pointer(1024);
    //Black Background
    colorTable.setByte(0, (byte)0);   //B
    colorTable.setByte(1, (byte)0);   //G
    colorTable.setByte(2, (byte)0);   //R
    colorTable.setByte(3, (byte)0);     //Alpha
    //Red Particles:
    colorTable.setByte(4, (byte)0);     //B
    colorTable.setByte(5, (byte)0);     //G
    colorTable.setByte(6, (byte)255);   //R
    colorTable.setByte(7, (byte)0);     //Alpha
    try {
        NIVision.writeFile(image, fileName, colorTable);
    } finally {
        colorTable.free();
    }
}
 
开发者ID:frc-team-342,项目名称:wpilibj,代码行数:19,代码来源:BinaryImage.java


示例4: particleFilter

import com.sun.cldc.jna.Pointer; //导入依赖的package包/类
public static int particleFilter(Pointer dest, Pointer source, CriteriaCollection collection) throws NIVisionException {
    Pointer particleFilterOptions = new Pointer(16);
    particleFilterOptions.setInt(0, 0);
    particleFilterOptions.setInt(4, 0);
    particleFilterOptions.setInt(8, 0);
    particleFilterOptions.setInt(12, 1);
    IntByReference i = new IntByReference(0);
    Pointer criteriaArray = collection.getCriteriaArray();
    assertCleanStatus(imaqParticleFilter4Fn.call7(dest.address().toUWord().toPrimitive(),   // dest image
                                                source.address().toUWord().toPrimitive(),   // source image
                                                criteriaArray.address().toUWord().toPrimitive(),  // array of criteria
                                                collection.getNumberOfCriteria(),           // number of criteria in the array
                                                particleFilterOptions.address().toUWord().toPrimitive(),  // particle filter options
                                                0,                                          // Region of interest
                                                i.getPointer().address().toUWord().toPrimitive()));  // returned number of particles
    int numberOfParticles = i.getValue();
    i.free();
    criteriaArray.free();
    particleFilterOptions.free();
    return numberOfParticles;
}
 
开发者ID:frc-team-342,项目名称:wpilibj,代码行数:22,代码来源:NIVision.java


示例5: replaceColorPlanes

import com.sun.cldc.jna.Pointer; //导入依赖的package包/类
/**
 * Replaces one or more of the color planes of a color image. The plane you
 * replace may be independent of the image type. For example, you can
 * replace the green plane of an RGB image or the hue plane of an HSL image.
 * @param dest The destination image.
 * @param source The source image.
 * @param mode The color space in which the function replaces planes.
 * @param plane1 The first plane of replacement data. Set this parameter to null if you do not want to change the first plane of the source image.
 * @param plane2 The second plane of replacement data. Set this parameter to null if you do not want to change the second plane of the source image.
 * @param plane3 The third plane of replacement data. Set this parameter to null if you do not want to change the third plane of the source image.
 */
public static void replaceColorPlanes(Pointer dest, Pointer source,
        ColorMode mode, Pointer plane1, Pointer plane2, Pointer plane3)  throws NIVisionException{
    int plane_1 = 0;
    int plane_2 = 0;
    int plane_3 = 0;
    if (plane1 != null)
        plane_1 = plane1.address().toUWord().toPrimitive();
    if (plane2 != null)
        plane_2 = plane2.address().toUWord().toPrimitive();
    if (plane3 != null)
        plane_3 = plane3.address().toUWord().toPrimitive();
    assertCleanStatus(imaqReplaceColorPlanesFn.call6(
            dest.address().toUWord().toPrimitive(),
            source.address().toUWord().toPrimitive(),
            mode.value,
            plane_1,
            plane_2,
            plane_3));
}
 
开发者ID:frc-team-342,项目名称:wpilibj,代码行数:31,代码来源:NIVision.java


示例6: viBufRead

import com.sun.cldc.jna.Pointer; //导入依赖的package包/类
public static byte[] viBufRead(int vi, int cnt) throws VisaException {
    Pointer bytes = new Pointer(cnt);
    status = viBufReadFn.call2(vi, bytes);
    switch (status) {
        case VI_SUCCESS_TERM_CHAR:
        case VI_SUCCESS_MAX_CNT:
            status = 0;
            break;
        default:
            assertCleanStatus("viBufRead");
    }

    byte[] toReturn = new byte[cnt];
    bytes.getBytes(0, toReturn, 0, cnt);
    bytes.free();
    return toReturn;
}
 
开发者ID:eshsrobotics,项目名称:wpilib-java,代码行数:18,代码来源:Visa.java


示例7: inet_ntop

import com.sun.cldc.jna.Pointer; //导入依赖的package包/类
/**
 * Takes an IPv4 Internet address and returns string representing the address
 * in `.' notation
 *
 * @param in the opaque bytes of an IPv4 "struct in_addr"
 * @return String
 */
public String inet_ntop(int in) {
    Pointer charBuf = new Pointer(Socket.INET_ADDRSTRLEN);
    IntByReference addrBuf = new IntByReference(in); // the addr is passed by value (to handle IPv6)
    String result = sockets.inet_ntop(Socket.AF_INET, addrBuf, charBuf, Socket.INET_ADDRSTRLEN);
    addrBuf.free();
    charBuf.free();
    return result;
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:16,代码来源:GCFSocketsImpl.java


示例8: inet_ntop

import com.sun.cldc.jna.Pointer; //导入依赖的package包/类
/**
 * Takes an IPv4 Internet address and returns string representing the address
 * in `.' notation
 * 
 * @param in the opaque bytes of an IPv4 "struct in_addr"
 * @return String
 */
public String inet_ntop(int in) {
    Pointer charBuf = new Pointer(Socket.INET_ADDRSTRLEN);
    IntByReference addrBuf = new IntByReference(in); // the addr is passed by value (to handle IPv6)
    String result = sockets.inet_ntop(Socket.AF_INET, addrBuf, charBuf, Socket.INET_ADDRSTRLEN);
    addrBuf.free();
    charBuf.free();
    return result;
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:16,代码来源:GCFSocketsImpl.java


示例9: setErrorData

import com.sun.cldc.jna.Pointer; //导入依赖的package包/类
/**
 * Send data to the driver station's error panel
 * @param bytes the byte array containing the properly formatted information for the display
 * @param length the length of the byte array
 * @param timeOut the maximum time to wait
 */
public static void setErrorData(byte[] bytes, int length, int timeOut) {
    Pointer textPtr = new Pointer(bytes.length);
    textPtr.setBytes(0, bytes, 0, bytes.length);
    setErrorDataFn.call3(textPtr, length, timeOut);
    textPtr.free();
}
 
开发者ID:frc-team-342,项目名称:wpilibj,代码行数:13,代码来源:FRCControl.java


示例10: setUserDsLcdData

import com.sun.cldc.jna.Pointer; //导入依赖的package包/类
/**
 * Send data to the driver station's user panel
 * @param bytes the byte array containing the properly formatted information for the display
 * @param length the length of the byte array
 * @param timeOut the maximum time to wait
 */
public static void setUserDsLcdData(byte[] bytes, int length, int timeOut) {
    Pointer textPtr = new Pointer(bytes.length);
    textPtr.setBytes(0, bytes, 0, bytes.length);
    setUserDsLcdDataFn.call3(textPtr, length, timeOut);
    textPtr.free();
}
 
开发者ID:frc-team-342,项目名称:wpilibj,代码行数:13,代码来源:FRCControl.java


示例11: report

import com.sun.cldc.jna.Pointer; //导入依赖的package包/类
/**
 * Report the usage of a resource of interest.
 * 
 * @param resource one of the values in the tResourceType above (max value 51).
 * @param instanceNumber an index that identifies the resource instance.
 * @param context an optional additional context number for some cases (such as module number).  Set to 0 to omit.
 * @param feature a string to be included describing features in use on a specific resource.  Setting the same resource more than once allows you to change the feature string.
 */
public static void report(int resource, int instanceNumber, int context, String feature) {
    if (feature != null) {
        Pointer featureStringPointer = Pointer.createStringBuffer(feature);
        nUsageReporting_reportFn.call4(resource, instanceNumber, context, featureStringPointer);
        //featureStringPointer.free();//TODO check to see if this can get called or not
    } else {
        nUsageReporting_reportFn.call4(resource, instanceNumber, context, Pointer.NULL());
    }
}
 
开发者ID:frc-team-342,项目名称:wpilibj,代码行数:18,代码来源:UsageReporting.java


示例12: viOpen

import com.sun.cldc.jna.Pointer; //导入依赖的package包/类
public synchronized static int viOpen(int sesn, String name, int mode,
        int timeout) throws VisaException {
    Pointer pName = new Pointer(name.length());
    pName.setBytes(0, name.getBytes(), 0, name.length());
    status = viOpenFn.call5(sesn, pName, mode, timeout, pValue.getPointer());
    assertCleanStatus("viOpen");
    pName.free();
    return pValue.getValue();
}
 
开发者ID:frc-team-342,项目名称:wpilibj,代码行数:10,代码来源:Visa.java


示例13: viVPrintf

import com.sun.cldc.jna.Pointer; //导入依赖的package包/类
public static void viVPrintf(int vi, String write) throws VisaException {
    Pointer string = new Pointer(write.length());
    string.setBytes(0, write.getBytes(), 0, write.length());
    status = viVPrintfFn.call2(vi, string);
    string.free();
    assertCleanStatus("viPrintf");
}
 
开发者ID:frc-team-342,项目名称:wpilibj,代码行数:8,代码来源:Visa.java


示例14: viBufWrite

import com.sun.cldc.jna.Pointer; //导入依赖的package包/类
public synchronized static int viBufWrite(int vi, byte[] buf, int cnt) throws VisaException {
    Pointer string = new Pointer(buf.length);
    string.setBytes(0, buf, 0, buf.length);
    status = viBufWriteFn.call4(vi, string, cnt, pValue.getPointer());
    assertCleanStatus("viBufWrite");
    string.free();
    return pValue.getValue();
}
 
开发者ID:frc-team-342,项目名称:wpilibj,代码行数:9,代码来源:Visa.java


示例15: getCriteriaArray

import com.sun.cldc.jna.Pointer; //导入依赖的package包/类
public Pointer getCriteriaArray() {
    Pointer p = new Pointer(criteria.size() * 5 * 4);  // 5 elements each 4 bytes
    for (int i = 0; i < criteria.size(); i++) {
        ParticleFilterCriteria pfc = (ParticleFilterCriteria) criteria.elementAt(i);
        p.setInt(i * 20, pfc.type.value);
        p.setFloat(i * 20 + 4, pfc.lower);
        p.setFloat(i * 20 + 8, pfc.upper);
        p.setInt(i * 20 + 12, 0);   // always use pixel measurements for now
        p.setInt(i * 20 + 16, pfc.outsideRange ? 1 : 0);
    }
    return p;
}
 
开发者ID:frc-team-342,项目名称:wpilibj,代码行数:13,代码来源:CriteriaCollection.java


示例16: getHeight

import com.sun.cldc.jna.Pointer; //导入依赖的package包/类
/**
 * Get the height of an image.
 * @param image The image to get the height of.
 * @return The height of the image.
 */
public static int getHeight(Pointer image)  throws NIVisionException{
    Pointer i = new Pointer(4);
    int val;
    try {
        assertCleanStatus(imaqGetImageSizeFn.call3(image, 0, i));
    } finally {
        val = i.getInt(0);
        i.free();
    }
    return val;
}
 
开发者ID:frc-team-342,项目名称:wpilibj,代码行数:17,代码来源:NIVision.java


示例17: getWidth

import com.sun.cldc.jna.Pointer; //导入依赖的package包/类
/**
 * Get the width of an image.
 * @param image The image to get the width of.
 * @return The width of the image.
 */
public static int getWidth(Pointer image)  throws NIVisionException{
    Pointer i = new Pointer(4);
    int val;
    try {
        assertCleanStatus(imaqGetImageSizeFn.call3(image, i, 0));
    } finally {
        val = i.getInt(0);
        i.free();
    }
    return val;
}
 
开发者ID:frc-team-342,项目名称:wpilibj,代码行数:17,代码来源:NIVision.java


示例18: countParticles

import com.sun.cldc.jna.Pointer; //导入依赖的package包/类
/**
 * Counts the number of particles in a binary image.
 * @param image The image to count the particles in
 * @return The number of particles
 */
public static int countParticles(Pointer image)  throws NIVisionException{
    IntByReference i = new IntByReference(0);
    int val;
    try {
        assertCleanStatus(imaqCountParticlesFn.call3(image, 1, i.getPointer()));
    } finally {
        val = i.getValue();
        i.free();
    }
    return val;
}
 
开发者ID:frc-team-342,项目名称:wpilibj,代码行数:17,代码来源:NIVision.java


示例19: MeasureParticle

import com.sun.cldc.jna.Pointer; //导入依赖的package包/类
/**
 * Returns a measurement associated with a particle
 * @param image The image containing the particle to get information about.
 * @param particleNum The number of the particle to get information about.
 * @param calibrated Specifies whether to return the measurement as a real-world value.
 * @param type The measurement to make on the particle.
 * @return The value of the requested measurement.
 */
public static double MeasureParticle (Pointer image, int particleNum, boolean calibrated, MeasurementType type)  throws NIVisionException{
    Pointer l = new Pointer(8);
    double val;
    try {
        assertCleanStatus(imaqMeasureParticleFn.call5(image, particleNum, calibrated?1:0, type.value, l));
    } finally {
        val = l.getDouble(0);
        l.free();
    }
    return val;
}
 
开发者ID:frc-team-342,项目名称:wpilibj,代码行数:20,代码来源:NIVision.java


示例20: colorThreshold

import com.sun.cldc.jna.Pointer; //导入依赖的package包/类
/**
 * Convert the given image into a binary image true where the colors match the given thresholds
 * @param dest the 8 bit monocolor image to store the result in
 * @param source the color image source
 * @param mode The mode of color to use
 * @param plane1Range First color range
 * @param plane2Range Second color range
 * @param plane3Range Third color range
 */
public static void colorThreshold(Pointer dest, Pointer source, ColorMode mode,
        Pointer plane1Range, Pointer plane2Range, Pointer plane3Range)  throws NIVisionException{
    int replaceValue = 1;
    assertCleanStatus(imaqColorThresholdFn.call7(dest.address().toUWord().toPrimitive(),
            source.address().toUWord().toPrimitive(),
            replaceValue, mode.value,
            plane1Range.address().toUWord().toPrimitive(),
            plane2Range.address().toUWord().toPrimitive(),
            plane3Range.address().toUWord().toPrimitive()));
}
 
开发者ID:frc-team-342,项目名称:wpilibj,代码行数:20,代码来源:NIVision.java



注:本文中的com.sun.cldc.jna.Pointer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java GroupedAggregator类代码示例发布时间:2022-05-23
下一篇:
Java EditorGrid类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap