Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

croll12

Member Since 31 Dec 2013
Offline Last Active Nov 23 2014 10:06 PM
-----

Topics I've Started

Database file?

08 July 2014 - 12:25 AM

I am using a Netduino Plus 2 to call our servers and post transactions with re-loadable cards.  Everything is working great, but I am trying to find a way to store the transactions on the SD card in the event it can not communicate with our servers (internet outage), then when the connection is restored it will try and post the transactions.  I did this previously with .net and mysql.  After reading other posts it is obvious mysql is out for the micro framework.  Are there any ideas that would work similar to a database other than a simple text file?

 

Thanks in advance for the help and ideas.


System.Decimal.Multiply missing?

12 January 2014 - 01:07 AM

I am using a Netduino Plus 2 with VS 2012 and am trying to sync/set the date and time on the netduino to an NTP server.  I have found a function online and made the necessary conversions to VB and ran into a road block here:

 

fractpart = Convert.ToUInt64(256 * fractpart + ntpData(offsetTransmitTime + i))

 

I am getting an error "Requested opperation is not valid because the runtume library System.Decimal.Multiply is not defined".  I have looked at all references available and can not find a solution.  Any help would be greatly appreciated.  Here is the full function:

 

 Public Function GetNetworkTime() As DateTime
        Dim ep As New IPEndPoint(Dns.GetHostEntry("time-a.nist.gov").AddressList(0), 123)
        Dim s As New Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp)
        s.Connect(ep)
        Dim ntpData As Byte() = New Byte(47) {}
        ' RFC 2030
        ntpData(0) = &H1B
        For i As Integer = 1 To 47
            ntpData(i) = 0
        Next
        s.Send(ntpData)
        s.Receive(ntpData)
        Dim offsetTransmitTime As Byte = 40
        Dim intpart As ULong = 0
        Dim fractpart As ULong = 0
        For i As Integer = 0 To 3
            intpart = Convert.ToUInt64(256 * intpart + ntpData(offsetTransmitTime + i))
        Next
 
        For i As Integer = 4 To 7
            fractpart = Convert.ToUInt64(256 * fractpart + ntpData(offsetTransmitTime + i))
        Next
 
        Dim milliseconds As ULong = Convert.ToUInt64(intpart * 1000 + (fractpart * 1000) / &H100000000L)
        s.Close()
        Dim timeSpan__1 As TimeSpan = TimeSpan.FromTicks(CLng(milliseconds) * TimeSpan.TicksPerMillisecond)
        Dim dateTime As New DateTime(1900, 1, 1)
        dateTime += timeSpan__1
        Dim offsetAmount As TimeSpan = TimeZone.CurrentTimeZone.GetUtcOffset(dateTime)
        Dim networkDateTime As DateTime = (dateTime + offsetAmount)
        Debug.Print(networkDateTime.ToString())
        Return networkDateTime
    End Function

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.